1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-25 07:28:20 +00:00

Don't push to Xref history when search ends with error

* lisp/progmodes/xref.el (xref--push-markers):
Add new arguments (bug#65631).
(xref--show-xrefs, xref--show-defs): Use them.
This commit is contained in:
Dmitry Gutov 2023-09-01 04:37:40 +03:00
parent f862c5d655
commit 17188e07ab

View File

@ -1468,7 +1468,6 @@ The meanings of both arguments are the same as documented in
(xref--show-xrefs fetcher display-action))
(defun xref--show-xrefs (fetcher display-action &optional _always-show-list)
(xref--push-markers)
(unless (functionp fetcher)
;; Old convention.
(let ((xrefs fetcher))
@ -1479,21 +1478,30 @@ The meanings of both arguments are the same as documented in
(prog1
xrefs
(setq xrefs 'called-already)))))))
(funcall xref-show-xrefs-function fetcher
`((window . ,(selected-window))
(display-action . ,display-action)
(auto-jump . ,xref-auto-jump-to-first-xref))))
(let ((cb (current-buffer))
(pt (point)))
(funcall xref-show-xrefs-function fetcher
`((window . ,(selected-window))
(display-action . ,display-action)
(auto-jump . ,xref-auto-jump-to-first-xref)))
(xref--push-markers cb pt)))
(defun xref--show-defs (xrefs display-action)
(xref--push-markers)
(funcall xref-show-definitions-function xrefs
`((window . ,(selected-window))
(display-action . ,display-action)
(auto-jump . ,xref-auto-jump-to-first-definition))))
(let ((cb (current-buffer))
(pt (point)))
(funcall xref-show-definitions-function xrefs
`((window . ,(selected-window))
(display-action . ,display-action)
(auto-jump . ,xref-auto-jump-to-first-definition)))
(xref--push-markers cb pt)))
(defun xref--push-markers ()
(unless (region-active-p) (push-mark nil t))
(xref-push-marker-stack))
(defun xref--push-markers (buf pt)
(when (buffer-live-p buf)
(save-excursion
(with-no-warnings (set-buffer buf))
(goto-char pt)
(unless (region-active-p) (push-mark nil t))
(xref-push-marker-stack))))
(defun xref--prompt-p (command)
(or (eq xref-prompt-for-identifier t)