Markers

A marker maintains a position in the buffer, which stays valid across arbitary editing operations. A marker's position can be get and set using pos.

Class: marker inherits (standard-object)
Slot: pos
Macro: with-marker ((marker marker-or-pos &optional (advance-p t)) &body body)
Make a temporary marker at MARKER-OR-POS and bind to MARKER during BODY.

Marker advance types

When an insertion happens at a marker, the marker may get pushed after the inserted contents (it advances), or stay before the inserted contents (it does not advance). This property can be queried and set using:

Function, setf-able: advance-p (marker)
Returns t if MARKER advances, nil otherwise.
This place is setf-able.

Marker ring

Neomacs has a global marker ring. Various commands which move between buffer (e.g. goto-definition) save current focused positions onto the global marker ring before moving, so that you can revisit them later.

Function: push-global-marker (&optional (marker (copy-marker (focus))))
Push MARKER onto the global marker ring.
If *marker-ring-index* is not 0 when this function is called, that many markers are deleted from the top of the marker ring (i.e. if there were pop-global-marker invocations, the popped markers are truly lost).
Mark ring commands will delete MARKER if they no longer use it, so it is your responsible to copy the marker if you still need it later.
Command (M-,): pop-global-marker ()
Pop a marker off the global marker ring and goto its position.
Command (C-M-,): unpop-global-marker ()
Undo the effect of previous pop-global-mark.
Variable: *marker-ring*
Variable: *marker-ring-index*
Index of the marker to be popped by next pop-global-marker.