1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-01-05 11:45:45 +00:00

Backport: xref--next-error-function: Move xref's window point

* lisp/progmodes/xref.el (xref--next-error-function): Move
xref's window point if it's visible.  When we don't do that,
navigation can start looping after a while.

(cherry picked from commit 108ce84432)
This commit is contained in:
Dmitry Gutov 2018-02-28 04:03:16 +02:00
parent 94ff88247d
commit 6719f05ff7

View File

@ -692,6 +692,10 @@ references displayed in the current *xref* buffer."
(dotimes (_ n)
(setq xref (xref--search-property 'xref-item backward)))
(cond (xref
;; Save the current position (when the buffer is visible,
;; it gets reset to that window's point from time to time).
(let ((win (get-buffer-window (current-buffer))))
(and win (set-window-point win (point))))
(xref--show-location (xref-item-location xref) t))
(t
(error "No %s xref" (if backward "previous" "next"))))))