Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I prevent the mini-buffer from displaying previous commands in Emacs?

I am not even sure this is a previous command or a non-finished command or whatever, but I do know I really don't like it.

My problem is that some commands (or messages, or whatever) get stuck in the mini-buffer so that when I type a new command it appears there really quickly, and then the mini-buffer is back to the stubborn command. Some commands seem to be chosen, and after using lots of commands something else gets stuck there, but there is always something being shown that I don't want to see. I tried typing C-g lots of times to see if it would quit, but that does not work.

This is a picture of what I have now:

alt text

It does not matter what I do, that bit

Label: hl-line

will not leave. It does leave momentarily when a new command is typed, but it goes back. I don't like it, it is confusing, and I would much rather see there the last used command.

I did check the customisation options for the mini-buffer (the bottom part of it can be seen in my picture), but I found nothing that seemed to be what I was looking for.

Any ideas?

like image 609
Vivi Avatar asked Jun 11 '10 12:06

Vivi


2 Answers

Chances are you're getting into the situation because you started a command and used your mouse to select something in a different window. If that's the case, you can have Emacs automatically abort the command when you do such an action.

This is the code you'd add to your .emacs:

(defun stop-using-minibuffer ()
  "kill the minibuffer"
  (when (and (>= (recursion-depth) 1) (active-minibuffer-window))
    (abort-recursive-edit)))

(add-hook 'mouse-leave-buffer-hook 'stop-using-minibuffer)

Note: I grabbed this from my blog post on the topic.

And there is also a super user question that addresses this issue, and my answer there provides a command to jump back to the minibuffer.

like image 52
Trey Jackson Avatar answered Nov 16 '22 02:11

Trey Jackson


The mini-buffer has lost focus. Try C-x o (Control+x o) to regain focus. To cancel the command press C-g when you have focus in the mini-buffer.

like image 44
Vijay Mathew Avatar answered Nov 16 '22 04:11

Vijay Mathew