我为 Org-mode 找到了这个漂亮的小功能:
;;; Move to next heading with dedicated buffer preview
(defun ded/org-show-next-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-next-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)))
它从一个标题移动到另一个标题,并显示其直接内容和子项。我喜欢这个想法,但更希望它显示在专用缓冲区中,使用(org-tree-to-indirect-buffer)
.
我试着这样做:
(defun ded/org-show-next-heading-test ()
"Show next entry, keeping other entries closed."
(if (save-excursion (end-of-line) (outline-invisible-p))
(progn (org-show-entry) (org-tree-to-indirect-buffer))
(outline-next-heading)
(unless (and (bolp) (org-on-heading-p))
(org-up-heading-safe)
(hide-subtree)
(error "Boundary reached"))
(org-overview)
(org-reveal t)
(org-tree-to-indirect-buffer)
(show-children)))
但是然后我必须双击该键-一旦它在专用缓冲区中显示条目,然后它仍然显示该条目。我试图删除该progn
功能,但后来它并没有完全起作用。
我不是一个 lisp 程序员,我试着用它玩了一个小时左右但无济于事,所以我希望有经验的人帮我解决这个问题 :)
非常感谢。