From b4e1fdfe2128c53be61f04d7c35995eb1e5fb57f Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Wed, 19 May 2021 11:19:10 -0400 Subject: [PATCH] * 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 3700a1964a6..afc486f4edc 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." -- 2.39.5