Filling means adjusting the lengths of lines (by moving the line
breaks) so that they are nearly (but no greater than) a specified
maximum width. Additionally, lines can be justified, which means
inserting spaces to make the left and/or right margins line up
precisely. 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 commands in this section return values that are not
meaningful. All the functions that do filling take note of the current
left margin, current right margin, and current justification style
(see section Margins for Filling). If the current justification style is
none
, the filling functions don't actually do anything.
Several of the filling functions have an argument justify.
If it is non-nil
, that requests some kind of justification. It
can be left
, right
, full
, or center
, to
request a specific style of justification. If it is t
, that
means to use the current justification style for this part of the text
(see current-justification
, below). Any other value is treated
as full
.
When you call the filling functions interactively, using a prefix
argument implies the value full
for justify.
nil
, each line is justified as well.
It uses the ordinary paragraph motion commands to find paragraph
boundaries. See section `Paragraphs' in The Emacs Manual.
nil
.
If nosqueeze is non-nil
, that means to leave whitespace
other than line breaks untouched. If to-eop is non-nil
,
that means to keep filling to the end of the paragraph--or the next hard
newline, if use-hard-newlines
is enabled (see below).
The variable paragraph-separate
controls how to distinguish
paragraphs. See section Standard Regular Expressions Used in Editing.
The first two arguments, start and end, are the beginning
and end of the region to be filled. The third and fourth arguments,
justify and mail-flag, are optional. If
justify is non-nil
, the paragraphs are justified as
well as filled. If mail-flag is non-nil
, it means the
function 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 indented
paragraphs with additional indentation on the first line.
fill-individual-paragraphs
as
described above.
nil
.
In an interactive call, any prefix argument requests justification.
If nosqueeze is non-nil
, that means to leave whitespace
other than line breaks untouched. If squeeze-after is
non-nil
, it specifies a position in the region, and means don't
canonicalize spaces before that position.
In Adaptive Fill mode, this command calls fill-context-prefix
to
choose a fill prefix by default. See section Adaptive Fill Mode.
fill-column
. It returns
nil
.
The argument how, if non-nil
specifies explicitly the style
of justification. It can be left
, right
, full
,
center
, or none
. If it is t
, that means to do
follow specified justification style (see current-justification
,
below). nil
means to do full justification.
If eop is non-nil
, that means do left-justification if
current-justification
specifies full justification. This is used
for the last line of a paragraph; even if the paragraph as a whole is
fully justified, the last line should not be.
If nosqueeze is non-nil
, that means do not change interior
whitespace.
left
, right
, full
, center
, or
none
. The default value is left
.
nil
, a period followed by just one space
does not count as the end of a sentence, and the filling functions
avoid breaking the line at such a place.
nil
, fill-paragraph
calls
this function to do the work. If the function returns a non-nil
value, fill-paragraph
assumes the job is done, and immediately
returns that value.
The usual use of this feature is to fill comments in programming language modes. If the function needs to fill a paragraph in the usual way, it can do so as follows:
(let ((fill-paragraph-function nil)) (fill-paragraph arg))
nil
, the filling functions do not delete
newlines that have the hard
text property. These "hard
newlines" act as paragraph separators.
Go to the first, previous, next, last section, table of contents.