bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#18133: Suppressing asynchronous command output


From: Juri Linkov
Subject: bug#18133: Suppressing asynchronous command output
Date: Sat, 31 Dec 2016 00:56:06 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (x86_64-pc-linux-gnu)

> "The way recommended by Martin" involves a new minor mode,
> async-shell-lazy-pop-up-mode, which I tried to avoid; Eli didn't seem to
> support its addition, either.

No, not a new minor mode, I meant https://debbugs.gnu.org/18133#47
i.e. in ‘shell-command’ instead of

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

we could use

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

when this feature is enabled by the new customizable variable
‘async-shell-command-display-buffer’.

> I'm not sure what the variable async-shell-command-display-buffer is
> supposed to contain. (It does not seem to be the name of the buffer to be
> matched.)

We can't hard-code the name of the buffer because ‘shell-command’
uses the arg ‘output-buffer’, and only if it's nil then by default
"*Async Shell Command*".  So ‘async-shell-command-display-buffer’
shouldn't define the name of the buffer.  Instead, it could be
boolean to enable this feature (or a choice of options for more
future related features like in ‘async-shell-command-buffer’).

> I am unclear what goes in the ellipsis after "when" in the sample code
> above; it seems to imply a test for whether the buffer should be displayed,
> but I already handled that in my patch with the preoutput-filter function.

In the ellipsis goes the code that you already wrote for the filter:

(set-process-filter
 proc
 `(lambda (process string)
    (when (and (= 0 (buffer-size (process-buffer process)))
               (eq (buffer-name (process-buffer process))
                  ,(or output-buffer "*Async Shell Command*")))
      (display-buffer (process-buffer process)))))

i.e. it will handle exactly the same buffer that was provided as an arg
‘output-buffer’ to ‘async-shell-command’.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]