Speed up backlinks’ or query links’ buffer creation?
Denote leverages the built-in ‘xref’ library to search for the identifier of the current file and return any links to it. For users of Emacs version 28 or higher, there exists a user option to specify the program that performs this search: xref-search-program. The default is ‘grep’, which can be slow, though one may opt for ‘ugrep’, ‘ripgrep’, or even specify something else (read the docstring of that user option for the details).
Try either for these for better results:
emacs-lisp
(setq xref-search-program 'ripgrep)
;; OR
(setq xref-search-program 'ugrep)To use whatever executable is available on your system, use something like this:
emacs-lisp
;; Prefer ripgrep, then ugrep, and fall back to regular grep.
(setq xref-search-program
(cond
((or (executable-find "ripgrep")
(executable-find "rg"))
'ripgrep)
((executable-find "ugrep")
'ugrep)
(t
'grep)))