bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#48523: 27.2; kbd macro fails evaluation


From: Stefan Monnier
Subject: bug#48523: 27.2; kbd macro fails evaluation
Date: Wed, 19 May 2021 11:20:53 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

> This gives:
>
> #+begin_src elisp
>  (fset 'myfullstop
>    (kmacro-lambda-form [?\C-x ?8 return ?F ?U ?L ?L ?W ?I ?D ?T ?H ?  ?F
>    ?U ?L ?L ?  ?S ?T ?O ?P return] 0 "%d"))
> #+end_src
>
>
> An eval (C-j with point at end) of the above expression gives the error:
>
> ----- Begin --------
>
> Debugger entered--Lisp error: (wrong-number-of-arguments (1 . 1) 3)

I installed the patch below which should fix this blunder, thanks.


        Stefan


diff --git a/lisp/kmacro.el b/lisp/kmacro.el
index 3700a1964a6..afc486f4edc 100644
--- a/lisp/kmacro.el
+++ b/lisp/kmacro.el
@@ -782,17 +782,23 @@ kmacro-end-call-mouse
 ;; 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]