From: Josh Moller-Mara <jmm@cns.nyu.edu>
To: 61700@debbugs.gnu.org
Subject: bug#61700: 30.0.50; insert-kbd-macro fails for named macro but not last macro
Date: Tue, 21 Feb 2023 17:18:16 -0800 [thread overview]
Message-ID: <87wn4amraf.fsf@cns.nyu.edu> (raw)
Using “M-x insert-kbd-macro” can insert an incorrect kmacro form for a
named macro, while still correctly inserting the “last-kbd-macro”.
To see this, we’ll define a macro that simply inserts the HTML string
“<b>hello</b>” (press F3, type the previous string, then press F4).
We’ll name this macro “bold-hello” using “C-x C-k n”.
Inserting the definition to the last macro (using “M-x insert-kbd-macro”
and leaving the prompt blank) returns:
(setq last-kbd-macro
(kmacro "< b > H e l l o < / b >"))
Inserting the definition to “bold-hello” (using “M-x insert-kbd-macro”
and typing “bold-hello” at the prompt) returns:
(defalias 'bold-hello
(kmacro "<b> H e l l o < / b >"))
Notice the difference in “< b >” vs “<b>”. The “bold-hello” command
doesn’t work, printing the message:
“After 0 kbd macro iterations: Keyboard macro terminated by a command ringing the bell”
I think this may have to do with the use of “key-parse” in “kmacro” (see
“(find-function 'kmacro)”).
(key-parse "<b>hello</b>") returns
“[b 104 101 108 108 111 60 47 98 62]”
but
(macro--string-to-vector "<b>hello</b>") returns
“[60 98 62 104 101 108 108 111 60 47 98 62]”
The latter form is used in “insert-kbd-macro” when inserting
“last-kbd-macro”.
You can also quickly replicate the issue by evaluating the following
form:
(progn
(setq last-kbd-macro "<b>hello</b>")
(kmacro-name-last-macro 'bold-hello)
(let ((temp-buffer (generate-new-buffer "*macros*")))
(with-current-buffer temp-buffer
(insert-kbd-macro (intern ""))
(insert-kbd-macro 'bold-hello))
(display-buffer temp-buffer)))
In GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
3.24.35, cairo version 1.16.0)
Repository revision: 2c7e87c73a90effab66fa7c783855199880315d3
Repository branch: master
System Description: NixOS 22.11 (Raccoon)
Configured using:
'configure
--prefix=/nix/store/bdg6d4gm3ma2hja63hbxwrkaap04j2c6-emacs-pgtk-20230217.0
--disable-build-details --with-modules --with-pgtk
--with-native-compilation'
Configured features:
CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG JSON
LIBSELINUX LIBSYSTEMD LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER
PGTK PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS
TREE_SITTER WEBP XIM GTK3 ZLIB
next reply other threads:[~2023-02-22 1:18 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-22 1:18 Josh Moller-Mara [this message]
2023-02-23 9:21 ` bug#61700: 30.0.50; insert-kbd-macro fails for named macro but not last macro Robert Pluim
2023-02-23 12:59 ` Robert Pluim
2023-02-23 16:00 ` Eli Zaretskii
2023-02-23 16:30 ` Robert Pluim
2023-02-23 16:44 ` Eli Zaretskii
2023-02-23 18:28 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-02-24 10:44 ` 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=87wn4amraf.fsf@cns.nyu.edu \
--to=jmm@cns.nyu.edu \
--cc=61700@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.