Next: , Previous: , Up: Text   [Contents][Index]

25.12 Nroff Mode

Nroff mode, a major mode derived from Text mode, is specialized for editing nroff files (e.g., Unix man pages). Type M-x nroff-mode to enter this mode. Entering Nroff mode runs the hook text-mode-hook, then nroff-mode-hook (see Hooks).

In Nroff mode, nroff command lines are treated as paragraph separators, pages are separated by ‘.bp’ commands, and comments start with backslash-doublequote. It also defines these commands:


Move to the beginning of the next line that isn’t an nroff command (forward-text-line). An argument is a repeat count.


Like M-n but move up (backward-text-line).


Displays in the echo area the number of text lines (lines that are not nroff commands) in the region (count-text-lines).

Electric Nroff mode is a buffer-local minor mode that can be used with Nroff mode. To toggle this minor mode, type M-x electric-nroff-mode (see Minor Modes). When the mode is on, each time you type RET to end a line containing an nroff command that opens a kind of grouping, the nroff command to close that grouping is automatically inserted on the following line.

If you use Outline minor mode with Nroff mode (see Outline Mode), heading lines are lines of the form ‘.H’ followed by a number (the header level).