Subject: bug#18133: Suppressing asynchronous command output

From: Reuben Thomas <[email-masked]>
Date: Wed, 30 Jul 2014 10:48:33 +0100

On 30 July 2014 10:16, Reuben Thomas <[email-masked]> wrote:

>
>   (add-to-list 'display-buffer-alist '("\\*Async Shell Command\\*"
>>                                        display-buffer-no-window (nil)))
>>
>>   (advice-add 'comint-output-filter :after
>>               (lambda (process string)
>>                 (when (and (string-match-p "\\*Async Shell Command\\*"
>>                                            (buffer-name (process-buffer
>> process))))
>>                   (display-buffer (process-buffer process)))))
>>
>
> Thanks very much. The second form seems like the "right" one: when running
> a command asynchronously, output should be immediately visible.
>

Unfortunately, this code relies on features in the upcoming 24.4. I've
rewritten it to work in 24.3, and fixed a bug:

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

(defadvice comint-output-filter (after delay-ashell-sync-command-output
(process string))
  "Stop Async Shell Command output from appearing until there is some
output"
  (when (and (string-match-p "\\*Async Shell Command\\*"
                             (buffer-name (process-buffer process))))
    (display-buffer (process-buffer process))))

The argument to display-buffer-no-window now uses allow-no-window as it
should, and I've rewritten the call to advice-add as a defadvice.

-- 
http://rrt.sc3d.org