Subject: Re: bug#25860: 25.1; Double macro execution

From: Noam Postavsky <[email-masked]>
Date: Mon, 27 Feb 2017 12:18:45 -0500

On Mon, Feb 27, 2017 at 10:57 AM, Eli Zaretskii <[email-masked]> wrote:
>
> Yes, but that's not the scenario I had in mind.  What I had in mind is
> a macro that, when run, will call start-kbd-macro etc.  It's clear
> that such a macro cannot be easily defined using F3 and F4, but
> perhaps some ingenious method with using some Lisp data in the
> macro...

C-x ( is bound to kmacro-start-macro which refuses to define a macro
while a macro is executing:

(defun kmacro-start-macro (arg)
...
  (if (or defining-kbd-macro executing-kbd-macro)
      (message "Already defining keyboard macro.")
...)

I tried making a macro to call M-x start-kbd-macro directly:

<<start-kbd-macro>>    ;; start-kbd-macro
zzz            ;; self-insert-command * 3
<<end-kbd-macro>>    ;; end-kbd-macro

Executing that macro seems to define an empty macro though (i.e., the
"zzz" only gets inserted while running the outer defining macro, but
hitting C-x e after is a nop (apart from the (Type e to repeat macro)
message appearing)). Probably start-kbd-macro should also refuse to
run if a macro is executing as it fails to do anything useful in this
case.