bug#81462: [PATCH] Skip non-key events in `where-is-internal' with FIRSTONLY

Aaron Zeng via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <[email protected]>
Newsgroups gmane.emacs.bugs
Message-ID <CAB7SQMHWUUQOrLGCY0eiduOmq8kPJY3zk9VfYviD7et4xORoMw@mail.gmail.com>
On Mon, Aug 10, 2026 at 6:24 PM Aaron Zeng <[email protected]> wrote:
> However, the bindings available under this global SPC leader key are
> all pretty long, and when a shorter key binding for the same command
> is available in, e.g., the major mode map, I would prefer to show the
> latter in substitute-command-keys output.

FWIW, here's a totally different idea that might solve the same
problem.  What if where-is-internal had a SHORTEST argument where you
could ask it for the shortest binding rather than the first one?

AFAIU (happy to be proven wrong), there's no particular reason for
substitute-command-keys or other callers to care that the returned
binding happens to come from the keymap that comes earliest in
current-active-maps.  where-is-internal does check whether bindings in
later maps are shadowed by earlier maps, but it does so using
shadow_lookup and comparing the looked-up definition, so that doesn't
require iterating over the current-active-maps list specifically in
that order.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.