Function: xref-go-back

xref-go-back is an autoloaded, interactive and byte-compiled function defined in xref.el.gz.

Signature

(xref-go-back)

Documentation

Go back to the previous position in xref history.

To undo, use C-M-, (xref-go-forward).

View in manual

Probably introduced at or before Emacs version 29.1.

Key Bindings

Aliases

cider-pop-back xref-pop-marker-stack (obsolete since 29.1) pop-tag-mark

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/xref.el.gz
;;;###autoload
(defun xref-go-back ()
  "Go back to the previous position in xref history.
To undo, use \\[xref-go-forward]."
  (interactive)
  (let ((history (xref--get-history)))
    (if (null (car history))
        (user-error "At start of xref history")
      (let ((marker (pop (car history))))
        (xref--push-forward (point-marker))
        (xref--switch-to-buffer (or (marker-buffer marker)
                                    (user-error "The marked buffer has been deleted")))
        (goto-char (marker-position marker))
        (set-marker marker nil nil)
        (run-hooks 'xref-after-return-hook)))))