(defun zjy/xref-find-backends ()
(let (backends
backend)
(dolist (f xref-backend-functions)
(when (functionp f)
(setq backend (funcall f))
(when backend
(cl-pushnew (funcall f) backends))))
(reverse backends)))
(defun zjy/xref--create-fetcher (input kind arg)
"Return an xref list fetcher function.
It revisits the saved position and delegates the finding logic to
the xref backend method indicated by KIND and passes ARG to it."
(let* ((orig-buffer (current-buffer))
(orig-position (point))
(backends (zjy/xref-find-backends))
(method (intern (format "xref-backend-%s" kind))))
(lambda ()
(save-excursion
;; Xref methods are generally allowed to depend on the text
;; around point, not just on their explicit arguments.
;;
;; There is only so much we can do, however, to recreate that
;; context, given that the user is free to change the buffer
;; contents freely in the meantime.
(when (buffer-live-p orig-buffer)
(set-buffer orig-buffer)
(ignore-errors (goto-char orig-position)))
(let (xrefs)
(cl-dolist (backend backends)
(ignore-errors
(setq xrefs (funcall method backend arg))
(when xrefs
(cl-return))))
(unless xrefs
(xref--not-found-error kind input))
xrefs)))))
(advice-add #'xref--create-fetcher :override #'zjy/xref--create-fetcher)
(with-eval-after-load 'dumb-jump
(add-hook 'xref-backend-functions #'dumb-jump-xref-activate)
)
(with-eval-after-load 'citre
(add-hook 'xref-backend-functions #'citre-xref-backend)
)
xref-backend-functions is a variable defined in ‘xref.el’.
Its value is (elisp--xref-backend t)
Local in buffer package_extra.el; global value is
(dumb-jump-xref-activate etags--xref-backend)