[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
12.6 The 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.
If you set set-mark-command-repeat-pop
to non-nil
,
then when you repeat the character C-<SPC> after typing
C-u C-<SPC>, each repetition moves point to a previous mark
position from the ring. 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. However, in
Transient Mark mode, these commands do not set the mark when the mark
is already active. 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 section Saving Positions in Registers).
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 earliest 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.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |