抄了一段代码,能显示当前标题内容的同时折叠其他标题内容。
相比 org-narrow-to-subtree
,能看到其他标题,算是一个优点
不过有个小问题,每次执行 org-show-current-heading-tidily
之后光标都会跳到标题上而非保留在内容中,请问有什么办法执行的时候不移动光标吗?谢谢各位。
;; 显示当前 heading 内容并折叠其他
;; https://emacstil.com/til/2021/09/09/fold-heading/
(defun org-show-current-heading-tidily ()
(interactive)
"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)))