: Learning GNU Emacs, 3rd Edition

7.2.4 Changing Margins

7.2.4 Changing Margins

Emacs is not a word processor, but it does have a few commands that change left and right indentation for a buffer for the current session. First, mark the whole buffer using C-x h. You can then gchange the indention using M-x followed by one of the following commands:

increase-left-margin

decrease-left-margin

increase-right-margin

decrease-right-margin

These commands are also available through the Edit menu. Choose Edit ? Text Properties ? Indentation to see the options.

Unless you supply a numeric argument using C-u or M-n preceding these commands, Emacs increases or decreases the margins by the number of characters in the variable standard-indent, which defaults to 4. If auto-fill mode is on, Emacs also reformats the paragraphs automatically.

Margin settings remain in effect for the current session and the current buffer only. Although the values don't persist to another session, any text that is indented using this method remains indented when you reopen the file. If you open the file again and add some text, however, it is not indented; you have to set the margins again.

These commands work best in cases where you want to change the margin for the whole buffer. If you define a smaller region, the commands work but if you type more paragraphs, the margin settings persist whether you want them to or not. These commands work fine if you've completed the file and then decide to change the indentation.

Alternatively, you can set and save margins using enriched mode, a minor mode that allows Emacs to save text properties, including margin settings and font changes. See Chapter 10 for more details on enriched mode.


: 0.547. /Cache: 3 / 1