首页 > 解决方案 > 是否可以只折叠一个子树而不必循环 TAB 功能?

问题描述

我的意思是,如果你有一棵树,然后你去 1.2.1,我想扩展和折叠它而不扩展孩子(1.2.1.1 和 1.2.1.2)。

换句话说,通常我必须按三下TAB,这显示了所有子子项的扩展。我只想要一个不同的按键来关闭最近打开的子树。

谢谢!希望我说清楚了!例如

标签: org-modesubtree

解决方案


有可能,如果您开始定义 lisp 函数,那么在 emacs 中一切皆有可能。然而,这使我不知道。

我从可用功能中可以看出,您不能以直接的方式做到这一点。请参阅 TAB 键帮助中的一些相关亮点:

<tab> runs the command org-cycle.

(...)

- When point is at the beginning of a headline, rotate the subtree started
  by this line through 3 different states (local cycling)
  1. FOLDED:   Only the main headline is shown.
  2. CHILDREN: The main headline and the direct children are shown.
               From this state, you can move to one of the children
               and zoom in further.
  3. SUBTREE:  Show the entire subtree, including body text.
  If there is no subtree, switch directly from CHILDREN to FOLDED.

(...)

- When there is a numeric prefix, go up to a heading with level ARG, do
  a ‘show-subtree’ and return to the previous cursor position.  If ARG
  is negative, go up that many levels.

完整帮助请参阅“Ch k TAB”。

您还可以设置VISIBILITY每个缓冲区的属性:

 #+STARTUP: fold              (or ‘overview’, this is equivalent)
 #+STARTUP: nofold            (or ‘showall’, this is equivalent)
 #+STARTUP: content
 #+STARTUP: showeverything

见:C-h v org-startup-folded

底线是:也许最简单的方法就是按 TAB 3 次,除非您精通 lisp 并且愿意进行更改,,,


推荐阅读