[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
12. The Mark and the Region
Many Emacs commands operate on an arbitrary contiguous part of the current buffer. To specify the text for such a command to operate on, you set the mark at one end of it, and move point to the other end. The text between point and the mark is called the region. Emacs highlights the region whenever there is one, if you enable Transient Mark mode (see section Transient Mark Mode).
Certain Emacs commands set the mark; other editing commands do not affect it, so the mark remains where you set it last. Each Emacs buffer has its own mark, and setting the mark in one buffer has no effect on other buffers' marks. When you return to a buffer that was current earlier, its mark is at the same place as before.
The ends of the region are always point and the mark. It doesn't matter which of them was put in its current place first, or which one comes earlier in the text—the region starts from point or the mark (whichever comes first), and ends at point or the mark (whichever comes last). Every time you move point, or set the mark in a new place, the region changes.
Many commands that insert text, such as C-y (yank
) and
M-x insert-buffer, position point and the mark at opposite ends
of the inserted text, so that the region consists of the text just
inserted.
Aside from delimiting the region, the mark is also useful for remembering a spot that you may want to go back to. To make this feature more useful, each buffer remembers 16 previous locations of the mark in the mark ring.
12.1 Setting the Mark | Commands to set the mark. | |
12.2 Transient Mark Mode | How to make Emacs highlight the region– when there is one. | |
12.3 Using Transient Mark Mode Momentarily | Enabling Transient Mark mode momentarily. | |
12.4 Operating on the Region | Summary of ways to operate on contents of the region. | |
12.5 Commands to Mark Textual Objects | Commands to put region around textual units. | |
12.6 The Mark Ring | Previous mark positions saved so you can go back there. | |
12.7 The Global Mark Ring | Previous mark positions in various buffers. |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |