GNU Emacs Manual. Node: Mark

PREV Help UP Top NEXT Killing

Chapter 7: 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 Transient Mark).

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 where you put it until you set it again at another place. Each Emacs buffer has its own mark, so that 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 (yank) and M-x insert-buffer, position point and the mark at opposite ends of the inserted text, so that the region contains 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.

  • Setting Mark Commands to set the mark.
  • Transient Mark How to make Emacs highlight the region-- when there is one.
  • 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.
  • Global Mark Ring Previous mark positions in various buffers.
  • PREV Help UP Top NEXT Killing