]> git.eshelyaron.com Git - emacs.git/commitdiff
Backport: xref--next-error-function: Move xref's window point
authorDmitry Gutov <dgutov@yandex.ru>
Wed, 28 Feb 2018 02:03:16 +0000 (04:03 +0200)
committerDmitry Gutov <dgutov@yandex.ru>
Sat, 3 Mar 2018 00:46:50 +0000 (02:46 +0200)
* 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 108ce84432d597f92637ea74bd0a094224d157de)

lisp/progmodes/xref.el

index e0f5b2d36701afc0c185b45fd9d68bc649c2c8b5..b0bdd62ae98728bddc05eb54ae0b8f6ee56e00e3 100644 (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"))))))