首先,在*scratch* buffer中键入下面一段文字:
* Food This is the body, which says something about the topic of food. ** Delicious Food This is the body of the second-level header. ** Distasteful Food This could have a body too, with several lines. *** Dormitory Food * Shelter Another first-level topic with its header line.
然后将该buffer的模式转为outline-mode:
(defun myfunc ())
import java.util.* public static void main(String test){ try{ } }
下面我们来实验一些操作,但在这个之前需要解释一些概念:
大纲模式将buffer中的行区别为:
注意: 可以定制变量outline-regexp
来识别标题行
标题和正文行的组合:
注意:
1. 记录的直接正文只能在记录的开始部份
2. 如果记录的正文或者正文和所有子树被隐藏,则该标题行的末尾会出现省略号(...)
3. 如果记录仅仅子树被隐藏,那么在记录正文后面会出现省略号(...), 如果该记录没有正文,则效果同上
outline-mode使用如下快捷键和命令:
移动命令:
Key Binding | Function | Comments |
---|---|---|
C-c C-n | outline-next-visible-heading | move by visible headings |
C-c C-p | outline-previous-visible-heading | |
C-c C-f | outline-forward-same-level | similar but skip subheadings |
C-c C-b | outline-backward-same-level | |
C-c C-u | outline-up-heading | move from subheading to heading |
全局隐藏:
Key Binding | Function | Comments |
---|---|---|
C-c C-t | hide-body | make all text invisible (not headings). Recursively, Body |
C-c C-a | show-body | make everything in buffer visible. Recursively, Body |
C-c C-q | hide-sublevels | make only the first N levels of headers visible.(C-u, M-(number) to pass the level n, Recursively, Heading |
C-c C-o | hide-other | show current entry, and all level parent headings, hide |
位置相关的隐藏
(如果是在标题行,则指当前标题,否则是指正文行所属的直接上级标题, 影响局限于该标题下的子树)
Key Binding | Function | Comments |
---|---|---|
C-c C-d | hide-subtree | Recursively, Subtree(Body, Heading) |
C-c C-s | show-subtree | Recursively, Subtree(Body, Heading) |
C-c TAB | show-children | Direct, Heading |
C-c C-k | show-branches | Recursively, Heading |
C-c C-l | hide-leaves | Recursively, Body |
C-c C-c | hide-entry | Direct, Body |
C-c C-e | show-entry | Direct, Body |
The remaining commands are used when point is on a heading line. They apply to some of the body or subheadings of that heading. C-c C-d hide-subtree make body and subheadings invisible. C-c C-s show-subtree make body and subheadings visible. C-c TAB show-children make direct subheadings visible.
No effect on body, or subheadings 2 or more levels down. With arg N, affects subheadings N levels down. C-c C-c make immediately following body invisible. C-c C-e make it visible. C-c C-l make body under heading and under its subheadings invisible. The subheadings remain visible. C-c C-k make all subheadings at all levels visible.
test | |
---|---|
col1 | col2 |
text | text2 |