Subject: bug#46151: 28.0.50; Set revert-buffer-function in shell command output buffers

From: Sean Whitton <[email-masked]>
Date: Sun, 31 Jan 2021 11:50:26 -0700

Hello,

On Sat 30 Jan 2021 at 07:18AM +01, Lars Ingebrigtsen wrote:

> Sean Whitton <[email-masked]> writes:
>
>> This sort of thing could be pretty annoying if you happened to want to
>> type the letter 'g' and thereby reran the command ..
>
> Indeed -- I was thinking about the `M-!' case only, and whether we'd
> want to change the mode of the resulting buffer to a new mode that
> inherits from `special-mode' (and `special-mode' defines the `g'
> keystroke already).
>
> That's not appropriate for `M-&', I guess, which is in `shell-mode'...
> but is that a good mode for command output, really?

I think it's in shell-mode to facilitate interacting with the command
while it is running -- for example, using C-c C-c to sent SIGINT, and
also just typing into STDIN.

So we're talking about switching the major-mode at the point the command
exits, which seems like it could cause frustration -- imagine the
command finishes up just while you're typing into the buffer and you
happen to type 'g' ...

>> How about binding C-c C-r instead of g?  The mnemonic would be
>> Reexecute.  In *Async Shell Command* buffers this already has an
>> inherited binding but I don't believe it is one that does anything
>> useful in those buffers, so should be fine to override.
>>
>> An alternative would be to put the whole buffer in special-mode, which
>> would bind 'g', and make shell command output more like M-x compile
>> buffers.  Could have a defcustom to turn this off.
>
> Indeed.

Thinking more, I think my C-c C-r solution is the one I prefer; anyone
else in favour of that?

-- 
Sean Whitton