在 Emacs Org 模式下执行标签搜索时消除不匹配的顶级树
在过去的一年半中,我在组织模式下为我当前雇主的工程笔记维护了一个整体缓冲区。尽管主要包含指向其他文档的指针,但按照人类标准,该文件已经变得相当大(48,290 行文本),同时仍然可以通过编程方式进行简单的搜索和编辑(阅读:grep 和 Org 模式标签搜索)。
不过,有一件事困扰着我。当我使用 Org Mode 6.33x 执行标签搜索时,Org 的稀疏树视图保留折叠的缓冲区内不匹配树的表示(即前面带有单个星号 * 的内容)。这对于较小的缓冲区或更好地组织成具有多个分支的单个树的缓冲区通常很有用。然而,这对于按时间顺序生成每棵新树(每天一棵)的文档来说效果不佳,就像我一直在做的那样。
。
在继续之前,我会注意到我的解决方法是我刚才提出的问题所固有的,就像我使用此缓冲区的文档习惯的明显改变一样。然而,仍然存在以下问题:
1)为什么 Org Mode 在执行稀疏标签搜索时以这种方式组织树?技术细节是不言而喻的,而用户体验决策则不那么明显。
2) 如果我希望使用 Emacs Lisp 编写的脚本来纠正此问题,我应该更详细地探索哪些钩子和命令来重构文档视图?为标准命令(例如,org-match-sparse-tree)编写重写已经是不言而喻的了。
。
先感谢您。
For the past year and a half, I've maintained a monolithic buffer in Org Mode for my engineering notes with my current employer. Despite containing mostly pointers to other documents, this file has become quite large by human standards (48,290 lines of text), while remaining trivially searchable and editable through programmatic means (read: grep and Org Mode tag search).
One thing bothers me, though. When I perform a tag search using Org Mode 6.33x, Org's sparse tree view retains the folded representation of unmatched trees within the buffer (that is, content preceded by a single asterisk, *). This is generally useful for smaller buffers or those better organized into a single tree with multiple branches. However, this doesn't work especially well for documentation where each new tree is generated chronologically, one for each day, as I've been doing.
.
Before I continue, I'll note that my workaround is inherent in what I've just asked, as are the obvious alterations in my documentation habits with this buffer. However, the following questions remain:
1) Why does Org Mode organize trees in this manner when performing sparse tag searching? The technical details are self-evident, the UX decisions less so.
2) If I wished to correct this issue with a script written in Emacs Lisp, what hooks and commands should I explore in more detail to restructure the document view? Writing overrides for the standard commands (for example, org-match-sparse-tree
) is already self-evident.
.
Thank you in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
正如您已经注意到的那样,该问题仅影响顶级标题。好处是,在组织模式下,您可以通过简单的按键轻松降级所有标题。这样你就可以避免这个问题。之后的清理工作也只是一些简单的按键操作。
分步说明:
outline-demote
)* root\n
。* root\n
并使用 M-left 再次提升标题,我的印象是您甚至可以保留整体- 标题为您的应用程序所在的位置。
As you already noticed the problem only affects the top level headings. The good thing is that in org-mode you can demote easily all headings with simple keystrokes. This way you can avoid the problem. Also cleaning up afterwards are just some simple keystrokes.
Step-by-step instructions:
outline-demote
)* root\n
at the beginning of the file* root\n
at the beginning of the file and promote the headings again with M-leftI have got the impression that you can even leave the overall-heading where it is for your application.