Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Emacs Modes: "Command attempted to use minibuffer while in minibuffer"

Scenario:

  • I start to type M-x to type a command
  • I switch to another emacs window/buffer because I realise I'm executing the command in the wrong window
  • I start to type M-x again to execute the command in the correct window

Result: I get the dreaded "Command attempted to use minibuffer while in minibuffer"

This happens to me multiple times a day while using emacs, and not just in this scenario. This behaviour is highly user-hostile (ref. Modes and Pseudo-modes in The Humane Interface by Jef Raskin)

Is there a way to customize emacs behaviour so that instead of giving this error, it just cancels the first minibuffer and replaces it with a new one?

like image 627
EoghanM Avatar asked May 01 '09 16:05

EoghanM


1 Answers

You can set the variable enable-recursive-minibuffers, which will prevent that error message from coming up. But it just enables multiple calls to the minibuffer - it doesn't redirect the current minibuffer's command to the new buffer. You can give this a try, but I think it'll be more confusing because the original action is still pending...

M-x is bound to 'execute-extended-command, and re-hosting (changing the original buffer) for that command is kind of like programming with continuation. i.e. you call a subroutine from location X, but instead of returning to X when done, you return to Y. I personally think it'd open up more confusion than it'd solve. But I understand the frustration (and know others who have the same frustration).

like image 50
Trey Jackson Avatar answered Oct 12 '22 07:10

Trey Jackson