unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#25593: Feature request: xref-find-definitions in current file
@ 2017-01-31 21:43 Joel Ekström
  2017-02-03  1:25 ` Dmitry Gutov
  0 siblings, 1 reply; 6+ messages in thread
From: Joel Ekström @ 2017-01-31 21:43 UTC (permalink / raw)
  To: 25593

 Hi! In certain programming environments (especially object/protocol
 oriented ones), it is very common that the same function exists in many
 files.

 I often find myself needing to jump to a definition I know is in the
 file I'm currently working on. xref-find-definitions can make this hard
 if there are many candidates.

 What I would like is to be able to filter xref-find-definitions to only
 show definitions in the currently open buffer. Sort of like what
 list-tags does already, but without having to specify the file and
 switch to another buffer.

 Thanks!

Date: Tue, 31 Jan 2017 22:40:34 +0100
Message-ID: <m2wpdagb71.fsf@joel@ekstrom.io>





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#25593: Feature request: xref-find-definitions in current file
  2017-01-31 21:43 bug#25593: Feature request: xref-find-definitions in current file Joel Ekström
@ 2017-02-03  1:25 ` Dmitry Gutov
  2017-02-03  8:43   ` Joel Ekström
  0 siblings, 1 reply; 6+ messages in thread
From: Dmitry Gutov @ 2017-02-03  1:25 UTC (permalink / raw)
  To: Joel Ekström, 25593

Hi Joel,

On 31.01.2017 23:43, Joel Ekström wrote:

>   I often find myself needing to jump to a definition I know is in the
>   file I'm currently working on.

Normally, I'd use M-x imenu for that. Or actually counsel-imenu, the 
third-party frontend to this information.

IME this is most useful when the language in question doesn't have a 
smart navigation backend, and the project is not indexed with TAGS.

> xref-find-definitions can make this hard
>   if there are many candidates.

Sounds about right.

>   What I would like is to be able to filter xref-find-definitions to only
>   show definitions in the currently open buffer. Sort of like what
>   list-tags does already, but without having to specify the file and
>   switch to another buffer.

There are multiple possible ways to solve that problem.

One that you are directly requesting would involve creating a new 
backend-agnostic command, as well as either a way to hint the backend 
that we only want xrefs from a particular file, or codyfing that the 
"group" field in xrefs is always a file name, and filtering by it.

On the other hand, we could create a dedicated command like 
xref-show-imenu which will pull information from imenu specifically. 
Does that sound appealing to you?

Personally, Counsel's UI feels best for displaying IMenu entries, and 
I'd be happy to use something like that for xref-find-definitions as 
well. Unfortunately, there's no similar UI in the core so far.

If you haven't known about imenu before, does me mentioning it actually 
solve your problem already?





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#25593: Feature request: xref-find-definitions in current file
  2017-02-03  1:25 ` Dmitry Gutov
@ 2017-02-03  8:43   ` Joel Ekström
  2017-02-03 11:53     ` Dmitry Gutov
  0 siblings, 1 reply; 6+ messages in thread
From: Joel Ekström @ 2017-02-03  8:43 UTC (permalink / raw)
  To: Dmitry Gutov, 25593

Hi Dmitry, thanks for your response.

It's funny that you mention counsel-imenu, because counsel/ivy-mode is
actually one of the reasons I wanted this in the first place.
xref-find-definitions displays perfectly in ivy-mode (similar to how
counsel-imenu works), while list-tags does not.

I was actually not aware that counsel-imenu exists, so this solves my
problem to some extent. It's a great improvement compared to using
list-tags.

That said - having an option to have xref-find-definitions filter by
file would still be useful, since ctags is able to index things that
imenu does not. However - if it isn't a simple fix then I don't think
it's worth it, since imenu is "good enough".





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#25593: Feature request: xref-find-definitions in current file
  2017-02-03  8:43   ` Joel Ekström
@ 2017-02-03 11:53     ` Dmitry Gutov
  2020-08-11  8:08       ` Stefan Kangas
  0 siblings, 1 reply; 6+ messages in thread
From: Dmitry Gutov @ 2017-02-03 11:53 UTC (permalink / raw)
  To: Joel Ekström, 25593

On 03.02.2017 10:43, Joel Ekström wrote:

> It's funny that you mention counsel-imenu, because counsel/ivy-mode is
> actually one of the reasons I wanted this in the first place.
> xref-find-definitions displays perfectly in ivy-mode (similar to how
> counsel-imenu works),

I see what you mean. ivy-mode switches completing-read to its UI.

But if there are several locations corresponding to the given name, 
you'll see them in an *xref* buffer.

> I was actually not aware that counsel-imenu exists, so this solves my
> problem to some extent.

Happy to help. I use it a lot.

> That said - having an option to have xref-find-definitions filter by
> file would still be useful, since ctags is able to index things that
> imenu does not.

Maybe that happens too, but my experience is usually the opposite.

> However - if it isn't a simple fix then I don't think
> it's worth it, since imenu is "good enough".

Let's see if someone else wants xref-find-definitions-in-current-file as 
well, or if they have some other ideas on this issue.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#25593: Feature request: xref-find-definitions in current file
  2017-02-03 11:53     ` Dmitry Gutov
@ 2020-08-11  8:08       ` Stefan Kangas
  2020-10-01 11:59         ` Stefan Kangas
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Kangas @ 2020-08-11  8:08 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: Joel Ekström, 25593

Dmitry Gutov <dgutov@yandex.ru> writes:

> On 03.02.2017 10:43, Joel Ekström wrote:
>
>> It's funny that you mention counsel-imenu, because counsel/ivy-mode is
>> actually one of the reasons I wanted this in the first place.
>> xref-find-definitions displays perfectly in ivy-mode (similar to how
>> counsel-imenu works),
>
> I see what you mean. ivy-mode switches completing-read to its UI.
>
> But if there are several locations corresponding to the given name, you'll see
> them in an *xref* buffer.
>
>> I was actually not aware that counsel-imenu exists, so this solves my
>> problem to some extent.
>
> Happy to help. I use it a lot.
>
>> That said - having an option to have xref-find-definitions filter by
>> file would still be useful, since ctags is able to index things that
>> imenu does not.
>
> Maybe that happens too, but my experience is usually the opposite.
>
>> However - if it isn't a simple fix then I don't think
>> it's worth it, since imenu is "good enough".
>
> Let's see if someone else wants xref-find-definitions-in-current-file as well,
> or if they have some other ideas on this issue.

That was 3.5 years ago, and it seems like the bug reporter was happy
with the proposed alternative.

Does anyone else have an opinion on the proposal here, or should this be
closed?

Best regards,
Stefan Kangas





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#25593: Feature request: xref-find-definitions in current file
  2020-08-11  8:08       ` Stefan Kangas
@ 2020-10-01 11:59         ` Stefan Kangas
  0 siblings, 0 replies; 6+ messages in thread
From: Stefan Kangas @ 2020-10-01 11:59 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: Joel Ekström, 25593-done

Stefan Kangas <stefan@marxist.se> writes:

> Dmitry Gutov <dgutov@yandex.ru> writes:
>
>> On 03.02.2017 10:43, Joel Ekström wrote:
>>
>>> It's funny that you mention counsel-imenu, because counsel/ivy-mode is
>>> actually one of the reasons I wanted this in the first place.
>>> xref-find-definitions displays perfectly in ivy-mode (similar to how
>>> counsel-imenu works),
>>
>> I see what you mean. ivy-mode switches completing-read to its UI.
>>
>> But if there are several locations corresponding to the given name, you'll see
>> them in an *xref* buffer.
>>
>>> I was actually not aware that counsel-imenu exists, so this solves my
>>> problem to some extent.
>>
>> Happy to help. I use it a lot.
>>
>>> That said - having an option to have xref-find-definitions filter by
>>> file would still be useful, since ctags is able to index things that
>>> imenu does not.
>>
>> Maybe that happens too, but my experience is usually the opposite.
>>
>>> However - if it isn't a simple fix then I don't think
>>> it's worth it, since imenu is "good enough".
>>
>> Let's see if someone else wants xref-find-definitions-in-current-file as well,
>> or if they have some other ideas on this issue.
>
> That was 3.5 years ago, and it seems like the bug reporter was happy
> with the proposed alternative.
>
> Does anyone else have an opinion on the proposal here, or should this be
> closed?

That was 7 weeks ago, and there has been no further comments.  I'm
therefore closing this bug now.





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-10-01 11:59 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-31 21:43 bug#25593: Feature request: xref-find-definitions in current file Joel Ekström
2017-02-03  1:25 ` Dmitry Gutov
2017-02-03  8:43   ` Joel Ekström
2017-02-03 11:53     ` Dmitry Gutov
2020-08-11  8:08       ` Stefan Kangas
2020-10-01 11:59         ` Stefan Kangas

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).