From: Robert Pluim <rpluim@gmail.com>
To: Stefan Kangas <stefankangas@gmail.com>
Cc: Lars Ingebrigtsen <larsi@gnus.org>, 59305@debbugs.gnu.org
Subject: bug#59305: 29.0.50; keymap-global-set handling of string bindings different from global-set-key
Date: Fri, 25 Nov 2022 09:01:59 +0100 [thread overview]
Message-ID: <874junfonc.fsf@gmail.com> (raw)
In-Reply-To: <CADwFkmmLXvGvdZvo5G=rVGaL71ZQMNc3NXrj7WXaATM0qksSMQ@mail.gmail.com> (Stefan Kangas's message of "Thu, 24 Nov 2022 16:14:05 -0800")
>>>>> On Thu, 24 Nov 2022 16:14:05 -0800, Stefan Kangas <stefankangas@gmail.com> said:
Stefan> Robert Pluim <rpluim@gmail.com> writes:
>> After reading up on `key-valid-p':
>>
>> 5. (keymap-global-set "C-c h" "h e l l o") => success!
>>
>> or alternatively
>>
>> 6. (keymap-global-set "C-c h" [?h ?e ?l ?l ?o]) => success!
>>
>> Whilst not strictly a regression, this behaviour is confusing and
>> unhelpful, and the solution is not easily found. I can think of two
>> solutions:
>>
>> 1. Change `kbd' to always return a vector even if the input is
>> ascii-only, which makes [4] work
>> 2. Change `keymap-set' to convert ascii-only strings to the format in
>> [5] or [6]. Probably just a call to `string-to-vector' is enough.
Stefan> I feel like the second alternative goes against the design of
Stefan> `keymap-global-set', where the idea explicitly was to only support a KEY
Stefan> argument that is `key-valid-p'.
It was? If so, then it should not have been touted as the replacement
for `global-set-key' everywhere without a big warning sign.
Stefan> Could we perhaps introduce a new optional argument to treat the argument
Stefan> as a literal string? Or if really want it to not be `key-valid-p', to
Stefan> at least require it to be something like '(literal "foo") ?
(string-to-vector "foo") will do. But that just highlights the problem
even more: if itʼs that simple, why canʼt `keymap-global-set' do that
internally instead of forcing users to jump through hoops?
Robert
--
next prev parent reply other threads:[~2022-11-25 8:01 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-16 8:47 bug#59305: 29.0.50; keymap-global-set handling of string bindings different from global-set-key Robert Pluim
2022-11-22 16:58 ` Robert Pluim
2022-11-25 0:14 ` Stefan Kangas
2022-11-25 8:01 ` Robert Pluim [this message]
2022-11-25 8:25 ` Stefan Kangas
2022-12-15 8:42 ` Robert Pluim
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=874junfonc.fsf@gmail.com \
--to=rpluim@gmail.com \
--cc=59305@debbugs.gnu.org \
--cc=larsi@gnus.org \
--cc=stefankangas@gmail.com \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).