[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: |
Stefan Kangas |
Subject: |
bug#59305: 29.0.50; keymap-global-set handling of string bindings different from global-set-key |
Date: |
Fri, 25 Nov 2022 00:25:34 -0800 |
Robert Pluim <rpluim@gmail.com> writes:
> 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.
Yes, see the discussions about it at the time. The same idea is there
in all the new keybinding functions.
> 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?
AFAIU, because otherwise we can't have error handling for common typos,
such as:
(keymap-global-set "xo") ; bad, I actually want "x o"
I think catching this is more important than supporting the somewhat
nicer syntax for inserting strings with a key binding (which you can
still do by other means, as you point out).