GNU bug report logs - #71648
30.0.50; Allow which-key to report on translation bindings

Previous Next

Package: emacs;

Reported by: Robert Pluim <rpluim <at> gmail.com>

Date: Wed, 19 Jun 2024 12:05:02 UTC

Severity: normal

Tags: fixed

Found in version 30.0.50

Fixed in version 30.1

Done: Robert Pluim <rpluim <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #21 received at 71648 <at> debbugs.gnu.org (full text, mbox):

From: Justin Burkett <justin <at> burkett.cc>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 71648 <at> debbugs.gnu.org, rpluim <at> gmail.com, jb <at> jeremybryant.net
Subject: Re: bug#71648: 30.0.50;
 Allow which-key to report on translation bindings
Date: Wed, 19 Jun 2024 11:48:01 -0400
On Wed, Jun 19, 2024 at 11:34 AM Eli Zaretskii <eliz <at> gnu.org> wrote:
>
> > From: Justin Burkett <justin <at> burkett.cc>
> > Date: Wed, 19 Jun 2024 11:09:36 -0400
> > Cc: Robert Pluim <rpluim <at> gmail.com>, Jeremy Bryant <jb <at> jeremybryant.net>, 71648 <at> debbugs.gnu.org
> >
> > The purpose of which-key was to show the commands that are available
> > following an incomplete key sequence. If I understand correctly, these
> > maps don't hold commands and anyway would be processed before
> > which-key "sees" the current incomplete key sequence.
>
> Everything in Emacs is a command.  The specific sequences Robert was
> talking about eventually insert characters, but they are still a
> sequence of key events.  So I'm not sure I understand how you
> distinguish between them and what fundamental differences do you see.
> Would you like to elaborate on how and why do you perceive these to be
> different?
>
> > If I understand correctly, if "C-d x" translates to "C-c x" then
> > which-key I believe would see the sequence "C-c x" and find the
> > bindings following that sequence. I'm not sure how or why we would
> > want to display the information that "C-d x" translates to "C-c x".
>
> I don't think this case is the most important or the most interesting.

The purpose of the example was to show my (mis)understanding of how
these maps work. I was under the impression from the info manual that
translation keymaps map key sequences to other key sequences which are
then mapped to "commands" (which might be just text to insert).
Quoting the info manual:

"When the ‘read-key-sequence’ function reads a key sequence (*note Key
Sequence Input::), it uses “translation keymaps” to translate certain
event sequences into others.  The translation keymaps are
‘input-decode-map’, ‘local-function-key-map’, and ‘key-translation-map’
(in order of priority).

   Translation keymaps have the same structure as other keymaps, but are
used differently: they specify translations to make while reading key
sequences, rather than bindings for complete key sequences.  As each key
sequence is read, it is checked against each translation keymap.  If one
of the translation keymaps binds K to a vector V, then whenever K
appears as a sub-sequence _anywhere_ in a key sequence, that
sub-sequence is replaced with the events in V."

This reads to me like translation keymaps don't yield "commands" they
act at an intermediate level.

In any event, Robert's example was helpful, and I think that
information would be useful to include in which-key.




This bug report was last modified 327 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.