Decorating consult-imenu-multi output with the origin #984
DivineDominion
started this conversation in
General
Replies: 1 comment
-
@DivineDominion I have little difficulties parsing what your issue is about. There seem to be multiple issues mixed into one? Is this a feature request? Do you plan to prepare a patch improving consult-imenu? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
consult-imenu-multi
(provided the files are being visited) is very good as a general "jump to function" tool.I was looking into how consult assembles and displays imenu entries with the intent to maybe get marginalia.el to display the buffer origin next to each line, because with generic names like "insert" I always need a bit to parse which function I'm looking for.
Here's an example; please excuse the PHP :)
imenu already groups by type, so it can't get
consult-line-multi
's file headings.So I was looking to maybe use horizontal space a bit more cleverly and display the file name in another column.
(I'm using vertico and marginalia, so maybe marginalia would work? But how I'm not sure.)
I figured out that consult-imenu prefers imenu-markers, and that markers carry some metadata like the origin buffer that can be queried with
(marker-buffer MARKER)
. So with(buffer-name (marker-buffer MARKER))
I can get to the info.consult-imenu--cache
was useful to inspect values; they seem to be cons'es of the consult imenu item and the imenu markerBut how to get to the cdr of each element beats me.
I have trouble parsing how to tweak
consult--read
invocations, though, so I got stuck there. My interpretation::state
parameter could take customizations about the 'what' is being displayed:annotate
is the way to go with consultconsult--read-1
usescompleting-read
, and there is some 'metadata' key being queried, but I'm not sure if that's usefulUsing the
:annotate
keyword got me to a place where I could do stuff with the candidate, but the candidate at that point in the function is thecar
of imenu items, so the marker is missing. -- Either way this doesn't play well with marginalia in my experiments, but worked great when marginalia is disabled.(In the process I discovered the preview functionality, so maybe that's an option for anybody else who stumbled upon this issue.)
Is there a way to get to the imenu marker and use it to annotate multi imenu items with the buffer name or file name of each item?
Beta Was this translation helpful? Give feedback.
All reactions