[Top][All Lists]

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

Re: [FR] Allow flattened imenu index

From: Spencer Baugh
Subject: Re: [FR] Allow flattened imenu index
Date: Thu, 14 Dec 2023 18:11:14 -0500
User-agent: Gnus/5.13 (Gnus v5.13)

Ihor Radchenko <yantar92@posteo.net> writes:
> Eli Zaretskii <eliz@gnu.org> writes:
>>> I am wondering if it makes more sense to add this "flatten" option
>>> globally into imenu instead.
>> I'm not sure I understand what you are asking.  As we don't seem to
>> have an active maintainer of imenu on board, more details are needed
>> to understand the request.  Of course, patches are even more welcome.
> Normally, `imenu' supports nested menus, when users select the target
> location in steps, like item3 <RET> -> item3.1 <RET> -> ...
> What is proposed is to list all the sub-menus together, as an option, so
> that the users can choose, for example, item.3.1 directly, without going
> through parent item3.

I would love to have this feature.  I have wanted this for OCaml, where
the default imenu index produced by the "merlin" tool is annoyingly
deeply nested, which makes it awkward to use.

I have an alternative proposal though, which might be better: We could
enhance the imenu completion table to understand completion boundaries.
Then the imenu hierarchy could be completed over in a single
completing-read instead of a sequence of multiple completing-reads.  It
would work the same way as read-file-name.

So, for example, if the completion boundary was /, and we had a hierarchy
containing these elements:

You could choose aaa/bbb/ddd with this sequence of minibuffer contents:
(input in [brackets], point at |)

aaa/| ; completion now shows bbb and ccc as options

Alternatively, you could choose aaa/bbb/eee with this sequence:

aaa/|/eee ; completion now shows bbb and ccc as options, point is at |

To be very clear, these completion features already exist (and are
enabled by default!), all we would need to do is enhance the imenu
completion table to understand completion boundaries, and then imenu
would have access to these features too.

This new completion table could be turned on by default, since it would
be strictly more powerful than the current imenu UI.

Plus, if some alternative completion UI wanted to flatten the hierarchy
anyway, this more advanced imenu completion table would allow that.

reply via email to

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