[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Xref completion
From: |
William Xu |
Subject: |
Re: Xref completion |
Date: |
Tue, 17 Nov 2020 22:16:56 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.1 (darwin) |
Juri Linkov <juri@linkov.net> writes:
>> In particular, I've overridden the behaviour with regards to Xrefs and
>> instead of showing the Xref buffer, I'm now offering completion: the
>> user can match against the symbol but also against the file and line
>> position.
>
> It seems this should be possible by customizing the value of
> xref-show-definitions-function to a function that would redirect
> a list of found results to completing-read.
Wow, that is a life saver.
(defun my-xref--show-defs-minibuffer (fetcher alist)
(let* ((xrefs (funcall fetcher))
(xref-alist (xref--analyze xrefs))
(xref (if (not (cdr xrefs))
(car xrefs)
(cadr (assoc (completing-read "Jump to definition: "
xref-alist)
xref-alist)))))
(xref-pop-to-location xref (assoc-default 'display-action alist))))
(setq xref-show-definitions-function 'my-xref--show-defs-minibuffer)
--
William
- Xref completion, Pierre Neidhardt, 2020/11/17
- Re: [SPAM UNSURE] Xref completion, Stephen Leake, 2020/11/17
- Re: Xref completion, Eli Zaretskii, 2020/11/17
- Re: Xref completion, Juri Linkov, 2020/11/17
- Re: Xref completion, Dmitry Gutov, 2020/11/17
- Re: Xref completion,
William Xu <=
- Re: Xref completion, Dmitry Gutov, 2020/11/17
- Re: Xref completion, William Xu, 2020/11/18
- Re: Xref completion, Dmitry Gutov, 2020/11/18
- Re: Xref completion, William Xu, 2020/11/18
- Re: Xref completion, Dmitry Gutov, 2020/11/18
- Re: Xref completion, Juri Linkov, 2020/11/18
- Re: Xref completion, Dmitry Gutov, 2020/11/18
- Re: Xref completion, João Távora, 2020/11/18
- Re: Xref completion, Dmitry Gutov, 2020/11/18
- Re: Xref completion, William Xu, 2020/11/19