From c7e4bc974b7ec3d6fdae105df05fc19a2cf9fdbd Mon Sep 17 00:00:00 2001 From: =?utf8?q?Felici=C3=A1n=20N=C3=A9meth?= Date: Wed, 13 Feb 2019 21:19:36 +0100 Subject: [PATCH] Jump to the current error in xref with zero prefix arg * xref.el (xref--next-error-function): Handle the corner case of n == 0. (Bug#34462) --- lisp/progmodes/xref.el | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index 9522d7e475b..6974d000483 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -694,8 +694,10 @@ references displayed in the current *xref* buffer." (let ((backward (< n 0)) (n (abs n)) (xref nil)) - (dotimes (_ n) - (setq xref (xref--search-property 'xref-item backward))) + (if (= n 0) + (setq xref (get-text-property (point) 'xref-item)) + (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). -- 2.39.2