From: Sebastian Poeplau via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: "João Távora" <joaotavora@gmail.com>
Cc: 69657@debbugs.gnu.org, Felician Nemeth <felician.nemeth@gmail.com>
Subject: bug#69657: Missing imenu entries with eglot
Date: Sun, 17 Mar 2024 12:04:07 +0100 [thread overview]
Message-ID: <87bk7dt858.fsf@mailbox.org> (raw)
In-Reply-To: <CALDnm52aPqDmNGEbgbyxTGdRDtJpc9pzfRS9LNEKuO1kqyDiqw@mail.gmail.com>
> The problems are in Imenu.
>
> You should rather lobby for a better imenu structure (which will be
> hard to do fully backward compatibly will all existing UIs -- except if
> you use the string properties trick that Eglot/breadcrumb use as
> I explained) You could also lobby for a brand new imenu replacement
> in Emacs.
I've been thinking about this. A "brand new imenu replacement" sounds
like something that would be hard to get adoption for. So, assuming that
we wanted to change the imenu structure to something that works better
for representing ASTs, I think there are two somewhat related problems:
(1) how to represent the AST internally, and (2) how to show it to the
user.
1. The current representation in `imenu--index-alist', as you said, has
the problem that it doesn't allow position information on inner
nodes; also, additional metadata like the category has to be tagged
on with text properties or other tricks.
One could extend the existing structure. For example, leaves could
become lists (name beg end category) with everything but NAME and BEG
being optional, or something like that; inner nodes could optionally
have the same format instead of being just strings. I don't see how
to much such a change in a way that wouldn't break existing UIs, but
maybe one could find a way that at least makes it easy for them to
support the new structure (e.g., by providing helper functions in
imenu.el, which could also facilitate future changes in
`imenu--index-alist').
I guess while changing the structure one could try to optimize it for
the use cases of existing UIs. Breadcrumb, for example, probably
needs an efficient means of computing the most specific node
corresponding to a buffer position, as well as the path down from the
root to that node, and the list of its sibling nodes.
2. A menu structure like the one offered by M-x imenu or
`imenu-add-menubar-index' makes it difficult to jump to inner nodes.
The best I can think of is an entry labeled "(top)" or something like
that underneath each leave node with a position; in my earlier
example, the "Foo" menu entry would then expand to a list of two
sub-entries, "(top)" and "bar". Alternative UIs probably have much
better ways to display the information (such as the entry in
consult-imenu that I was originally looking for).
Even if this sounds like a nice improvement, I wonder about the
compatibility issue. Do you think such a patch would even be considered?
prev parent reply other threads:[~2024-03-17 11:04 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-08 20:01 bug#69657: Missing imenu entries with eglot Sebastian Poeplau via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-08 21:44 ` Felician Nemeth
2024-03-08 22:28 ` Sebastian Poeplau via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-09 16:20 ` Felician Nemeth
2024-03-10 1:05 ` João Távora
2024-03-10 16:15 ` Sebastian Poeplau via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-10 19:15 ` Sebastian Poeplau via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-10 19:33 ` João Távora
2024-03-17 11:04 ` Sebastian Poeplau via Bug reports for GNU Emacs, the Swiss army knife of text editors [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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87bk7dt858.fsf@mailbox.org \
--to=bug-gnu-emacs@gnu.org \
--cc=69657@debbugs.gnu.org \
--cc=felician.nemeth@gmail.com \
--cc=joaotavora@gmail.com \
--cc=sebastian.poeplau@mailbox.org \
/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.