Subject: Re: bug#18133: Suppressing asynchronous command output

From: Juri Linkov <[email-masked]>
Date: Wed, 30 Jul 2014 19:35:04 +0300

> 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.

In 24.4 there is no need to add (allow-no-window . t)
because `shell-command' already provides this alist in its call:

  (display-buffer buffer '(nil (allow-no-window . t)))

> Is this suitable also to be used as the basis of a patch to Emacs?

Using defadvice is undesirable for the core files, so
if this feature is useful enough then a new user customizable
variable could be added to optionally enable displaying
the output buffer when the first output is received
using code like in this defadvice.