Next: Margins, Previous: Maintaining Undo, Up: Text [Contents][Index]
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 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 Margins). 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).
When you call the filling functions interactively, using a prefix
argument implies the value full
for justify.
This command fills the paragraph at or after point. If
justify is non-nil
, each line is justified as well.
It uses the ordinary paragraph motion commands to find paragraph
boundaries. See Paragraphs in The SXEmacs User’s Manual.
This command fills each of the paragraphs in the region from start
to end. It justifies as well if justify is
non-nil
.
The variable paragraph-separate
controls how to distinguish
paragraphs. See Standard Regexps.
This command fills each paragraph in the region according to its individual fill prefix. Thus, if the lines of a paragraph were indented with spaces, the filled paragraph will remain indented in the same fashion.
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.
This variable alters the action of fill-individual-paragraphs
as
described above.
This command 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 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 command inserts spaces between the words of the current line so
that the line ends exactly at 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 when
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.
This variable’s value specifies the style of justification to use for
text that doesn’t specify a style with a text property. The possible
values are left
, right
, full
, center
, or
none
. The default value is left
.
This function returns the proper justification style to use for filling the text around point.
This variable provides a way for major modes to override the filling of
paragraphs. If the value is non-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))
If this variable is non-nil
, the filling functions do not delete
newlines that have the hard
text property. These “hard
newlines” act as paragraph separators.
Next: Margins, Previous: Maintaining Undo, Up: Text [Contents][Index]