[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Consistency for xref-show-{xrefs,definitions}-function

From: Dmitry Gutov
Subject: Re: Consistency for xref-show-{xrefs,definitions}-function
Date: Mon, 18 Jan 2021 03:28:11 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0

On 16.01.2021 22:31, Gabriel do Nascimento Ribeiro wrote:

But you still use project-find-regexp for its "normal" purpose, too,
right? That is, finding all occurrences of a certain regexp. Maybe to
rename all occurrences of a symbol, etc.

To only change its behavior in specific situations, you can add a new
command to your init script and bind it to a key. The code can look

(defun project-find-regexp-and-jump ()
   ;; Or use a particular function name here directly.
   (let ((xref-show-xrefs-function xref-show-definitions-function))
     (call-interactively #'project-find-regexp)))

Other suggestions welcome, of course.

Thanks for your suggestion! I have that function in my init.el called
'project-find-regexp-completing-read'. I started this thread just to
make sure this is not a dirty hack and the existing functions are
consistent. So I guess is everything okay =)

Glad that's working for you.

Regarding consistency, perhaps the names could be tweaked a bit, removing "definitions" from their names to avoid implying that the functions must only be used with that variable (even though using them as the "normal" value of xref-show-xrefs-function should be discouraged).

Perhaps like:


These a bit wordy, though, so ideas welcome.

This also ties into https://debbugs.gnu.org/cgi/bugreport.cgi?bug=44611#93 (having a "public" show-xrefs function with a name that reflects its purpose of showing a list of search results).

reply via email to

[Prev in Thread] Current Thread [Next in Thread]