GNU bug report logs - #25593
Feature request: xref-find-definitions in current file

Previous Next

Package: emacs;

Reported by: Joel Ekström <joel <at> ekstrom.io>

Date: Tue, 31 Jan 2017 22:01:02 UTC

Severity: wishlist

Done: Stefan Kangas <stefan <at> marxist.se>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 25593 in the body.
You can then email your comments to 25593 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#25593; Package emacs. (Tue, 31 Jan 2017 22:01:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Joel Ekström <joel <at> ekstrom.io>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 31 Jan 2017 22:01:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Joel Ekström <joel <at> ekstrom.io>
To: bug-gnu-emacs <at> gnu.org
Subject: Feature request: xref-find-definitions in current file
Date: Tue, 31 Jan 2017 22:43:34 +0100
 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 <at> joel <at> ekstrom.io>




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25593; Package emacs. (Fri, 03 Feb 2017 01:26:01 GMT) Full text and rfc822 format available.

Message #8 received at 25593 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Joel Ekström <joel <at> ekstrom.io>, 25593 <at> debbugs.gnu.org
Subject: Re: bug#25593: Feature request: xref-find-definitions in current file
Date: Fri, 3 Feb 2017 03:25:22 +0200
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?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25593; Package emacs. (Fri, 03 Feb 2017 08:44:02 GMT) Full text and rfc822 format available.

Message #11 received at 25593 <at> debbugs.gnu.org (full text, mbox):

From: Joel Ekström <joel <at> ekstrom.io>
To: Dmitry Gutov <dgutov <at> yandex.ru>, 25593 <at> debbugs.gnu.org
Subject: Re: bug#25593: Feature request: xref-find-definitions in current file
Date: Fri, 03 Feb 2017 09:43:04 +0100
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".




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25593; Package emacs. (Fri, 03 Feb 2017 11:54:02 GMT) Full text and rfc822 format available.

Message #14 received at 25593 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Joel Ekström <joel <at> ekstrom.io>, 25593 <at> debbugs.gnu.org
Subject: Re: bug#25593: Feature request: xref-find-definitions in current file
Date: Fri, 3 Feb 2017 13:53:23 +0200
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.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25593; Package emacs. (Tue, 11 Aug 2020 08:09:02 GMT) Full text and rfc822 format available.

Message #17 received at 25593 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefan <at> marxist.se>
To: Dmitry Gutov <dgutov <at> yandex.ru>
Cc: Joel Ekström <joel <at> ekstrom.io>, 25593 <at> debbugs.gnu.org
Subject: Re: bug#25593: Feature request: xref-find-definitions in current file
Date: Tue, 11 Aug 2020 01:08:29 -0700
Dmitry Gutov <dgutov <at> 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




Reply sent to Stefan Kangas <stefan <at> marxist.se>:
You have taken responsibility. (Thu, 01 Oct 2020 12:00:02 GMT) Full text and rfc822 format available.

Notification sent to Joel Ekström <joel <at> ekstrom.io>:
bug acknowledged by developer. (Thu, 01 Oct 2020 12:00:03 GMT) Full text and rfc822 format available.

Message #22 received at 25593-done <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefan <at> marxist.se>
To: Dmitry Gutov <dgutov <at> yandex.ru>
Cc: Joel Ekström <joel <at> ekstrom.io>, 25593-done <at> debbugs.gnu.org
Subject: Re: bug#25593: Feature request: xref-find-definitions in current file
Date: Thu, 1 Oct 2020 04:59:39 -0700
Stefan Kangas <stefan <at> marxist.se> writes:

> Dmitry Gutov <dgutov <at> 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.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 30 Oct 2020 11:24:14 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 177 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.