Many Emacs commands operate on an arbitrary contiguous part of the current buffer. You can select text in two ways:
To specify the text for a command to operate on, 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. You can move point or the mark to adjust the boundaries of the region. It doesn’t matter which one is set first chronologically, or which one comes earlier in the text.
Once the mark has been set, it remains until it is set again at another place. The mark remains fixed with respect to the preceding character if text is inserted or deleted in a buffer. Each Emacs buffer has its own mark; when you return to a buffer that had been selected previously, it has the same mark it had before.
Many commands that insert text, such as C-y (
M-x insert-buffer, position the mark at one end of the inserted
text—the opposite end from where point is positioned, so that the region
contains the text just inserted.
Aside from delimiting the region, the mark is useful for marking
a spot that you may want to go back to. To make this feature more useful,
Emacs remembers 16 previous locations of the mark in the
|• Setting Mark:||Commands to set the mark.|
|• Using Region:||Summary of ways to operate on contents of the region.|
|• Marking Objects:||Commands to put region around textual units.|
|• Mark Ring:||Previous mark positions saved so you can go back there.|