Next: Outline Motion, Previous: Outline Mode, Up: Outline Mode [Contents][Index]
Outline mode assumes that the lines in the buffer are of two types: heading lines and body lines. A heading line represents a topic in the outline. Heading lines start with one or more stars; the number of stars determines the depth of the heading in the outline structure. Thus, a heading line with one star is a major topic; all the heading lines with two stars between it and the next one-star heading are its subtopics; and so on. Any line that is not a heading line is a body line. Body lines belong to the preceding heading line. Here is an example:
* 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 A second first-level topic with its header line.
A heading line together with all following body lines is called collectively an entry. A heading line together with all following deeper heading lines and their body lines is called a subtree.
You can customize the criterion for distinguishing heading lines by
setting the variable outline-regexp
. Any line whose beginning
has a match for this regexp is considered a heading line. Matches that
start within a line (not at the beginning) do not count. The length of
the matching text determines the level of the heading; longer matches
make a more deeply nested level. Thus, for example, if a text formatter
has commands ‘@chapter’, ‘@section’ and ‘@subsection’
to divide the document into chapters and sections, you can make those
lines count as heading lines by setting outline-regexp
to
‘"@chap\\|@\\(sub\\)*section"’. Note the trick: the two words
‘chapter’ and ‘section’ are the same length, but by defining
the regexp to match only ‘chap’ we ensure that the length of the
text matched on a chapter heading is shorter, so that Outline mode will
know that sections are contained in chapters. This works as long as no
other command starts with ‘@chap’.
Outline mode makes a line invisible by changing the newline before it into an ASCII Control-M (code 015). Most editing commands that work on lines treat an invisible line as part of the previous line because, strictly speaking, it is part of that line, since there is no longer a newline in between. When you save the file in Outline mode, Control-M characters are saved as newlines, so the invisible lines become ordinary lines in the file. Saving does not change the visibility status of a line inside Emacs.
Next: Outline Motion, Previous: Outline Mode, Up: Outline Mode [Contents][Index]