0

I have always found it strange that there is no built-in way to jump to the definition of the current symbol (i.e. the one at point) via imenu (AFAIK), the same way as one jumped to a "tagged" definition back when tags were a thing :-) Does nobody else feel a need for this? I know that it is very easy to code it on my own, and for years I carried around a 5 line or so defun plus a keybinding and a mouse binding, but my patience doing that has just run out.

This is pretty much the opposite of #59212, even though that one is about LSP and this about imenu. It seems to me that no matter what the mechanism of indexing the buffer, at the user level both actions are useful:

  • selecting from a list of all available indices,
  • jumping directly to the one under point, if available.

Am I missing something?

Drew
  • 75,699
  • 9
  • 109
  • 225
q.undertow
  • 314
  • 1
  • 9
  • 1
    Do you mean like `xref-find-definitions` on `M-.` (and `M-,` to jump back)? – dalanicolai Apr 17 '22 at 09:42
  • I don't understand what imenu has to do with this. imenu shows you what is in the current buffer, not where it comes from or where it's used. Perhaps you could explain the imenu-based steps you imagine. – Phil Hudson Apr 17 '22 at 10:17
  • @dalanicolai yes, except for imenu. I didn't even know about xref, or rather, I knew something named xref was around but I thought it was specific to C or C like languages. So now I have to add xref to the growing list of things that I must take care of when writing a new mode :-( – q.undertow Apr 17 '22 at 16:09
  • @PhilHudson I think you miss a major part of what imenu does. When you select an item from imenu , either from the real menu with a mouse or from the completion list by hitting `Enter` when on the item, point in your buffer jumps to the location associated with the item in the index (which is usually the "definition" or "declaration" of that symbol, but that depends on how the mode implements the imenu callbacks). My question was about short-circuiting the selection step in the UI, and automatically providing the symbol under point as the selection. – q.undertow Apr 17 '22 at 16:15

0 Answers0