emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Spencer Baugh <sbaugh@janestreet.com>
To: Ihor Radchenko <yantar92@posteo.net>
Cc: Eli Zaretskii <eliz@gnu.org>,
	 Morgan.J.Smith@outlook.com, emacs-orgmode@gnu.org,
	 58131@debbugs.gnu.org,  emacs-devel@gnu.org
Subject: Re: [FR] Allow flattened imenu index
Date: Thu, 14 Dec 2023 18:11:14 -0500	[thread overview]
Message-ID: <ierh6kkwfal.fsf@janestreet.com> (raw)
In-Reply-To: <874jgrsiyy.fsf@localhost> (Ihor Radchenko's message of "Sat, 09 Dec 2023 11:39:33 +0000")

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:
aaa/bbb/ddd
aaa/bbb/eee
aaa/ccc/eee
aaa/ccc/fff

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

[a]
a|
[<TAB>]
aaa/| ; completion now shows bbb and ccc as options
[b]
aaa/b/d|
[TAB]
aaa/bbb/ddd|
[RET]

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

[*/*/e]
*/*/e|
[TAB]
aaa/|/eee ; completion now shows bbb and ccc as options, point is at |
[b]
aaa/b|/eee
[TAB]
aaa/bbb/eee|
[RET]

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.


      parent reply	other threads:[~2023-12-14 23:11 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-07 20:52 [PATCH] Add new option 'org-imenu-flatten' Morgan Smith
2023-12-08 22:19 ` Ihor Radchenko
2023-12-09  1:46   ` Morgan Smith
2023-12-09  2:01     ` William Denton
2023-12-09 10:57     ` [FR] Allow flattened imenu index (was: [PATCH] Add new option 'org-imenu-flatten') Ihor Radchenko
2023-12-09 11:28       ` Eli Zaretskii
2023-12-09 11:39         ` Ihor Radchenko
2023-12-09 17:37           ` [FR] Allow flattened imenu index Juri Linkov
2023-12-11 11:51             ` João Távora
2023-12-11 17:20               ` Juri Linkov
2023-12-11 17:40                 ` João Távora
     [not found]                 ` <cf91ddb8-7759-52be-345f-fb85eadb9717@gutov.dev>
2023-12-11 18:00                   ` João Távora
     [not found]                     ` <595d6418-71f6-eec7-e37c-e3987265364c@gutov.dev>
2023-12-11 23:10                       ` João Távora
     [not found]                         ` <303c567e-7f0d-1fac-1ab4-0099bd98d8dd@gutov.dev>
2023-12-11 23:35                           ` João Távora
     [not found]                             ` <31ede4fc-8ebe-39ac-40c5-91ba08c35178@gutov.dev>
2023-12-11 23:48                               ` João Távora
     [not found]                                 ` <7eab6e94-cb8e-9ae1-d2cd-c0eb1b3bab43@gutov.dev>
2023-12-11 23:57                                   ` João Távora
2023-12-11 19:30                 ` Ihor Radchenko
2023-12-11 23:07                   ` João Távora
2023-12-14 23:11           ` Spencer Baugh [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ierh6kkwfal.fsf@janestreet.com \
    --to=sbaugh@janestreet.com \
    --cc=58131@debbugs.gnu.org \
    --cc=Morgan.J.Smith@outlook.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=emacs-orgmode@gnu.org \
    --cc=yantar92@posteo.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).