25.9.3 Outline Visibility Commands
Outline mode provides several commands for temporarily hiding or revealing parts of the buffer, based on the outline structure. These commands are not undoable; their effects are simply not recorded by the undo mechanism, so you can undo right past them (see Undo).
Many of these commands act on the current heading line. If point is on a heading line, that is the current heading line; if point is on a body line, the current heading line is the nearest preceding header line.
C-c C-c
β
Make the current heading lineβs body invisible (outline-hide-entry
).
C-c C-e
β
Make the current heading lineβs body visible (outline-show-entry
).
C-c C-d
β
Make everything under the current heading invisible, not including the heading itself (outline-hide-subtree
).
C-c C-s
β
Make everything under the current heading visible, including body, subheadings, and their bodies (outline-show-subtree
).
C-c C-l
β
Make the body of the current heading line, and of all its subheadings, invisible (outline-hide-leaves
).
C-c C-k
β
Make all subheadings of the current heading line, at all levels, visible (outline-show-branches
).
C-c C-i
β
Make immediate subheadings (one level down) of the current heading line visible (outline-show-children
).
C-c C-t
β
Make all body lines in the buffer invisible (outline-hide-body
).
C-c C-a
β
Make all lines in the buffer visible (outline-show-all
).
C-c C-q
β
Hide everything except the top n
levels of heading lines (outline-hide-sublevels
).
C-c C-o
β
Hide everything except for the heading or body that point is in, plus the headings leading up from there to the top level of the outline (outline-hide-other
).
The simplest of these commands are C-c C-c
(outline-hide-entry
), which hides the body lines directly following the current heading line, and C-c C-e
(outline-show-entry
), which reveals them. Subheadings and their bodies are not affected.
The commands C-c C-d
(outline-hide-subtree
) and C-c C-s
(outline-show-subtree
) are more powerful. They apply to the current heading lineβs subtree: its body, all of its subheadings, both direct and indirect, and all of their bodies.
The command C-c C-l
(outline-hide-leaves
) hides the body of the current heading line as well as all the bodies in its subtree; the subheadings themselves are left visible. The command C-c C-k
(outline-show-branches
) reveals the subheadings, if they had previously been hidden (e.g., by C-c C-d
). The command C-c C-i
(outline-show-children
) is a weaker version of this; it reveals just the direct subheadings, i.e., those one level down.
The command C-c C-o
(outline-hide-other
) hides everything except the entry that point is in, plus its parents (the headers leading up from there to top level in the outline) and the top level headings. It also reveals body lines preceding the first heading in the buffer.
The remaining commands affect the whole buffer. C-c C-t
(outline-hide-body
) makes all body lines invisible, so that you see just the outline structure (as a special exception, it will not hide lines at the top of the file, preceding the first header line, even though these are technically body lines). C-c C-a
(outline-show-all
) makes all lines visible. C-c C-q
(outline-hide-sublevels
) hides all but the top level headings at and above the level of the current heading line (defaulting to 1 if point is not on a heading); with a numeric argument n
, it hides everything except the top n
levels of heading lines. Note that it completely reveals all the n
top levels and the body lines before the first heading.
When incremental search finds text that is hidden by Outline mode, it makes that part of the buffer visible. If you exit the search at that position, the text remains visible. To toggle whether or not an active incremental search can match hidden text, type M-s i
. To change the default for future searches, customize the option search-invisible
. (This option also affects how query-replace
and related functions treat hidden text, see Query Replace.) You can also automatically make text visible as you navigate in it by using Reveal mode (M-x reveal-mode
), a buffer-local minor mode.