Next: , Previous: , Up: Text   [Contents][Index]

20.4 Paragraphs

The Emacs commands for manipulating paragraphs are also Meta- keys.


Move back to previous paragraph beginning


Move forward to next paragraph end (forward-paragraph).


Put point and mark around this or next paragraph (mark-paragraph).

Meta-{ moves to the beginning of the current or previous paragraph, while Meta-} moves to the end of the current or next paragraph. Blank lines and text formatter command lines separate paragraphs and are not part of any paragraph. An indented line starts a new paragraph.

In major modes for programs (as opposed to Text mode), paragraphs begin and end only at blank lines. As a result, the paragraph commands continue to be useful even though there are no paragraphs per se.

When there is a fill prefix, paragraphs are delimited by all lines which don’t start with the fill prefix. See Filling.

To operate on a paragraph, you can use the command Meta-h (mark-paragraph) to set the region around it. This command puts point at the beginning and mark at the end of the paragraph point was in. 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 the blank lines is included in the region. Thus, for example, M-h C-w kills the paragraph around or after point.

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 matches any line that either starts or separates paragraphs. The value of paragraph-separate is another regexp that matches only lines that separate paragraphs without being part of any paragraph. Lines that start a new paragraph and are contained in it must match both regexps. For example, normally paragraph-start is "^[ \t\n\f]" 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.

Next: , Previous: , Up: Text   [Contents][Index]