Subject: bug#25209: 25.1; can't delete *Shell Command Output*

From: Francesco Potortì <[email-masked]>
Date: Mon, 19 Dec 2016 13:45:56 +0100

>> Date: Thu, 15 Dec 2016 17:34:23 +0100
>> From: Francesco Potortì <[email-masked]>
>> 
>> On a long-running multi-tty Emacs, at one point the *Shell Command
>> Output* buffer refuses to go away.
>> 
>> If I try to kill it, nothing happens, whether the current buffer is that
>> one or any other one.  The contents of the *Shell Command Output* buffer
>> are always visible in the minibuffer.  So, to make it unobtrusive, I
>> need to issue an
>>  M-! echo -n RET
>> every time the *Shell Command Output* buffer is dirtied.
>> 
>> I am still running that Emacs, so I can try to debug something.  If you
>> suggest me where to look, I can do that when I have time (probably not
>> it nthe next few days).
>
>Some questions come to mind, hopefully one of them will help you:
>
>Are you in recursive edit level, perhaps?

No :(

>When the cursor is shown in that buffer in the echo area, does typing
>C-g or "C-x o" get you out of that, and can you then kill that buffer?
>Or maybe try "C-x b" to switch to a minibuffer in that situation.

The echo area always shows the contents of the *Shell Command Output*
buffer.  When I use the minibuffer, all is well and the minibuffer works
as usual.  As soon as I finish using it, it again displays the *Shell
Command Output* buffer.  The cursor never goes there, C-x o does nothing
as usual if I have a single buffer int he window.

Oh, note that I have two frames open, one running under screen in a
virtual terminal and one on X.  Only the latter frame exhibits the
problem.

However, I have just tried to go to the terminal frame, switch to the
*Shell Command Output* buffer, and now the problem also happens there!

>Do you have some non-nil kill-buffer-hook, and if so, what does that
>do?

(tramp-flush-file-function browse-url-delete-temp-file
 preview-kill-buffer-cleanup rmail-mode-kill-summary
 tramp-delete-temp-file-function uniquify-kill-buffer-function
 vc-kill-buffer-hook)

> What about kill-buffer-query-functions -- any non-nil value for
>that?

(process-kill-buffer-query-function)
 
>What happens if you set debug-on-error non-nil, and then try to kill
>that buffer?  What errors, if any, pop up, and what do they show?

No errors...

>When you attempt to kill the buffer, do you see any messages added to
>*Messages*?

Nothing

>The most promising lead, IMO, is the one about this buffer being shown
>in the echo area: kill-buffer won't kill the current minibuffer
>buffer, so I think you should try to break that link.  Thus the first
>2 questions above are the most probable cause of your trouble.

Unfortunately I had already tried all your suggestions.  I had not
thought about the hooks, but now that I look at them I would say that I
have not set them myself and they look like standard ones.

I can obviously disregard this, kill Emacs and start a fresh one, but
maybe there is a bug lurking somewhere and this is a unique chance to
hunt it down :)