: Learning GNU Emacs, 3rd Edition

2.7.3 Turning On Text Mode and Auto-Fill Mode Automatically

2.7.3 Turning On Text Mode and Auto-Fill Mode Automatically

To make text mode the default major mode and start auto-fill mode automatically each time you enter Emacs, add these lines to your .emacs file:

(setq default-major-mode 'text-mode)
(add-hook 'text-mode-hook 'turn-on-auto-fill)

The first line tells Emacs to make text mode the default major mode; in other words, "Turn on text mode unless I tell you otherwise." The second line turns on auto-fill mode whenever you are in text mode. Alternatively, selecting Options? Word Wrap in Text Modes, and then Options? Save Options adds auto-fill mode to your .emacs file directly. It doesn't make text mode the default major mode, however.

If you prefer refill mode, replace the second line of code with this line:

(add-hook 'text-mode-hook (lambda ( ) (refill-mode 1)))


: 0.251. /Cache: 3 / 1