fix(lookup): xref 1.3.0 removed var xref--marker-ring

Xref started many backwards incompatible changes in the name of
performance.  The marker ring no longer exists as a variable.
+lookup--xref-show will silently fail every time.

Switches to using xref-after-jump-hook to test whether xref actually
jumped to a definition. The hook is part of the exposed interface and
should hopefully not change in the near future.

Fix: #5737
This commit is contained in:
Justin Davis 2021-11-20 20:06:46 -05:00 committed by Henrik Lissner
parent 54c4ae4853
commit 5962db9f49

View file

@ -188,15 +188,16 @@ This can be passed nil as its second argument to unset handlers for MODES. e.g.
(xref-find-backend)
identifier)))
(when xrefs
(let ((marker-ring (ring-copy xref--marker-ring)))
(let* ((jumped nil)
(xref-after-jump-hook
(cons (lambda () (setq jumped t))
xref-after-jump-hook)))
(funcall (or show-fn #'xref--show-defs)
(lambda () xrefs)
nil)
(if (cdr xrefs)
'deferred
;; xref will modify its marker stack when it finds a result to jump to.
;; Use that to determine success.
(not (equal xref--marker-ring marker-ring)))))))
jumped)))))
(defun +lookup-dictionary-definition-backend-fn (identifier)
"Look up dictionary definition for IDENTIFIER."