]> git.eshelyaron.com Git - emacs.git/commitdiff
Improve documentation of 'insert-kbd-macro'
authorAdam Sjøgren <asjo@koldfront.dk>
Sun, 20 Apr 2025 16:44:16 +0000 (18:44 +0200)
committerEshel Yaron <me@eshelyaron.com>
Sun, 27 Apr 2025 13:29:55 +0000 (15:29 +0200)
* lisp/macros.el (insert-kbd-macro): Update documentation
of what happens when no macro name is supplied.

* doc/emacs/kmacro.texi (Save Keyboard Macro): Document
saving 'last-kbd-macro'.  (Bug#77317)

(cherry picked from commit 0c55cd0e176cc73178e8f18d959d5a6f9bf632de)

doc/emacs/kmacro.texi
lisp/macros.el

index 62f275de2596f9c0830e79c88214e89554772b1d..09c6c5d4675f9873f0ffc6002b800ef02f4abc62 100644 (file)
@@ -472,9 +472,9 @@ C-x C-k b 4
 will bind the last keyboard macro to the key sequence @kbd{C-x C-k 4}.
 
 @findex insert-kbd-macro
-  Once a macro has a command name, you can save its definition in a file.
-Then it can be used in another editing session.  First, visit the file
-you want to save the definition in.  Then use this command:
+  You can save a macro's definition in a file.  Then it can be used in
+another editing session.  First, visit the file you want to save the
+definition in.  Then use this command:
 
 @example
 M-x insert-kbd-macro @key{RET} @var{macroname} @key{RET}
@@ -494,6 +494,9 @@ additional Lisp code to record the keys (if any) that you have bound
 to @var{macroname}, so that the macro will be reassigned the same keys
 when you load the file.
 
+  If you do not give @code{insert-kbd-macro} a macro name, it will
+insert Lisp code to restore the @code{last-kdb-macro}.
+
 @node Edit Keyboard Macro
 @section Editing a Keyboard Macro
 
index fe79fe10f984de50d40663e9aa336a909ed95470..595547736299a0dcd036a96e6c8c52eb364e3144 100644 (file)
@@ -49,7 +49,8 @@
 ;;;###autoload
 (defun insert-kbd-macro (macroname &optional keys)
   "Insert in buffer the definition of kbd macro MACRONAME, as Lisp code.
-MACRONAME should be a symbol.
+MACRONAME should be a symbol; if none is given, the function inserts
+the definition of `last-kdb-macro'.
 Optional second arg KEYS means also record the keys it is on
 \(this is the prefix argument, when calling interactively).