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

20.1.1 Nroff Mode

Nroff mode is a mode like Text mode but modified to handle nroff commands present in the text. Invoke M-x nroff-mode to enter this mode. Nroff mode differs from Text mode in only a few ways. All nroff command lines are considered paragraph separators, so that filling never garbles the nroff commands. Pages are separated by ‘.bp’ commands. Comments start with backslash-doublequote. There are also three special commands that are not available in Text mode:


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).


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

The other feature of Nroff mode is Electric Nroff newline mode. This is a minor mode that you can turn on or off with M-x electric-nroff-mode (see Minor Modes). When the mode is on and you use RET to end a line containing an nroff command that opens a kind of grouping, Emacs automatically inserts the matching nroff command to close that grouping on the following line. For example, if you are at the beginning of a line and type .(b RET, the matching command ‘.)b’ will be inserted on a new line following point.

Entering Nroff mode calls the value of the variable text-mode-hook with no arguments, if that value exists and is not nil; then it does the same with the variable nroff-mode-hook.

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