30.3 Paragraphs
The Emacs commands for manipulating paragraphs are also Meta keys.
- M-{
- Move back to previous paragraph beginning (
backward-paragraph
).
- M-}
- Move forward to next paragraph end (
forward-paragraph
).
- M-h
- Put point and mark around this or next paragraph (
mark-paragraph
).
M-{ moves to the beginning of the current or previous
paragraph, while M-} moves to the end of the current or next
paragraph. Blank lines and text-formatter command lines separate
paragraphs and are not considered part of any paragraph. In
Paragraph-Indent Text mode, but not in Text mode, an indented line
also starts a new paragraph. If there is a blank line before the
paragraph, M-{ moves to the blank line, because that is
convenient in practice.
In major modes for programs, paragraphs begin and end only at blank
lines. This makes the paragraph commands continue to be useful even
though there are no paragraphs per se.
When there is a fill prefix, then paragraphs are delimited by all lines
which don't start with the fill prefix. See Filling.
When you wish to operate on a paragraph, you can use the command
M-h (mark-paragraph
) to set the region around it. Thus,
for example, M-h C-w kills the paragraph around or after point.
The M-h command puts point at the beginning and mark at the end of
the paragraph point was in. In Transient Mark mode, it activates the
mark. If point is between paragraphs (in a run of blank lines, or at a
boundary), the paragraph following point is surrounded by point and
mark. If there are blank lines preceding the first line of the
paragraph, one of these blank lines is included in the region.
The precise definition of a paragraph boundary is controlled by the
variables paragraph-separate
and paragraph-start
. The
value of paragraph-start
is a regexp that should match any line
that either starts or separates paragraphs. The value of
paragraph-separate
is another regexp that should match only lines
that separate paragraphs without being part of any paragraph (for
example, blank lines). Lines that start a new paragraph and are
contained in it must match only paragraph-start
, not
paragraph-separate
. Each regular expression must match at the
left margin. For example, in Fundamental mode, paragraph-start
is "\f\\|[ \t]*$"
, and paragraph-separate
is
"[ \t\f]*$"
.
Normally it is desirable for page boundaries to separate paragraphs.
The default values of these variables recognize the usual separator for
pages.