Next: Font Lock Mode, Previous: Imenu, Up: Major and Minor Modes [Contents][Index]
Outline minor mode is a buffer-local minor mode that hides parts of the buffer and leaves only heading lines visible. This minor mode can be used in conjunction with other major modes (see Outline Minor Mode in the Emacs Manual).
There are two ways to define which lines are headings: with the
variable outline-regexp
or outline-search-function
.
This variable is a regular expression. Any line whose beginning has a match for this regexp is considered a heading line. Matches that start within a line (not at the left margin) do not count.
Alternatively, when it’s impossible to create a regexp that matches heading lines, you can define a function that helps Outline minor mode to find heading lines.
The variable outline-search-function
specifies the function with
four arguments: bound, move, backward, and
looking-at. The function completes two tasks: to match the
current heading line, and to find the next or the previous heading line.
If the argument looking-at is non-nil
, it should return
non-nil
when point is at the beginning of the outline header line.
If the argument looking-at is nil
, the first three arguments
are used. The argument bound is a buffer position that bounds
the search. The match found must not end after that position. A
value of nil means search to the end of the accessible portion of
the buffer. If the argument move is non-nil
, the
failed search should move to the limit of search and return nil.
If the argument backward is non-nil
, this function
should search for the previous heading backward.
This variable is a function that takes no arguments
and should return the level of the current heading.
It’s required in both cases: whether you define
outline-regexp
or outline-search-function
.
If built with tree-sitter, Emacs can automatically use Outline minor mode if the major mode sets the following variable.
This variable instructs Emacs how to find lines with outline headings. It should be a predicate that matches the node on the heading line.
Next: Font Lock Mode, Previous: Imenu, Up: Major and Minor Modes [Contents][Index]