[Top][All Lists]

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

Re: [Emacs-diffs] master 108ce84 2/2: xref--next-error-function: Move xr

From: Dmitry Gutov
Subject: Re: [Emacs-diffs] master 108ce84 2/2: xref--next-error-function: Move xref's window point
Date: Wed, 28 Feb 2018 04:13:22 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:59.0) Gecko/20100101 Thunderbird/59.0

Eli, what would you say about backporting this to emacs-26?

This change is limited in scope, it fixes annoying "looping" behavior I've seen in some cases, and it adds window point movement you've asked for before in https://debbugs.gnu.org/cgi/bugreport.cgi?bug=20489#110

branch: master
commit 108ce84432d597f92637ea74bd0a094224d157de
Author: Dmitry Gutov <address@hidden>
Commit: Dmitry Gutov <address@hidden>

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

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

Emacs-diffs mailing list

reply via email to

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