[Top][All Lists]

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

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

From: Dmitry Gutov
Subject: bug#25593: Feature request: xref-find-definitions in current file
Date: Fri, 3 Feb 2017 03:25:22 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.0

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?

reply via email to

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