All Manuals > Editor User Guide > 3 Command Reference

3.19 Filling

Filling involves re-formatting text so that each line extends as far to the right as possible without any words being broken or any text extending past the fill-column.

The first section deals with general commands used to fill text, while the second section provides information on Auto-Fill mode and related commands.

3.19.1 Fill commands

Fill Paragraph Editor Command

Arguments: None
Key sequence: Alt+Q

Fills the current paragraph. If the current point is located between two paragraphs, the next paragraph is filled.

A prefix argument causes the current fill operation to use that value, rather than the value of fill-column.

Fill Region Editor Command

Arguments: None
Key sequence: Alt+G

Fills the region from the current point to the mark.

A prefix argument causes the current fill operation to use that value, rather than the value of fill-column.

fill-column Editor Variable

Default value: 70

Determines the column at which text in the current buffer is forced on to a new line when filling text.

Set Fill Column Editor Command

Arguments: None
Key sequence: Ctrl+X F

Sets the value of fill-column, for the current buffer, as the column of the current point.

A prefix argument causes fill-column to be set at the required value.

fill-prefix Editor Variable

Default value: nil

Defines a string which is excluded when each line of the current buffer is re-formatted using the filling commands. For example, if the value is ";;", then these characters at the start of a line are skipped over when the text is re-formatted. This allows you to re-format (fill) Lisp comments. If the value is nil, no characters are excluded when text is filled.

If the vales is non-nil, any line that does not begin with the value is considered to begin a new paragraph. Therefore, any re-formatting of comments in Lisp code does not intrude outside the commented lines.

Set Fill Prefix Editor Command

Arguments: None
Key sequence: Ctrl+X .

Sets the fill-prefix of the current buffer to be the text from the beginning of the current line up to the current point. The fill-prefix may be set to nil by using this command with the current point at the start of a line.

Center Line Editor Command

Arguments: None
Key sequence: None

Centers the current line with reference to the current value of fill-column.

A prefix argument causes the current line to be centered with reference to the required width.

3.19.2 Auto-Fill mode

By default no filling of text takes place unless specified by using one of the commands described above. A result of this is that the user has to press Return at the end of each line typed to simulate filling. In Auto-Fill mode lines are broken between words at the right margin automatically as the text is being typed. Each line is broken when a space is inserted, and the text that extends past the right margin is put on the next line. The right hand margin is determined by the editor variable fill-column.

Auto Fill Mode Editor Command

Arguments: None
Key sequence: None

Switches auto-fill mode on if it is currently off, and off if it is currently on.

With a positive prefix argument, auto-fill mode is switched on. With a negative or zero prefix argument, it is switched off. Using prefix arguments with Auto Fill Mode disregards the current state of the mode.

Auto Fill Space Editor Command

Arguments: None
Key sequence: Space
Mode: Auto-Fill

Inserts a space and breaks the line between two words if the line extends beyond the right margin. A fill prefix is automatically added at the beginning of the new line if the value of fill-prefix is non-nil.

When Space is bound to this command in Auto-Fill mode, this key no longer invokes Self Insert.

A positive prefix argument causes the required number of spaces to be inserted but no line break. A prefix argument of zero causes a line break, if necessary, but no spaces are inserted.

Auto Fill Linefeed Editor Command

Arguments: None
Key sequence: Linefeed
Mode: Auto-Fill

Inserts a Linefeed and a fill-prefix (if one exists).

Auto Fill Return Editor Command

Arguments: None
Key sequence: Return
Mode: Auto-Fill

The current line is broken, between two words if necessary, with no Space being inserted. This is equivalent to Auto Fill Space with a zero prefix argument, but followed by a newline.

auto-fill-space-indent Editor Variable

Default value: nil

When true, Auto-fill commands use Indent New Comment Line to break lines instead of New Line.


Editor User Guide (Windows version) - 01 Dec 2021 19:35:26