GNU bug report logs -
#77317
31.0.50; insert-kbd-macro RET produces elisp that does not work
Previous Next
Reported by: Adam Sjøgren <asjo <at> koldfront.dk>
Date: Thu, 27 Mar 2025 18:39:02 UTC
Severity: normal
Found in version 31.0.50
Done: Adam Sjøgren <asjo <at> koldfront.dk>
Bug is archived. No further changes may be made.
Full log
Message #11 received at 77317 <at> debbugs.gnu.org (full text, mbox):
Eli writes:
> So it sounds like this is supposed to work for macros that have been
> given a name.
If you look at the code, there is an explicit path for last-kbd-macro:
(if (string= (symbol-name macroname) "")
(progn
(setq macroname 'last-kbd-macro definition last-kbd-macro)
(insert "(setq "))
(setq definition (symbol-function macroname))
· macros.el L70-74
which to me indicates an intention of it working, even if the manual
doesn't mention the case. This code has been in macros.el since 1992,
according to git annotate.
If insert-kbd-macro was designed explicitly to not work on the
unnamed, last macro, shouldn't an error be raised or an empty macro
name be rejected, rather than code inserted?
If you try it in a version of Emacs released before 2022-04-01 saving
last-kbd-macro does work - eg Emacs 28.2 as included in Debian 12.
(Just as a side-note: the manual of Emacs 28.2 didn't mention the
possibility either.)
Maybe Stefan Monnier (Cc'd) can shed some light on this, as he
improved the named macro part of insert-kbd-macro in 2022 (c75f65442ddf):
Also replace the old `kmacro-lambda-form` with a new `kmacro` constructor
which takes a `key-parse` syntax, so that the code inserted with
`insert-kbd-macro` is now more readable.
[...]
* lisp/macros.el (macro--string-to-vector): New function.
(insert-kbd-macro): Use it. Generate code using the `kmacro` constructor.
This bug report was last modified 25 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.