File tree Expand file tree Collapse file tree
modules/tools/lookup/autoload Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -185,20 +185,23 @@ This can be passed nil as its second argument to unset handlers for MODES. e.g.
185185
186186(autoload 'xref--show-defs " xref" )
187187(defun +lookup--xref-show (fn identifier &optional show-fn)
188- (let ((xrefs (funcall fn
188+ (let ((origin (point-marker ))
189+ (xrefs (funcall fn
189190 (xref-find-backend )
190191 identifier)))
191- (when xrefs
192- (let* ((jumped nil )
193- (xref-after-jump-hook
194- (cons (lambda () (setq jumped t ))
195- xref-after-jump-hook)))
196- (funcall (or show-fn #'xref--show-defs )
197- (lambda () xrefs)
198- nil )
199- (if (cdr xrefs)
200- 'deferred
201- jumped)))))
192+ (unwind-protect
193+ (when xrefs
194+ (funcall (or show-fn #'xref--show-defs )
195+ (lambda () xrefs)
196+ nil )
197+ ; ; Some xref backends may report "success" without moving point (e.g.
198+ ; ; returning the current location). In that case, allow fallback
199+ ; ; backends to run.
200+ (if (cdr xrefs)
201+ 'deferred
202+ (or (not (eq (marker-buffer origin) (current-buffer )))
203+ (/= (marker-position origin) (point )))))
204+ (set-marker origin nil ))))
202205
203206(defun +lookup-dictionary-definition-backend-fn (identifier)
204207 " Look up dictionary definition for IDENTIFIER."
You can’t perform that action at this time.
0 commit comments