问题描述
我想使用组织速度作为导航大型 .org
文件的主要方法,但具有以下更改:
I would like to use org-velocity as my primary means of navigating large .org
files but with the following changes:
-
在org-velocity中运行搜索后,我希望缓冲区能够自动缩小到该子树,一旦我做出选择。
After running a search in org-velocity, I would like the buffer to automatically narrow to that subtree, once I make my selection.
即使缓冲区变窄,Org-velocity也应该对整个文件进行搜索。
Org-velocity should run its search against the entire file, even if the buffer is narrowed.
对于第(1)部分,我认为这样的工作应该是有效的:
For part (1) I think something like this should work:
(add-hook'org-follow-link -hook(lambda()(org-narrow-to-subtree)))
但这不是正确的钩子。不确定如何接近(2)。有任何想法吗?谢谢!
But this is not the right hook. Not sure how to approach (2). Any ideas? Thanks!
推荐答案
好的,我想我有一个完整的解决方案!
Okay, I think I have a complete solution!
-
确保您安装了这个分支的机密速度:
Make sure you have this fork of org-velocity installed:
打开您的org-velocity.el文件,并用以下替换行763-765:
Open your org-velocity.el file and replace lines 763-765 with this:
(progn
(with-current-buffer (org-velocity-match-buffer)
(kill-buffer-and-window))
(org-narrow-to-subtree)
(show-all))))))
附加代码告诉组织速度首先将缓冲区缩小到所选的子树,其次是展开该节点。
The additional code tells org-velocity to first narrow the buffer to the selected subtree and secondly to expand that node.
将此代码放在搜索路径中的某个位置(init.el,.emacs等)
Put this code somewhere in your search path (init.el, .emacs, etc.)
(defadvice org-velocity (around search-all activate)
"Widen for search with org-velocity"
(widen)
ad-do-it)
这就是!
谢谢托比亚斯,保罗和马图斯走过我这个!!
Thank you Tobias, Paul and Matúš for walking me through this!!
小心,
-Adam
这篇关于狭窄到有机速度的子树的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!