我使用org-mode来处理多个文件中的任务和项目.
在每周议程中,可以使用<TAB>或跳转到每个TODO条目的位置<RET>.如果目标文件先前未打开,则会加载它,并将光标设置为正确的标题并展开整个文档,包括抽屉.
我非常希望看到只有稀疏的树,除了正确的标题折叠(子树可见性无关紧要).
可以通过使用循环全局可见性来折叠整个树C-u <TAB,但是我必须再次找到标题.
我知道我可以通过缩小缓冲区来隐藏其余部分,如下所述: Emacs,如何只显示当前任务并在org-mode中隐藏其他任务? 但后来我放松了上下文(父母标题,轻松访问兄弟姐妹),抽屉仍然打开.
理想情况下,我希望有一个显示以下内容的命令:
编辑:
user3173715发布的功能略有修改版似乎可以解决问题:
(defun org-show-current-heading-tidily ()
"Show next entry, keeping other entries closed."
(if (save-excursion (end-of-line) (outline-invisible-p))
(progn (org-show-entry) (show-children))
(outline-back-to-heading)
(unless (and (bolp) (org-on-heading-p))
(org-up-heading-safe)
(hide-subtree)
(error "Boundary reached"))
(org-overview)
(org-reveal t)
(org-show-entry)
(show-children)))
Run Code Online (Sandbox Code Playgroud)