Function: xref--create-fetcher
xref--create-fetcher is a byte-compiled function defined in
xref.el.gz.
Signature
(xref--create-fetcher INPUT KIND ARG)
Documentation
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.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/xref.el.gz
(defun 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))
(backend (xref-find-backend))
(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 (funcall method backend arg)))
(unless xrefs
(xref--not-found-error kind input))
xrefs)))))