Is there some kind of narrow-to-context in org-mode?

筅森魡賤 提交于 2019-12-11 04:49:46

问题


Org's narrow-to-subtree is wonderful, but sometimes I also want to see the chain of parent nodes, without all the uncle nodes.

For example, given this tree:

* a
** a.a     <- extraneous great uncle
** a.b
*** a.b.a  <- extraneous uncle
*** a.b.b  <- want to see context for this
**** a.b.b.a
**** a.b.b.b

I want to narrow my view to see this:

* a
** a.b
*** a.b.b  <- want to see context for this
**** a.b.b.a
**** a.b.b.b

How can I make this happen?


回答1:


AFAIK, there is no such narrowing facility - but the function org-display-outline-path will display "a/a.b" for the heading in question, i.e. the outline path of headings above your current heading. You can add the function to the modeline indicator if you want it to be permanently visible - or perhaps use the (normally absent) header line which has more space to grow. Try with this file:

* foo

#+BEGIN_SRC emacs-lisp
(setq header-line-format '(:eval (org-display-outline-path)))
#+END_SRC

#+RESULTS:
: (:eval (org-display-outline-path))


** bar

*** baz

Evaluate the code block to set the header-line-format-variable and then see what the header line says when the cursor is on the "** bar" header or the "*** baz" header.



来源:https://stackoverflow.com/questions/38667497/is-there-some-kind-of-narrow-to-context-in-org-mode

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!