9

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.

Name
  • 7,689
  • 4
  • 38
  • 84
  • 2
    [This SO solution](http://stackoverflow.com/a/3024055/1219634) 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). – Kaushal Modi Jan 20 '15 at 16:06

1 Answers1

13

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

Drew
  • 75,699
  • 9
  • 109
  • 225