diff options
| author | Dmitry Gutov | 2018-02-28 04:03:16 +0200 |
|---|---|---|
| committer | Dmitry Gutov | 2018-03-03 02:46:50 +0200 |
| commit | 6719f05ff75ec19e45e40b98d8b0c6184168ac5e (patch) | |
| tree | 2b62c29ab4e58863919d5532767cc622bd81e7a3 /lisp | |
| parent | 94ff88247d290a3906ac0c438b7a025f865392c9 (diff) | |
| download | emacs-6719f05ff75ec19e45e40b98d8b0c6184168ac5e.tar.gz emacs-6719f05ff75ec19e45e40b98d8b0c6184168ac5e.zip | |
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)
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/progmodes/xref.el | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index e0f5b2d3670..b0bdd62ae98 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el | |||
| @@ -692,6 +692,10 @@ references displayed in the current *xref* buffer." | |||
| 692 | (dotimes (_ n) | 692 | (dotimes (_ n) |
| 693 | (setq xref (xref--search-property 'xref-item backward))) | 693 | (setq xref (xref--search-property 'xref-item backward))) |
| 694 | (cond (xref | 694 | (cond (xref |
| 695 | ;; Save the current position (when the buffer is visible, | ||
| 696 | ;; it gets reset to that window's point from time to time). | ||
| 697 | (let ((win (get-buffer-window (current-buffer)))) | ||
| 698 | (and win (set-window-point win (point)))) | ||
| 695 | (xref--show-location (xref-item-location xref) t)) | 699 | (xref--show-location (xref-item-location xref) t)) |
| 696 | (t | 700 | (t |
| 697 | (error "No %s xref" (if backward "previous" "next")))))) | 701 | (error "No %s xref" (if backward "previous" "next")))))) |