Export to occur from imenu?
From consult-imenu, embark export creates an embark collect buffer. The "button action" on this buffer in many cases simply re-runs consult-imenu and populates the search with the full text of the item (which for me doesn't even work because I patch orderless in consult-imenu to omit matching the categories, like "Functions").
Since Imenu simply targets locations within the buffer, I think exporting to an occur buffer, or making the button action "visit this location in the original buffer" makes more sense.
Also, is there a possibility to append an action to the default? For example, in magit-status buffers, imenu returns all the latest issues/PRs/recent commits/etc. Ideally instead of just visiting these issues in the magit-status buffer, it would be great to press Ret on them too, to jump directly to that issue, commit, etc. This is more general than embark since you'd want to configure this to happen from both consult-imenu and embark-exported lists of imenu items from (e.g.) magit.
The completion candidates from neither the built-in imenu nor from consult-imenu come with location information, so the only thing Embark can do is feed the candidate back to the command. (To see this yourself try using embark-collect-snapshot from both consult-imenu and then use C-u C-x = in the collect buffer to see what text properties are there; if you repeat the experiment with consult-line, you'll see that consult-line does attach location information directly to the candidates.)
What you suggest could be done (for consult-imenu at least), but the first step would be to modify consult-imenu to attach location information to the candidates and to report a different completion category from imenu. What do you think @minad?
(To be honest @jdtsmith, that the default action doesn't work for you is because of your own patching and is easily fixed by simply removing it 😛 , but this change still makes sense as a feature request because it would enable occur-mode export for consult-imenu ---but sadly not for imenu.)
The completion candidates from neither the built-in imenu nor from consult-imenu come with location information, so the only thing Embark can do is feed the candidate back to the command.
I see thanks. Imenu certainly provides markers to do this in consult-imenu if there's a standard text property for it.
(To be honest @jdtsmith, that the default action doesn't work for you is because of your own patching and is easily fixed by simply removing it 😛 , but this change still makes sense as a feature request because it would enable occur-mode export for
consult-imenu---but sadly not forimenu.)
I had assumed you'd still have to press return to dismiss the fully completed imenu search even without my patch, but now I see that that has been optimized out (in embark?) and it visits the location directly.
But I like my patch very much since I can search for small phrase snippets that match a group title with impunity. So I patched my patch to avoid prepending the "category swallower" regex prefixes if in fact a category word comes first in a single-term search. Works great.
It still may be useful to add the location property info to consult imenu output, just to save the redundant roundtrip.