Subject: bug#18133: Suppressing asynchronous command output

From: Reuben Thomas <[email-masked]>
Date: Fri, 23 Dec 2016 21:07:37 +0000

On 23 December 2016 at 19:55, martin rudalics <[email-masked]> wrote:

> ​​
>
> Isn't this much more than changing the way ‘display-buffer’ behaves?
> IIUC, you want the buffer to pop up whenever some output arrives, the
> user should be allowed to delete the window, and when new output arrives
> the buffer should pop up again.  Correct?

Here is the implementation I currently use (from Juri Linkov, message #8,
second block of code):

(advice-add 'comint-output-filter :after
            "Stop Async Shell Command output from appearing until there is
output."
            (lambda (process string)
              (when (and (string-match-p "\\*Async Shell Command\\*"
                                         (buffer-name (process-buffer
process))))
                (display-buffer (process-buffer process)))))

I think this does what you say: whenever some output arrives, the buffer
pops up. It does not involve changing the behaviour of display-buffer.

All my patch does is move the advice into a function suitable for
comint-output-filter-functions.

But I'm still confused by how you
> want to add something to ‘display-buffer-alist’ and at the same time to
> not change the behavior of ‘display-buffer’ ;-)

​
I suggested adding an option to display-buffer-alist's defcustom
specification, something like:

                :options (((regexp "\\*Async Shell Command\\*") (function
display-buffer-no-window)))

By default, this is not selected, so it does not change the default
behaviour.

I currently simply add an item to display-buffer-alist:

(add-to-list 'display-buffer-alist '("\\*Async Shell Command\\*"
                                     display-buffer-no-window))

-- 
http://rrt.sc3d.org