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?

3 Answers 3


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


  • Is there an alternative?
    – Aido
    May 15, 2015 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. May 15, 2015 at 22:16
  • 1
    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, 2016 at 6:53
  • @YoungFrog Thanks for the info in that last sentence. That should be an answer. I got here because I'm using isearch in a macro but messed my window setup up. So the macro jumped to the wrong window and tried to search there, apparently.
    – UTF-8
    Mar 29, 2021 at 12:50
  • You can use I-search as long as you don't get a search miss. Without the possibility to use I-search, macros would be close to useless. What we would like to have is to have undo in I-search revert any call to ding. I've been missing that feature as long as I've been using Emacs.
    – Nordlöw
    Nov 19, 2021 at 8:51

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.

  • 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, 2018 at 12:16

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.

  • I'm 100% sure it's right, but I still have the error.
    – Aido
    Apr 13, 2015 at 21:18
  • @AidanEdwards tell us exactly the keys you're typing
    – Malabarba
    Apr 13, 2015 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, 2015 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, 2016 at 6:59

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.