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

20.6.1 Auto Fill Mode

Auto Fill mode is a minor mode in which lines are broken automatically when they become too wide. Breaking happens only when you type a SPC or RET.

M-x auto-fill-mode

Enable or disable Auto Fill mode.


In Auto Fill mode, break lines when appropriate.

M-x auto-fill-mode turns Auto Fill mode on if it was off, or off if it was on. With a positive numeric argument the command always turns Auto Fill mode on, and with a negative argument it always turns it off. The presence of the word ‘Fill’ in the mode line, inside the parentheses, indicates that Auto Fill mode is in effect. Auto Fill mode is a minor mode; you can turn it on or off for each buffer individually. See Minor Modes.

In Auto Fill mode, lines are broken automatically at spaces when they get longer than desired. Line breaking and rearrangement takes place only when you type SPC or RET. To insert a space or newline without permitting line-breaking, type C-q SPC or C-q LFD (recall that a newline is really a linefeed). C-o inserts a newline without line breaking.

Auto Fill mode works well with Lisp mode: when it makes a new line in Lisp mode, it indents that line with TAB. If a line ending in a Lisp comment gets too long, the text of the comment is split into two comment lines. Optionally, new comment delimiters are inserted at the end of the first line and the beginning of the second, so that each line is a separate comment. The variable comment-multi-line controls the choice (see Comments).

Auto Fill mode does not refill entire paragraphs. It can break lines but cannot merge lines. Editing in the middle of a paragraph can result in a paragraph that is not correctly filled. The easiest way to make the paragraph properly filled again is using an explicit fill commands.

Many users like Auto Fill mode and want to use it in all text files. The section on init files explains how you can arrange this permanently for yourself. See Init File.

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