It throws the error After 0 kbd macro iterations: isearch-search: Keyboard macro terminated by a command ringing the bell and I have no idea why, nor can I find anything about it by searching. Any help?


According to Emacs Wiki, you can't use isearch during a keyboard macro.


|improve this answer|||||
  • Is there an alternative? – Aido May 15 '15 at 22:07
  • Not sure. Actually I found this question after running across this problem. Maybe the best approach is just using regular search rather than isearch. – Kevin Holmes May 15 '15 at 22:16
  • Perhaps this was true in older versions of emacs, but it certainly isn't true now. This is how I do it : when entering a kbd macro, I start Isearch normally, and when I'm happy with the search string I hit RET to exit isearch and perform whatever editing commands I want to do, then hit [F4] (to end the keyboard macro) and again (to repeat it). What is true however is that when there are no more matches, the error message « Terminated by a command ringing the bell » is thrown, but that's harmless : it just means I'm done. – YoungFrog Mar 14 '16 at 6:53

Admittedly, that message could be a little more clear. "terminated by a command ringing the bell" means a command went wrong during your macro (threw an error).

Since it happened during isearch, it probably just means the search failed during the keyboard macro. Redo the macro, being careful not to mistype anything during the search.

|improve this answer|||||
  • I'm 100% sure it's right, but I still have the error. – Aido Apr 13 '15 at 21:18
  • @AidanEdwards tell us exactly the keys you're typing – Malabarba Apr 13 '15 at 21:51
  • F3, Ctrl+S, UnTip(), Ctrl+R, -there should be a space here but it breaks the mardown-class=blue10, Ctrl+S, onmouseover=, Ctrl+W, Ctrl+Space, );", Ctrl+W, Ctrl+S, >, -typing some stuff-, Ctrl+W, -typing more stuff-, F4 – Aido Apr 13 '15 at 22:11
  • Just to be clear : if you have the message "Failing I-search" at any point during your macro, this is the problem, even though it doesn't look like a problem during the recording of the macro. – YoungFrog Mar 14 '16 at 6:59

The alternative mentioned in the emacs wiki link that Kevin Holmes gave works for me in emacs 25.2.1: while recording the macro, type Ctrl+s to start isearch, then type RET to switch to normal search (before typing your search query), then continue from there.

|improve this answer|||||
  • Is it possible to change the behaviour of I-search to not ring a bell during macro recording? This in order to enable the backspace-correcting of failing I-search queries during macro recording? – Nordlöw Oct 12 '18 at 12:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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