From: Robert Pluim <rpluim@gmail.com>
To: 59305@debbugs.gnu.org
Subject: bug#59305: 29.0.50; keymap-global-set handling of string bindings different from global-set-key
Date: Wed, 16 Nov 2022 09:47:31 +0100 [thread overview]
Message-ID: <87edu3cml8.fsf@gmail.com> (raw)
`global-set-key' allows you to bind keys to strings (or vectors). The
following all succeed without error (although only [1] and [3] match the
expectations of users unfamiliar with Emacs' key representation).
1. (global-set-key (kbd "C-c h") "hello")
2. (global-set-key (kbd "C-c h") "olá")
3. (global-set-key (kbd "C-c h") (kbd "olá"))
Trying to map this to emacs-29's `keymap-global-set', we get the
following issues
(keymap-global-set "C-c h" "hello") => error
(keymap-global-set "C-c h" "olá") => error
OK, maybe we need to wrap the definitions in `kbd' like [3] above.
(keymap-global-set "C-c h" (kbd "olá")) => definition is a vector -> ok
but
4. (keymap-global-set "C-c h" (kbd "hello")) => defn is a string -> error
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.
Thanks
Robert
In GNU Emacs 29.0.50 (build 43, x86_64-pc-linux-gnu, GTK+ Version
3.24.24, cairo version 1.16.0) of 2022-11-16 built on rltb
Repository revision: 60f2bb862f834fcb580d839ac79b30a8b4cd4167
Repository branch: master
System Description: Debian GNU/Linux 11 (bullseye)
Configured using:
'configure -C'
Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NOTIFY
INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF
TOOLKIT_SCROLL_BARS WEBP X11 XDBE XIM XINPUT2 XPM GTK3 ZLIB
next reply other threads:[~2022-11-16 8:47 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-16 8:47 Robert Pluim [this message]
2022-11-22 16:58 ` bug#59305: 29.0.50; keymap-global-set handling of string bindings different from global-set-key Robert Pluim
2022-11-25 0:14 ` Stefan Kangas
2022-11-25 8:01 ` Robert Pluim
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87edu3cml8.fsf@gmail.com \
--to=rpluim@gmail.com \
--cc=59305@debbugs.gnu.org \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.