Suppose that I do M-x blabla without pressing return and then I switch to the main buffer. If the curser is at minibuffer I can cancel the mini-buffer by the shortcut C-g. But if the cursor is at the main buffer, this shortcut doesn't cancel the minibuffer. If I press M-x the error Command attempted to use minibuffer while in minibuffer appears.

Is there a build-in shorcut that completely cancels the previously non-completed contents of the minibuffer since the main buffer.

  • 2
    This SO solution might be related. I use that solution to automatically abort recursive edit when focus moves away from the minibuffer. This of course would be detriment if you do wnat to levy the advantages of recursive edit (which I haven't yet realized). Commented Jan 20, 2015 at 16:06

1 Answer 1


C-] (command abort-recursive-edit) does what you want.

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.