Marking Objects Mark Global Mark Ring
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. Commands that set the mark also push the
old mark onto this ring. To return to a marked location, use C-u C-SPC
(or C-u C-@); this is the command
set-mark-command
given a numeric argument. It moves point to
where the mark was, and restores the mark from the ring of former
marks. Thus, repeated use of this command moves point to all of the old
marks on the ring, one by one. The mark positions you move through in
this way are not lost; they go to the end of the ring.
Each buffer has its own mark ring. All editing commands use the current
buffer's mark ring. In particular, C-u C-SPC
always stays in
the same buffer.
Many commands that can move long distances, such as M-<
(beginning-of-buffer
), start by setting the mark and saving the
old mark on the mark ring. This is to make it easier for you to move
back later. Searches set the mark if they move point. You can tell
when a command sets the mark because it displays `Mark Set
' in the
echo area.
If you want to move back to the same place over and over, the mark ring may not be convenient enough. If so, you can record the position in a register for later retrieval (see RegPos).
The variable mark-ring-max
specifies the maximum number of
entries to keep in the mark ring. If that many entries exist and
another one is pushed, the last one in the list is discarded. Repeating
C-u C-SPC
cycles through the positions currently in the
ring.
The variable mark-ring
holds the mark ring itself, as a list of
marker objects, with the most recent first. This variable is local in
every buffer.