emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs-26 6719f05: Backport: xref--next-error-function: Mov


From: Dmitry Gutov
Subject: [Emacs-diffs] emacs-26 6719f05: Backport: xref--next-error-function: Move xref's window point
Date: Fri, 2 Mar 2018 19:48:00 -0500 (EST)

branch: emacs-26
commit 6719f05ff75ec19e45e40b98d8b0c6184168ac5e
Author: Dmitry Gutov <address@hidden>
Commit: Dmitry Gutov <address@hidden>

    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 108ce84432d597f92637ea74bd0a094224d157de)
---
 lisp/progmodes/xref.el | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el
index e0f5b2d..b0bdd62 100644
--- a/lisp/progmodes/xref.el
+++ b/lisp/progmodes/xref.el
@@ -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"))))))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]