GNU bug report logs -
#71648
30.0.50; Allow which-key to report on translation bindings
Previous Next
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.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 71648 in the body.
You can then email your comments to 71648 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#71648
; Package
emacs
.
(Wed, 19 Jun 2024 12:05:02 GMT)
Full text and
rfc822 format available.
Message #3 received at submit <at> debbugs.gnu.org (full text, mbox):
`which-key-mode' currently only looks at keymaps, not translation
keymaps such as `key-translation-map' and `function-key-map'. In order
to aid discoverability, perhaps it should do the following
(maybe with a user option)
@@ -1942,8 +1949,10 @@ which-key--get-keymap-bindings
(defun which-key--get-current-bindings (&optional prefix filter)
"Generate a list of current active bindings."
- (let (bindings)
- (dolist (map (current-active-maps t) bindings)
+ (let (bindings
+ (maps (nconc (current-active-maps t)
+ (list key-translation-map function-key-map))))
+ (dolist (map maps bindings)
(when (cdr map)
(setq bindings
(which-key--get-keymap-bindings
Robert
--
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#71648
; Package
emacs
.
(Wed, 19 Jun 2024 13:13:01 GMT)
Full text and
rfc822 format available.
Message #6 received at 71648 <at> debbugs.gnu.org (full text, mbox):
> From: Robert Pluim <rpluim <at> gmail.com>
> Date: Wed, 19 Jun 2024 14:04:35 +0200
>
> `which-key-mode' currently only looks at keymaps, not translation
> keymaps such as `key-translation-map' and `function-key-map'. In order
> to aid discoverability, perhaps it should do the following
>
> (maybe with a user option)
>
> @@ -1942,8 +1949,10 @@ which-key--get-keymap-bindings
>
> (defun which-key--get-current-bindings (&optional prefix filter)
> "Generate a list of current active bindings."
> - (let (bindings)
> - (dolist (map (current-active-maps t) bindings)
> + (let (bindings
> + (maps (nconc (current-active-maps t)
> + (list key-translation-map function-key-map))))
> + (dolist (map maps bindings)
> (when (cdr map)
> (setq bindings
> (which-key--get-keymap-bindings
>
Let's have the relevant people on-board of this discussion.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#71648
; Package
emacs
.
(Wed, 19 Jun 2024 15:11:02 GMT)
Full text and
rfc822 format available.
Message #9 received at 71648 <at> debbugs.gnu.org (full text, mbox):
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.
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".
Justin
On Wed, Jun 19, 2024 at 9:12 AM Eli Zaretskii <eliz <at> gnu.org> wrote:
>
> > From: Robert Pluim <rpluim <at> gmail.com>
> > Date: Wed, 19 Jun 2024 14:04:35 +0200
> >
> > `which-key-mode' currently only looks at keymaps, not translation
> > keymaps such as `key-translation-map' and `function-key-map'. In order
> > to aid discoverability, perhaps it should do the following
> >
> > (maybe with a user option)
> >
> > @@ -1942,8 +1949,10 @@ which-key--get-keymap-bindings
> >
> > (defun which-key--get-current-bindings (&optional prefix filter)
> > "Generate a list of current active bindings."
> > - (let (bindings)
> > - (dolist (map (current-active-maps t) bindings)
> > + (let (bindings
> > + (maps (nconc (current-active-maps t)
> > + (list key-translation-map function-key-map))))
> > + (dolist (map maps bindings)
> > (when (cdr map)
> > (setq bindings
> > (which-key--get-keymap-bindings
> >
>
> Let's have the relevant people on-board of this discussion.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#71648
; Package
emacs
.
(Wed, 19 Jun 2024 15:18:02 GMT)
Full text and
rfc822 format available.
Message #12 received at 71648 <at> debbugs.gnu.org (full text, mbox):
>>>>> On Wed, 19 Jun 2024 11:09:36 -0400, Justin Burkett <justin <at> burkett.cc> said:
Justin> The purpose of which-key was to show the commands that are available
Justin> following an incomplete key sequence. If I understand correctly, these
Justin> maps don't hold commands and anyway would be processed before
Justin> which-key "sees" the current incomplete key sequence.
They donʼt hold commands in the sense of defuns, but instead they
produce characters, which to Emacs is pretty much the same thing, and
looking up keys in them inside which-keys produces the same type of
display.
Justin> If I understand correctly, if "C-d x" translates to "C-c x" then
Justin> which-key I believe would see the sequence "C-c x" and find the
Justin> bindings following that sequence. I'm not sure how or why we would
Justin> want to display the information that "C-d x" translates to "C-c x".
These maps donʼt translate sequences to sequences, they translate
sequences to characters:
'C-x 8 * E' -> €
'C-x 8 * L' -> £
etc
so with my patch, typing 'C-x 8 *' show the entries for 'E' and 'L'
(and more besides)
Robert
--
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#71648
; Package
emacs
.
(Wed, 19 Jun 2024 15:37:02 GMT)
Full text and
rfc822 format available.
Message #15 received at 71648 <at> debbugs.gnu.org (full text, mbox):
> 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.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#71648
; Package
emacs
.
(Wed, 19 Jun 2024 15:45:01 GMT)
Full text and
rfc822 format available.
Message #18 received at 71648 <at> debbugs.gnu.org (full text, mbox):
On Wed, Jun 19, 2024 at 11:16 AM Robert Pluim <rpluim <at> gmail.com> wrote:
>
> >>>>> On Wed, 19 Jun 2024 11:09:36 -0400, Justin Burkett <justin <at> burkett.cc> said:
>
> Justin> The purpose of which-key was to show the commands that are available
> Justin> following an incomplete key sequence. If I understand correctly, these
> Justin> maps don't hold commands and anyway would be processed before
> Justin> which-key "sees" the current incomplete key sequence.
>
> They donʼt hold commands in the sense of defuns, but instead they
> produce characters, which to Emacs is pretty much the same thing, and
> looking up keys in them inside which-keys produces the same type of
> display.
>
> Justin> If I understand correctly, if "C-d x" translates to "C-c x" then
> Justin> which-key I believe would see the sequence "C-c x" and find the
> Justin> bindings following that sequence. I'm not sure how or why we would
> Justin> want to display the information that "C-d x" translates to "C-c x".
>
> These maps donʼt translate sequences to sequences, they translate
> sequences to characters:
>
> 'C-x 8 * E' -> €
> 'C-x 8 * L' -> £
> etc
>
> so with my patch, typing 'C-x 8 *' show the entries for 'E' and 'L'
> (and more besides)
Ah, so I didn't understand how these are used. Those are good
additions to which-key.
>
> Robert
> --
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#71648
; Package
emacs
.
(Wed, 19 Jun 2024 15:50:02 GMT)
Full text and
rfc822 format available.
Message #21 received at 71648 <at> debbugs.gnu.org (full text, mbox):
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.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#71648
; Package
emacs
.
(Wed, 19 Jun 2024 21:15:01 GMT)
Full text and
rfc822 format available.
Message #24 received at 71648 <at> debbugs.gnu.org (full text, mbox):
Robert Pluim <rpluim <at> gmail.com> writes:
>>>>>> On Wed, 19 Jun 2024 11:09:36 -0400, Justin Burkett <justin <at> burkett.cc> said:
>
> Justin> The purpose of which-key was to show the commands that are available
> Justin> following an incomplete key sequence. If I understand correctly, these
> Justin> maps don't hold commands and anyway would be processed before
> Justin> which-key "sees" the current incomplete key sequence.
>
> They donʼt hold commands in the sense of defuns, but instead they
> produce characters, which to Emacs is pretty much the same thing, and
> looking up keys in them inside which-keys produces the same type of
> display.
>
> Justin> If I understand correctly, if "C-d x" translates to "C-c x" then
> Justin> which-key I believe would see the sequence "C-c x" and find the
> Justin> bindings following that sequence. I'm not sure how or why we would
> Justin> want to display the information that "C-d x" translates to "C-c x".
>
> These maps donʼt translate sequences to sequences, they translate
> sequences to characters:
>
> 'C-x 8 * E' -> €
> 'C-x 8 * L' -> £
> etc
>
> so with my patch, typing 'C-x 8 *' show the entries for 'E' and 'L'
> (and more besides)
>
> Robert
This is a useful patch and would enhance which-key
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#71648
; Package
emacs
.
(Thu, 20 Jun 2024 08:30:02 GMT)
Full text and
rfc822 format available.
Message #27 received at 71648 <at> debbugs.gnu.org (full text, mbox):
>>>>> On Wed, 19 Jun 2024 11:48:01 -0400, Justin Burkett <justin <at> burkett.cc> said:
Justin> In any event, Robert's example was helpful, and I think that
Justin> information would be useful to include in which-key.
By default, or with a custom option? If the latter, it could be a list
of 'extra' keymaps for `which-key' to consult.
Robert
--
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#71648
; Package
emacs
.
(Thu, 20 Jun 2024 14:22:02 GMT)
Full text and
rfc822 format available.
Message #30 received at 71648 <at> debbugs.gnu.org (full text, mbox):
On Thu, Jun 20, 2024 at 4:27 AM Robert Pluim <rpluim <at> gmail.com> wrote:
>
> >>>>> On Wed, 19 Jun 2024 11:48:01 -0400, Justin Burkett <justin <at> burkett.cc> said:
>
> Justin> In any event, Robert's example was helpful, and I think that
> Justin> information would be useful to include in which-key.
>
> By default, or with a custom option? If the latter, it could be a list
> of 'extra' keymaps for `which-key' to consult.
I can see an argument for either. My only concern with the option
would be explaining what the option does in plain language.
>
> Robert
> --
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#71648
; Package
emacs
.
(Thu, 20 Jun 2024 14:58:02 GMT)
Full text and
rfc822 format available.
Message #33 received at 71648 <at> debbugs.gnu.org (full text, mbox):
>>>>> On Thu, 20 Jun 2024 10:20:36 -0400, Justin Burkett <justin <at> burkett.cc> said:
Justin> On Thu, Jun 20, 2024 at 4:27 AM Robert Pluim <rpluim <at> gmail.com> wrote:
>>
>> >>>>> On Wed, 19 Jun 2024 11:48:01 -0400, Justin Burkett <justin <at> burkett.cc> said:
>>
Justin> In any event, Robert's example was helpful, and I think that
Justin> information would be useful to include in which-key.
>>
>> By default, or with a custom option? If the latter, it could be a list
>> of 'extra' keymaps for `which-key' to consult.
Justin> I can see an argument for either. My only concern with the option
Justin> would be explaining what the option does in plain language.
Wordsmithing is easy ;-)
(defcustom which-key-extra-keymaps nil
"List of extra keymaps to show bindings from.
This allows you to add personal keymaps for `which-key' to check. A
preset value is available to enable looking in `key-translation-map',
which contains the \\='C-x 8' bindings for entering common characters."
:type '(choice (list :tag "Translation map" (const key-translation-map))
(repeat :tag "Custom" symbol))
:version "30.1")
Robert
--
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#71648
; Package
emacs
.
(Thu, 20 Jun 2024 15:43:02 GMT)
Full text and
rfc822 format available.
Message #36 received at 71648 <at> debbugs.gnu.org (full text, mbox):
On Thu, Jun 20, 2024 at 10:56 AM Robert Pluim <rpluim <at> gmail.com> wrote:
>
> >>>>> On Thu, 20 Jun 2024 10:20:36 -0400, Justin Burkett <justin <at> burkett.cc> said:
>
> Justin> On Thu, Jun 20, 2024 at 4:27 AM Robert Pluim <rpluim <at> gmail.com> wrote:
> >>
> >> >>>>> On Wed, 19 Jun 2024 11:48:01 -0400, Justin Burkett <justin <at> burkett.cc> said:
> >>
> Justin> In any event, Robert's example was helpful, and I think that
> Justin> information would be useful to include in which-key.
> >>
> >> By default, or with a custom option? If the latter, it could be a list
> >> of 'extra' keymaps for `which-key' to consult.
>
> Justin> I can see an argument for either. My only concern with the option
> Justin> would be explaining what the option does in plain language.
>
> Wordsmithing is easy ;-)
>
> (defcustom which-key-extra-keymaps nil
> "List of extra keymaps to show bindings from.
> This allows you to add personal keymaps for `which-key' to check. A
> preset value is available to enable looking in `key-translation-map',
> which contains the \\='C-x 8' bindings for entering common characters."
> :type '(choice (list :tag "Translation map" (const key-translation-map))
> (repeat :tag "Custom" symbol))
> :version "30.1")
>
That seems reasonable enough. How about doing both? Add the option and
use key-translation-map for the default value.
> Robert
> --
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#71648
; Package
emacs
.
(Mon, 24 Jun 2024 13:16:01 GMT)
Full text and
rfc822 format available.
Message #39 received at 71648 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
>>>>> On Thu, 20 Jun 2024 11:40:57 -0400, Justin Burkett <justin <at> burkett.cc> said:
Justin> That seems reasonable enough. How about doing both? Add the option and
Justin> use key-translation-map for the default value.
Patch against emacs-30 attached. Since which-key is new in emacs-30,
Iʼm assuming a NEWS entry is not required for this specific change.
Eli, let me know if it should go to master instead.
Robert
--
[0001-Show-entries-from-key-translation-map-in-which-key-m.patch (text/x-diff, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#71648
; Package
emacs
.
(Mon, 24 Jun 2024 13:31:02 GMT)
Full text and
rfc822 format available.
Message #42 received at 71648 <at> debbugs.gnu.org (full text, mbox):
> From: Robert Pluim <rpluim <at> gmail.com>
> Cc: 71648 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>, jb <at> jeremybryant.net
> Date: Mon, 24 Jun 2024 15:14:34 +0200
>
> Patch against emacs-30 attached. Since which-key is new in emacs-30,
> Iʼm assuming a NEWS entry is not required for this specific change.
>
> Eli, let me know if it should go to master instead.
This is okay for emacs-30, thanks.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#71648
; Package
emacs
.
(Mon, 24 Jun 2024 17:22:02 GMT)
Full text and
rfc822 format available.
Message #45 received at 71648 <at> debbugs.gnu.org (full text, mbox):
tags 71648 fixed
close 71648 30.1
quit
>>>>> On Mon, 24 Jun 2024 16:30:30 +0300, Eli Zaretskii <eliz <at> gnu.org> said:
>> From: Robert Pluim <rpluim <at> gmail.com>
>> Cc: 71648 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>, jb <at> jeremybryant.net
>> Date: Mon, 24 Jun 2024 15:14:34 +0200
>>
>> Patch against emacs-30 attached. Since which-key is new in emacs-30,
>> Iʼm assuming a NEWS entry is not required for this specific change.
>>
>> Eli, let me know if it should go to master instead.
Eli> This is okay for emacs-30, thanks.
Thanks,
Closing.
Committed as 7e8a97ac788
Robert
--
Added tag(s) fixed.
Request was from
Robert Pluim <rpluim <at> gmail.com>
to
control <at> debbugs.gnu.org
.
(Mon, 24 Jun 2024 17:22:03 GMT)
Full text and
rfc822 format available.
bug marked as fixed in version 30.1, send any further explanations to
71648 <at> debbugs.gnu.org and Robert Pluim <rpluim <at> gmail.com>
Request was from
Robert Pluim <rpluim <at> gmail.com>
to
control <at> debbugs.gnu.org
.
(Mon, 24 Jun 2024 17:22:03 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Tue, 23 Jul 2024 11:24:08 GMT)
Full text and
rfc822 format available.
This bug report was last modified 326 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.