This section describes commands that indent all the lines in the region. They return unpredictable values.
nil
, indent-region
indents each nonblank line by calling
the current mode's indentation function, the value of
indent-line-function
.
If to-column is non-nil
, it should be an integer
specifying the number of columns of indentation; then this function
gives each line exactly that much indentation, by either adding or
deleting whitespace.
If there is a fill prefix, indent-region
indents each line
by making it start with the fill prefix.
indent-region
as a short cut. It should take two arguments, the
start and end of the region. You should design the function so
that it will produce the same results as indenting the lines of the
region one by one, but presumably faster.
If the value is nil
, there is no short cut, and
indent-region
actually works line by line.
A short-cut function is useful in modes such as C mode and Lisp mode,
where the indent-line-function
must scan from the beginning of
the function definition: applying it to each line would be quadratic in
time. The short cut can update the scan information as it moves through
the lines indenting them; this takes linear time. In a mode where
indenting a line individually is fast, there is no need for a short cut.
indent-region
with a non-nil
argument to-column has
a different meaning and does not use this variable.
For example, if count is 3, this command adds 3 columns of indentation to each of the lines beginning in the region specified.
In Mail mode, C-c C-y (mail-yank-original
) uses
indent-rigidly
to indent the text copied from the message being
replied to.
indent-rigidly
, except that it doesn't alter lines
that start within strings or comments.
In addition, it doesn't alter a line if nochange-regexp matches at
the beginning of the line (if nochange-regexp is non-nil
).
Go to the first, previous, next, last section, table of contents.