7.4.5 Promoting and Demoting Sections
Often as you're writing, you find that a certain heading should really be promoted or demoted a level. To promote a heading, type C-c C-^. To demote it a level, C-c C-v. (Note the clever attempt to make the key bindings indicate that you're moving headings up or down a level using ^ and v.) This automatically changes the markings for the heading in question. In other words, promoting a second-level heading removes an asterisk, making it a first-level heading. You'll find the commands to move to the next and previous headings, C-c C-n and C-c C-p, helpful when you are promoting and demoting sections.
But what if you want to demote not just a heading but a subtree? Or even the entire outline? At the moment, you'd have to write a Lisp function to do that (or use someone else's). Several functions like this have been written by gurus and posted online, but none are part of Emacs at this writing. We hope this function is incorporated soon.
7.4.6 Using Outline Minor Mode
Outline mode is also available as a minor mode so that you can use it subordinately to your favorite major mode. To start outline mode as a minor mode, type M-x outline-minor-mode; Outl appears on the mode line. In some ways, this mode is less convenient; rather than the simple C-c prefix you use for most outline mode commands, in outline minor mode, you must preface all commands with C-c @ instead, to avoid interfering with the usual C-c commands of the major mode. So, if you want to move down to the next heading (the C-c C-n command in outline mode), you would type C-c @ C-n instead.
Please note that mixing outline major mode and outline minor mode is not only redundant but can be dangerous. Turning on the minor mode while the major mode is on can confuse Emacs. Exit outline mode, then enter outline minor mode if you wish.
Table 7-4 summarizes outline mode commands. In the next section, we discuss another specialized editing method: editing with rectangles.
Table 7-4. Outline mode commands
| Keystrokes | Command name | Action |
|---|---|---|
| (none) | outline-mode | Toggle outline mode. |
| C-c C-n Headings → Next | outline-next-visible-heading | Move to the next heading. |
| C-c C-p Headings → Previous | outline-previous-visible-heading | Move to the previous heading. |
| C-c C-f Headings → Next Same Level | outline-forward-same-level | Move to the next heading of the same level. |
| C-c C-b Headings → Previous Same Level | outline-backward-same-level | Move to the previous heading of same level. |
| C-c C-u Headings → Up | outline-up-heading | Move up one heading level. |
| C-c C-t Hide → Hide Body | hide-body | Hide all body lines. |
| C-c C-a Show → Show All | show-all | Show everything that's hidden. |
| C-c C-q Hide → Hide Sublevels | hide-sublevels | Display first level headers only. |
| C-c C-o Hide → Hide Other | hide-other | Hide all text and headings outside the current subtree. First level headers show. |
| C-c @ | outline-mark-subtree | Mark the current header and all sublevels. |
| C-c C-^ | outline-promote | Promote the current heading one level. |
| C-c C-v | outline-demote | Demote the current heading one level. |
| C-c C-d Hide → Hide Subtree | hide-subtree | Hide subheads and body associated with a given heading. |
| C-c C-c Hide → Hide Entry | hide-entry | Hide the body associated with a particular heading (not subheads and their bodies). |
| C-c C-l Hide → Hide Leaves | hide-leaves | Hide the body of a particular heading and the bodies of all its subheads. |
| C-c C-s Show → Show Subtree | show-subtree | Show the subheads and text associated with a given heading. |
| C-c C-e Show → Show Entry | show-entry | Show the body associated with a particular heading (not subheads and their bodies). |
| C-c C-k Show → Show Branches | show-branches | Show the body of a heading and bodies of all its subheads. |
| C-c Tab Show → Show Children | show-children | Show the next level of subheads associated with a particular heading (none of body text). |