Subject: Re: bug#14135: <f4> not recording macro

From: Leo Liu <[email-masked]>
Date: Fri, 05 Apr 2013 15:28:21 +0800

On 2013-04-04 05:53 +0800, Juanma Barranquero wrote:
> Package: emacs
> Version: 24.3.50
>
> emacs -Q
> <f3>    ;; Defining kbd macro...
> a
> <f4>    ;; Keyboard macro defined
> <f4>    ;; No kbd macro has been defined

Thanks for the bug report. Sorry this is broken by my commit.

Could you give the following patch a good test? Thanks a lot. -- Leo

diff --git a/lisp/kmacro.el b/lisp/kmacro.el
index c08f49df..d6de2feb 100644
--- a/lisp/kmacro.el
+++ b/lisp/kmacro.el
@@ -631,11 +631,11 @@ (defun kmacro-call-macro (arg &optional no-repeat end-macro macro)
                                   (> (length (this-single-command-keys)) 1))
                              ;; Used when we're in the process of repeating.
                              (eq no-repeat 'repeating))
-			 last-input-event))
-	(last-kbd-macro (or macro last-kbd-macro)))
+			 last-input-event)))
     (if end-macro
-	(kmacro-end-macro arg)
-      (call-last-kbd-macro arg #'kmacro-loop-setup-function))
+	(kmacro-end-macro arg)		; modifies last-kbd-macro
+      (let ((last-kbd-macro (or macro last-kbd-macro)))
+	(call-last-kbd-macro arg #'kmacro-loop-setup-function)))
     (when (consp arg)
       (setq arg (car arg)))
     (when (and (or (null arg) (> arg 0))
@@ -658,7 +658,9 @@ (defun kmacro-call-macro (arg &optional no-repeat end-macro macro)
          (define-key map (vector repeat-key)
            `(lambda () (interactive)
               (kmacro-call-macro ,(and kmacro-call-repeat-with-arg arg)
-                                 'repeating nil ,last-kbd-macro)))
+                                 'repeating nil ,(if end-macro
+						     last-kbd-macro
+						   (or macro last-kbd-macro)))))
          map)))))