11

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?

Community
  • 1
  • 1
Vivi
  • 4,070
  • 6
  • 29
  • 44
  • 2
    You are in (two levels of) recursive edit, as can be seen by the [[..]] around the parentheses that surround the mode names. You can abort the recursive edit by using 'C-]'. See http://www.cs.cmu.edu/cgi-bin/info2www?(emacs)Recursive%20Edit for more info. – Andrew Stein Jun 11 '10 at 19:51

2 Answers2

19

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.

Community
  • 1
  • 1
Trey Jackson
  • 73,529
  • 11
  • 197
  • 229
  • Quite possible I did that... I am trying though not to use the mouse, so hopefully I this command will be redundant soon. Does this happen when I use ** C-x b ** as well? By the way, I prefer the code you put on the answer to a superuser question and linked in a comment to your blog post :) (the one which gives a key binding to go to the active minibuffer window) – Vivi Jun 11 '10 at 15:30
  • @Vivi Ahhh... right the SU answer. I am not so happy how SO and SU split the Emacs questions. I'll link that one as well in this answer. – Trey Jackson Jun 11 '10 at 16:03
  • 1
    This can happen if you start a command and get an error condition. The trick to get focus into the mini-buffer and then Ctrl-G to abort will fix it. – Michael Mathews Jun 14 '10 at 18:13
  • why do you need to check the recursion depth? – fommil Jan 04 '16 at 21:31
  • also, is there an equivalent that would work if something other than the mouse changed the focus? – fommil Jan 04 '16 at 21:38
  • @fommil, I think the recursion depth check is because this is going to be triggered every time there is a click, so you want to check you are in the mini-buffer and not try to cancel it if you're not there. I don't know the answer to your other question, but I bet it it "yes". – Gordon Mar 03 '16 at 04:25
  • @fommil - Gordon is correct, it's to avoid an error message from Emacs telling you "No recursive edit is in progress" – Trey Jackson Mar 03 '16 at 21:30
  • @TreyJackson: This does not work when I move around splitted windows in the terminal – alper May 29 '20 at 00:37
11

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.

Vijay Mathew
  • 26,737
  • 4
  • 62
  • 93
  • Oh, so it was like an unfinished command? I did the C-x o and had to finish all that stream of commands (to insert an environment in latex, put label, position, etc) so that the thing would disappear. Thanks for that! – Vivi Jun 11 '10 at 13:44