Emacs text gets stuck in minibuffer
Asked Answered
S

1

6

I am using GNU Emacs 24.4.1 (edit: also seen with 24.5.1). Some old output from vc-mode (I think) is appearing in the minibuffer:

Auto-merging foo/bar

I am not doing any version control operations at the moment, but this text is stuck in the minibuffer. Pressing C-g replaces it briefly with Quit, but it comes back with the next keystroke.

What it isn't: it's not a recursive edit. C-] or abort-recursive-edit gives the error No recursive edit is in progress and the awkward text in the minibuffer is still there.

It's not text selected with the mouse since I am running in a text console (GNU screen session over ssh) with no mouse support.

I have tried the switch-to-minibuffer command from http://www.emacswiki.org/emacs/MiniBuffer but that gives the error Minibuffer is not active. Yet still this awkward text keeps appearing.

It is not a screen size problem (with stale text because Emacs is not aware of the correct size of the terminal window) because I can resize the terminal window and Emacs resizes with it correctly... with the text still displayed in the minibuffer.

Sometimes I have seen this effect with two or more lines of text in the minibuffer. In fact, my current Emacs session has that in one client session (emacsclient -nw) in one screen, with the main session showing only one line. The client session shows several lines of version control gunk in the minibuffer:

Auto-merging foo/bar
CONFLICT (content): Merge conflict in foo/bar

How can I make it go away?

Severable answered 24/6, 2015 at 9:36 Comment(6)
Assumption: it sounds like the text remains even after you move the cursor, type text, etc. Does the text show up in the *Messages* buffer? Have you tried M-: (message nil)? To see if that can clear it up?Pullen
Thanks - next time this occurs I will try what you suggest. Oddly it hasn't happened since upgrading to emacs 24.5.1...Severable
No, the text does not show in *Messages*. It is a fragment of *Shell Command Output* which has got stuck in the minibuffer. Doing M-: (message nil) prints nil in the minibuffer, but it then goes back to showing the fragment of shell output.Severable
The way I have found to clear it is M-! echo.Severable
Thanks! Your comment worked. This has driven me crazy in the past.Paolo
Actually my Shell Command Output window got stuck after doing this. This post has a complete solution that worked for me: emacs.1067599.n8.nabble.com/…Paolo
M
3

This could happen if you hit C-g to terminate a running shell command. This would leave the minibuffer window pointing to the *Shell Command Output* buffer.

As described in bug #25209, you could check whether that has happened by calling (minibuffer-window) in the scratch buffer:

(minibuffer-window)
#<window 2 on *Shell Command Output*>

and fix it with:

(set-window-buffer (minibuffer-window) (get-buffer " *Minibuf-0*"))

This has been fixed in this commit, and the fix was released as part of Emacs 26.1.

Mackenziemackerel answered 8/11, 2019 at 12:26 Comment(2)
Thanks, that's likely to have been it (or a closely related bug). As you say, it appears fixed in recent Emacs versions.Severable
I'm getting this in Emacs 28.1. Your solution fixes the issue, indeed.Nomadic

© 2022 - 2024 — McMap. All rights reserved.