From: Juri Linkov <juri@linkov.net>
To: "João Távora" <joaotavora@gmail.com>
Cc: Ihor Radchenko <yantar92@posteo.net>,
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: Mon, 11 Dec 2023 19:20:51 +0200 [thread overview]
Message-ID: <86zfyg3jgs.fsf@mail.linkov.net> (raw)
In-Reply-To: <CALDnm51j9X6h2ipYamWUUnHW=fQ9oMRhzVBR1pxxRcUGmZuobQ@mail.gmail.com> ("João Távora"'s message of "Mon, 11 Dec 2023 11:51:03 +0000")
>> menu1
>> sub-item1
>> sub-item2
>>
>> could be flattened to
>>
>> menu1 -> sub-item1
>> menu1 -> sub-item2
>
> By the way, this seems to be exactly what the breadcrumb-jump command
> in my breadcrumb.el package does. Goes reasonably well with a flex/fuzzy
> completion style.
It would be great to have some form of breadcrumb-jump in imenu.el
since it's useful on its own even for someone who doesn't use breadcrumbs.
> You can look at it for an implementation idea. Just be sure to do this
> flattening at the presentation level (i.e. M-x imenu), not at the
> internal representation level.
Here are some observations while testing on
emacs/test/manual/etags/ruby-src/test.rb.
Both ruby-mode and ruby-ts-mode provide a list that is already flat:
ruby-mode:
ModuleExample
ModuleExample#ModuleExample.module_class_method
ModuleExample#module_instance_method
ModuleExample::ClassExample
ModuleExample::ClassExample#+
ModuleExample::ClassExample#ClassExample.class_method
ModuleExample::ClassExample#instance_method
ruby-ts-mode:
ModuleExample
ModuleExample#module_instance_method
ModuleExample.module_class_method
ModuleExample::ClassExample
ModuleExample::ClassExample#+
ModuleExample::ClassExample#instance_method
ModuleExample::ClassExample.class_method
When eglot is enabled then imenu-create-index-function returns a tree.
What is interesting is that breadcrumb-jump already correctly handles both
a flat list and a tree:
a flat list in breadcrumb-jump completions is exactly the same as in 'imenu':
ModuleExample
ModuleExample#module_instance_method
ModuleExample.module_class_method
ModuleExample::ClassExample
ModuleExample::ClassExample#+
ModuleExample::ClassExample#instance_method
ModuleExample::ClassExample.class_method
a tree from eglot in breadcrumb-jump completions:
Class > ModuleExample > ClassExample
Method > ClassExample > class_method
Method > ModuleExample > module_class_method
Method > ModuleExample > module_instance_method
Method > ModuleExample::ClassExample > +
Method > ModuleExample::ClassExample > instance_method
Module > > ModuleExample
is still usable even without special characters like "#".
> It shouldn't be needed here at all, but in case anyone's thinking
> about it, please avoid messing with imenu's internal representation of
> hierarchies as that structure is relied upon by many extensions (not just
> mine, but several others). Even certain things supported by certain
> imenu-presenting frontends (like "special elements") are not supported by
> other frontends. It's a bit of a mess. The symbols holding/describing
> this representation (imenu--index-alist, maybe others) are incorrectly
> named '--' but they are most definitely externally visible and used
> customization points.
Indeed, it's unfortunate that imenu--make-index-alist and imenu--index-alist
are named as internal.
next prev parent reply other threads:[~2023-12-11 17:20 UTC|newest]
Thread overview: 26+ 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 [this message]
2023-12-11 17:40 ` João Távora
2023-12-11 17:43 ` Dmitry Gutov
2023-12-11 18:00 ` João Távora
2023-12-11 19:24 ` Dmitry Gutov
2023-12-11 23:10 ` João Távora
2023-12-11 23:23 ` Dmitry Gutov
2023-12-11 23:35 ` João Távora
2023-12-11 23:41 ` Dmitry Gutov
2023-12-11 23:48 ` João Távora
2023-12-11 23:54 ` Dmitry Gutov
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
2023-12-15 12:13 ` Dmitry Gutov
2024-05-11 9:41 ` [PATCH] Add new option 'org-imenu-flatten' Ihor Radchenko
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=86zfyg3jgs.fsf@mail.linkov.net \
--to=juri@linkov.net \
--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=joaotavora@gmail.com \
--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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.