12.5 Commands to Mark Textual Objects
Here are the commands for placing point and the mark around a textual
object such as a word, list, paragraph or page.
- [email protected]
- Set mark after end of next word (
mark-word). This command and
the following one do not move point.
- [email protected]
- Set mark after end of following balanced expression (
- Put region around current paragraph (
- Put region around current defun (
- C-x h
- Put region around the entire buffer (
- C-x C-p
- Put region around current page (
[email protected] (
mark-word) puts the mark at the end of the next
word, while [email protected] (
mark-sexp) puts it at the end of the
next balanced expression (see Expressions). These commands handle
arguments just like M-f and C-M-f. If you repeat these
commands, that extends the region. For example, you can type either
C-u 2 [email protected] or [email protected] [email protected] to mark the next two words. This
command also extends the region when the mark is active in Transient
Mark mode, regardless of the last command.
Other commands set both point and mark, to delimit an object in the
buffer. For example, M-h (
mark-paragraph) moves point to
the beginning of the paragraph that surrounds or follows point, and
puts the mark at the end of that paragraph (see Paragraphs). It
prepares the region so you can indent, case-convert, or kill a whole
paragraph. With prefix argument, if the argument's value is positive,
M-h marks that many paragraphs starting with the one surrounding
point. If the prefix argument is −n, M-h also
marks n paragraphs, running back form the one surrounding point.
In that last case, point moves forward to the end of that paragraph,
and the mark goes at the start of the region. Repeating the M-h
command extends the region, just as with [email protected] and [email protected].
mark-defun) similarly puts point before, and the
mark after, the current (or following) major top-level definition, or
defun (see Moving by Defuns). Repeating C-M-h also extends
C-x C-p (
mark-page) puts point before the current page,
and mark at the end (see Pages). The mark goes after the
terminating page delimiter (to include it in the region), while point
goes after the preceding page delimiter (to exclude it). A numeric
argument specifies a later page (if positive) or an earlier page (if
negative) instead of the current page.
Finally, C-x h (
mark-whole-buffer) sets up the entire
buffer as the region, by putting point at the beginning and the mark at
In Transient Mark mode, all of these commands activate the mark.