Skip to content

Information from Markers

This section describes the functions for accessing the components of a marker object.

Function: marker-position marker

This function returns the position that marker points to, or nil if it points nowhere.

Function: marker-last-position marker

This function returns the last known position of marker in its buffer. It behaves like marker-position with one exception: if the buffer of marker has been killed, it returns the last position of marker in that buffer before the buffer was killed, instead of returning nil.

Function: marker-buffer marker

This function returns the buffer that marker points into, or nil if it points nowhere.

emacs-lisp
(setq m (make-marker))
#<marker in no buffer>
emacs-lisp
(marker-position m)
nil
emacs-lisp
(marker-buffer m)
nil
emacs-lisp
(set-marker m 3770 (current-buffer))
#<marker at 3770 in markers.texi>
emacs-lisp
(marker-buffer m)
#<buffer markers.texi>
emacs-lisp
(marker-position m)
3770