5

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?

Ed Avis
  • 1,350
  • 17
  • 36
  • 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? – Trey Jackson Nov 05 '15 at 21:05
  • Thanks - next time this occurs I will try what you suggest. Oddly it hasn't happened since upgrading to emacs 24.5.1... – Ed Avis Nov 09 '15 at 10:53
  • 1
    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. – Ed Avis Nov 25 '15 at 16:43
  • 2
    The way I have found to clear it is `M-! echo`. – Ed Avis Nov 25 '15 at 16:43
  • Thanks! Your comment worked. This has driven me crazy in the past. – kcraigie Sep 06 '17 at 00:01
  • 1
    Actually my *Shell Command Output* window got stuck after doing this. This post has a complete solution that worked for me: http://emacs.1067599.n8.nabble.com/bug-25209-25-1-can-t-delete-Shell-Command-Output-tp415873p416155.html – kcraigie Sep 06 '17 at 00:06

1 Answers1

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.

legoscia
  • 39,593
  • 22
  • 116
  • 167
  • Thanks, that's likely to have been it (or a closely related bug). As you say, it appears fixed in recent Emacs versions. – Ed Avis Nov 11 '19 at 10:23
  • I'm getting this in Emacs 28.1. Your solution fixes the issue, indeed. – mihai May 23 '22 at 12:19