[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#59305: 29.0.50; keymap-global-set handling of string bindings differ
From: |
Robert Pluim |
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 |
>>>>> 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
--