From: Dmitry Gutov <dgutov@yandex.ru>
To: Gabriel do Nascimento Ribeiro <gabriel376@hotmail.com>,
emacs-devel@gnu.org
Subject: Re: Consistency for xref-show-{xrefs,definitions}-function
Date: Sat, 16 Jan 2021 21:24:12 +0200 [thread overview]
Message-ID: <54ea98d8-7740-d287-6e3f-8c2f870010d5@yandex.ru> (raw)
In-Reply-To: <CH2PR01MB5879E61CE4C5C306FB474BAC8BA60@CH2PR01MB5879.prod.exchangelabs.com>
On 16.01.2021 20:35, Gabriel do Nascimento Ribeiro wrote:
> My use case is: when inside a project, the only option to jump to a
> certain location is by using 'C-x p g' (which runs 'xref--show-xrefs')
> and selecting the desired location from the list of matches in a
> separated buffer. I would like to be able to select a single element
> from this list of matches, preferably with 'completing-read'.
All right. Is that location a certain symbol's definition, or just some
special location that can only be found by a grep search?
> I took another look in the code, so I guess we can keep the xrefs
> functions as it is and tweak 'project-find-regexp' to be more flexible
> on this.
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 like:
(defun project-find-regexp-and-jump ()
(interactive)
;; 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.
next prev parent reply other threads:[~2021-01-16 19:24 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-14 20:27 Consistency for xref-show-{xrefs,definitions}-function Gabriel do Nascimento Ribeiro
2021-01-14 21:04 ` Daniel Martín
2021-01-15 17:20 ` Dmitry Gutov
2021-01-16 18:35 ` Gabriel do Nascimento Ribeiro
2021-01-16 19:24 ` Dmitry Gutov [this message]
2021-01-16 20:31 ` Gabriel do Nascimento Ribeiro
2021-01-18 1:28 ` Dmitry Gutov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=54ea98d8-7740-d287-6e3f-8c2f870010d5@yandex.ru \
--to=dgutov@yandex.ru \
--cc=emacs-devel@gnu.org \
--cc=gabriel376@hotmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).