GNU bug report logs - #73764
format-kbd-macro returns a key name that keymap-lookup doesn't recognize

Previous Next

Package: emacs;

Reported by: Eduardo Ochs <eduardoochs <at> gmail.com>

Date: Sat, 12 Oct 2024 04:47:02 UTC

Severity: normal

Full log


View this message in rfc822 format

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 73764 <at> debbugs.gnu.org, Eduardo Ochs <eduardoochs <at> gmail.com>
Subject: bug#73764: format-kbd-macro returns a key name that keymap-lookup doesn't recognize
Date: Sat, 12 Oct 2024 09:33:59 -0400
>>   (keymap-lookup global-map "M-C-h")
>>     ;;-> "M-C-h" is not a valid key definition; see `key-valid-p'
[...]
> Should we fix key-valid-p to be more lenient?

AFAIK the strictness was a conscious choice, so maybe we should simply
improve the error message to say something like "M-C-h uses an invalid
modifier ordering, maybe you meant C-M-h".

>> if we run this
>>
>>   (format-kbd-macro (read-key-sequence-vector "Type C-M-h:"))
>>
>> we get "M-C-h".

I guess we also need to make sure `format-kbd-macro` generates
something that `key-valid-p` accepts.

> Or maybe just remove the call to keymap--check from keymap-lookup?

IIRC we wanted to use `keymap--check` on all input coming from the user,
so I guess the question is whether the second arg of `keymap-lookup` is
expected to be an immediate constant.
That function is still young, so it's hard to tell how it'll turn up,
but my `grep` says that indeed many (most) calls take a literal string
as argument, so `keymap--check` seems appropriate.


        Stefan





This bug report was last modified 340 days ago.

Previous Next


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