Commit 108ce844 authored by Dmitry Gutov's avatar Dmitry Gutov
Browse files

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.
parent 11c58c4f
......@@ -693,6 +693,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))
(error "No %s xref" (if backward "previous" "next"))))))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment