emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master b4e1fdf: * lisp/kmacro.el (kmacro-lambda-form): Fix bug#48523


From: Stefan Monnier
Subject: master b4e1fdf: * lisp/kmacro.el (kmacro-lambda-form): Fix bug#48523
Date: Wed, 19 May 2021 11:19:18 -0400 (EDT)

branch: master
commit b4e1fdfe2128c53be61f04d7c35995eb1e5fb57f
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>

    * lisp/kmacro.el (kmacro-lambda-form): Fix bug#48523
    
    Re-add `counter` and `format` arguments, since they are used in
    `insert-kbd-macro`.
---
 lisp/kmacro.el | 26 ++++++++++++++++----------
 1 file changed, 16 insertions(+), 10 deletions(-)

diff --git a/lisp/kmacro.el b/lisp/kmacro.el
index 3700a19..afc486f 100644
--- a/lisp/kmacro.el
+++ b/lisp/kmacro.el
@@ -782,17 +782,23 @@ If kbd macro currently being defined end it before 
activating it."
 ;; executing the macro later on (but that's controversial...)
 
 ;;;###autoload
-(defun kmacro-lambda-form (mac)
+(defun kmacro-lambda-form (mac &optional counter format)
   "Create lambda form for macro bound to symbol or key."
-  ;; FIXME: This should be a "funcallable struct"!
-  (lambda (&optional arg)
-    "Keyboard macro."
-    ;; We put an "unused prompt" as a special marker so
-    ;; `kmacro-extract-lambda' can see it's "one of us".
-    (interactive "pkmacro")
-    (if (eq arg 'kmacro--extract-lambda)
-        (cons 'kmacro--extract-lambda mac)
-      (kmacro-exec-ring-item mac arg))))
+  ;; Apparently, there are two different ways this is called:
+  ;; either `counter' and `format' are both provided and `mac' is a vector,
+  ;; or only `mac' is provided, as a list (MAC COUNTER FORMAT).
+  ;; The first is used from `insert-kbd-macro' and `edmacro-finish-edit',
+  ;; while the second is used from within this file.
+  (let ((mac (if counter (list mac counter format) mac)))
+    ;; FIXME: This should be a "funcallable struct"!
+    (lambda (&optional arg)
+      "Keyboard macro."
+      ;; We put an "unused prompt" as a special marker so
+      ;; `kmacro-extract-lambda' can see it's "one of us".
+      (interactive "pkmacro")
+      (if (eq arg 'kmacro--extract-lambda)
+          (cons 'kmacro--extract-lambda mac)
+        (kmacro-exec-ring-item mac arg)))))
 
 (defun kmacro-extract-lambda (mac)
   "Extract kmacro from a kmacro lambda form."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]