Go to the previous, next section.
Filling means adjusting the lengths of lines (by moving words
between them) so that they are nearly (but no greater than) a specified
maximum width. Additionally, lines can be justified, which means
that spaces are inserted between words to make the line exactly the
specified width. The width is controlled by the variable
fill-column. For ease of reading, lines should be no longer than
70 or so columns.
You can use Auto Fill mode (see section Auto Filling) to fill text automatically as you insert it, but changes to existing text may leave it improperly filled. Then you must fill the text explicitly.
Most of the functions in this section return values that are not meaningful.
Command: fill-paragraph justify-flag
This function fills the paragraph at or after point. If
justify-flag is non-nil, each line is justified as well.
It uses the ordinary paragraph motion commands to find paragraph
boundaries.
Command: fill-region start end &optional justify-flag
This function fills each of the paragraphs in the region from
start to end. It justifies as well if justify-flag is
non-nil. (In an interactive call, this is true if there is a
prefix argument.)
The variable paragraph-separate controls how to distinguish
paragraphs.
Command: fill-individual-paragraphs start end &optional justify-flag mail-flag
This function fills each paragraph in the region according to its individual fill prefix. Thus, if the lines of a paragraph are indented with spaces, the filled paragraph will continue to be indented in the same fashion.
The first two arguments, start and end, are the beginning
and end of the region that will be filled. The third and fourth
arguments, justify-flag and mail-flag, are optional. If
justify-flag is non-nil, the paragraphs are justified as
well as filled. If mail-flag is non-nil, the function is
told that it is operating on a mail message and therefore should not
fill the header lines.
Ordinarily, fill-individual-paragraphs regards each change in
indentation as starting a new paragraph. If
fill-individual-varying-indent is non-nil, then only
separator lines separate paragraphs. That mode can handle paragraphs
with extra indentation on the first line.
User Option: fill-individual-varying-indent
This variable alters the action of fill-individual-paragraphs as
described above.
Command: fill-region-as-paragraph start end &optional justify-flag
This function considers a region of text as a paragraph and fills it.
If the region was made up of many paragraphs, the blank lines between
paragraphs are removed. This function justifies as well as filling when
justify-flag is non-nil. In an interactive call, any
prefix argument requests justification.
In Adaptive Fill mode, which is enabled by default,
fill-region-as-paragraph on an indented paragraph when there is
no fill prefix uses the indentation of the second line of the paragraph
as the fill prefix.
This function inserts spaces between the words of the current line so
that the line ends exactly at fill-column. It returns
nil.
This buffer-local variable specifies the maximum width of filled lines. Its value should be an integer, which is a number of columns. All the filling, justification and centering commands are affected by this variable, including Auto Fill mode (see section Auto Filling).
As a practical matter, if you are writing text for other people to
read, you should set fill-column to no more than 70. Otherwise
the line will be too long for people to read comfortably, and this can
make the text seem clumsy.
The value of this variable is the default value for fill-column in
buffers that do not override it. This is the same as
(default-value 'fill-column).
The default value for default-fill-column is 70.
Go to the previous, next section.