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

20.6.2 Explicit Fill Commands


Fill current paragraph (fill-paragraph).


Fill each paragraph in the region (fill-region).

C-x f

Set the fill column (set-fill-column).

M-x fill-region-as-paragraph

Fill the region, considering it as one paragraph.


Center a line.

To refill a paragraph, use the command Meta-q (fill-paragraph). It causes the paragraph containing point, or the one after point if point is between paragraphs, to be refilled. All line breaks are removed, and new ones are inserted where necessary. M-q can be undone with C-_. See Undo.

To refill many paragraphs, use M-g (fill-region), which divides the region into paragraphs and fills each of them.

Meta-q and Meta-g use the same criteria as Meta-h for finding paragraph boundaries (see Paragraphs). For more control, you can use M-x fill-region-as-paragraph, which refills everything between point and mark. This command recognizes only blank lines as paragraph separators.

A numeric argument to M-g or M-q causes it to justify the text as well as filling it. Extra spaces are inserted to make the right margin line up exactly at the fill column. To remove the extra spaces, use M-q or M-g with no argument.

The variable auto-fill-inhibit-regexp takes as a value a regexp to match lines that should not be auto-filled.

The command Meta-s (center-line) centers the current line within the current fill column. With an argument, it centers several lines individually and moves past them.

The maximum line width for filling is in the variable fill-column. Altering the value of fill-column makes it local to the current buffer; until then, the default value—initially 70—is in effect. See Locals.

The easiest way to set fill-column is to use the command C-x f (set-fill-column). With no argument, it sets fill-column to the current horizontal position of point. With a numeric argument, it uses that number as the new fill column.

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