4

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.

Example:

F3 boo F4

Now, if I press F4 I get:

booboobooboobooboobooboobooboobooboobooboobooboobooboobooboobooboobooboobooboobooboobooboobooboobooboobooboobooboobooboobooboobooboobooboobooboobooboobooboobooboobooboobooboobooboobooboobooboobooboobooboobooboobooboobooboobooboobooboobooboob

Now if I redefine it again, I will get:

booboo

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

Mark Karpov
  • 4,943
  • 1
  • 26
  • 54
  • 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 09 '14 at 07:56
  • @wvxvw, I've never experienced any problems with my keyboard, it's pretty new. GNU Emacs 24.4.1 on Linux. – Mark Karpov Nov 09 '14 at 07: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.) – Harald Hanche-Olsen Nov 09 '14 at 08:20
  • @HaraldHanche-Olsen, yes the bug is gone when flyspell-mode is not active. However, I like Flyspell, how could I fix this bug? – Mark Karpov Nov 09 '14 at 08:26
  • 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 09 '14 at 08:28
  • @phils, I'm trying to send the bug report. Now Emacs is asking for ongoing SMTP mail server. Should I use 'smtp.gmail.com' if I use Gmail? I've never sent mails from Emacs... – Mark Karpov Nov 09 '14 at 08:57
  • 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 09 '14 at 09:43
  • I can reproduce this in Emacs 24.3. Start emacs -Q, run M-x flyspell-mode RET, press f3 a f4 f4. The last f4 inserts 142 a and I get the slightly different message “After 0 kbd macro iterations: run-hook-with-args: Variable binding depth exceeds max-specpdl-size”. I agree with Harald and phils, this does look like a bug in Flyspell, probably in flyspell-post-command-hook. – Gilles 'SO- stop being evil' Nov 09 '14 at 09:53

1 Answers1

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.

Mark Karpov
  • 4,943
  • 1
  • 26
  • 54