I'm reading GNU Emacs Manual to learn how to use Emacs in its full power. I now I'm trying to make use of keyboard macros. It's fairly easy, but I cannot understand why the first defined macro repeats infinitely, while all subsequent macros are executed only once (on pressing F4).

Is it normal behavior? I like when I press F4 and the macro is executed once. I don't see why the first defined macro should repeat indefinitely.


F3 boo F4

Now, if I press F4 I get:


Now if I redefine it again, I will get:


What's going on?

I think it has something to do with Flyspell. I use Flyspell always. It's active in text mode and also in programming modes, but via flyspell-prog-mode. I think that Flyspell is involved here because of this part of my *Messages* buffer:

Defining kbd macro...
Keyboard macro defined
Error in post-command-hook (flyspell-post-command-hook): (error "Variable binding depth exceeds max-specpdl-size")
After 0 kbd macro iterations: self-insert-command: Variable binding depth exceeds max-specpdl-size
Defining kbd macro...
Keyboard macro defined

Result of C-u M-x emacs-version:

GNU Emacs 24.4.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.14.3) of 2014-10-21 on bitzer.hoetzel.info

  • This looks like a problem with keyboard to me... but if not, please post the version of Emacs you are using. This is certainly not the expected behaviour. There is a way to get Emacs to repeat a macro indefinitely - C-u 0 F4, but the way you describe it, it should do it just once.
    – wvxvw
    Nov 9, 2014 at 7:56
  • @wvxvw, I've never experienced any problems with my keyboard, it's pretty new. GNU Emacs 24.4.1 on Linux. Nov 9, 2014 at 7:59
  • If it's not a problem with the keyboard, then emacs itself may be to blame. What version are you running? (Try C-u M-x emacs-version in the scratch buffer, then copy the result and paste it here.) (Edit: I just noticed you updated the question. Well, looks like you found the culprit. You could also start emacs with the -Q flag and see if the bug happens then.) Nov 9, 2014 at 8:20
  • 1
    If flyspell is the culprit and you can replicate reliably starting from emacs -Q, then submit the details via M-x report-emacs-bug
    – phils
    Nov 9, 2014 at 8:28
  • 1
    Mark: You can also just copy the content of the message into your regular email client, and send the message that way. That's simpler if Emacs itself isn't configured for sending email. You should always use the report-emacs-bug command to generate the message template, though.
    – phils
    Nov 9, 2014 at 9:43

1 Answer 1


I've submitted bug report to [email protected], this is the link that provides access to information about this bug and its status. I will update this answer when the bug is fixed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.