From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Reuben Thomas Newsgroups: gmane.emacs.bugs Subject: bug#18133: Suppressing asynchronous command output Date: Wed, 30 Jul 2014 10:48:33 +0100 Message-ID: References: <87iomf682d.fsf@mail.jurta.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a11345e0e2d2ca504ff660f77 X-Trace: ger.gmane.org 1406713766 24777 80.91.229.3 (30 Jul 2014 09:49:26 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 30 Jul 2014 09:49:26 +0000 (UTC) Cc: 18133@debbugs.gnu.org To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Jul 30 11:49:20 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XCQVX-0001k6-KD for geb-bug-gnu-emacs@m.gmane.org; Wed, 30 Jul 2014 11:49:15 +0200 Original-Received: from localhost ([::1]:49975 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XCQVX-0001W7-8z for geb-bug-gnu-emacs@m.gmane.org; Wed, 30 Jul 2014 05:49:15 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58571) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XCQVP-0001U9-EE for bug-gnu-emacs@gnu.org; Wed, 30 Jul 2014 05:49:12 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XCQVK-0003mz-G3 for bug-gnu-emacs@gnu.org; Wed, 30 Jul 2014 05:49:07 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:47297) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XCQVK-0003mp-AT for bug-gnu-emacs@gnu.org; Wed, 30 Jul 2014 05:49:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1XCQVJ-0008NJ-Qa for bug-gnu-emacs@gnu.org; Wed, 30 Jul 2014 05:49:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Reuben Thomas Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 30 Jul 2014 09:49:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 18133 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 18133-submit@debbugs.gnu.org id=B18133.140671372232165 (code B ref 18133); Wed, 30 Jul 2014 09:49:01 +0000 Original-Received: (at 18133) by debbugs.gnu.org; 30 Jul 2014 09:48:42 +0000 Original-Received: from localhost ([127.0.0.1]:42563 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XCQUz-0008Mi-Vs for submit@debbugs.gnu.org; Wed, 30 Jul 2014 05:48:42 -0400 Original-Received: from mail-lb0-f173.google.com ([209.85.217.173]:54382) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XCQUx-0008MU-Pt for 18133@debbugs.gnu.org; Wed, 30 Jul 2014 05:48:40 -0400 Original-Received: by mail-lb0-f173.google.com with SMTP id p9so681538lbv.18 for <18133@debbugs.gnu.org>; Wed, 30 Jul 2014 02:48:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sc3d.org; s=google; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=6ZkF1WDkBnoqwYkT2xTKYnGdp2kwysZ4wCLJOPSZaDg=; b=R+FVl7gSTlt0ZehM8J6+fjQrhoedJHfeZh5064+vFB0SsGqHE97z4GdQrp5gARUKDv G2yDOJAjOEjBmAb5WxGglak3sDxqivvTA+g1KdaFe2XjqpQ4XqtFrJXwAzmbgiPh7ZCv s5m+LXOW3JZJVrjv04XCkkldwi09jO+3VXon8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=6ZkF1WDkBnoqwYkT2xTKYnGdp2kwysZ4wCLJOPSZaDg=; b=ib4bpOfWVGic4/pplDSvwXlsZItlJuu94i6B37io8/Y5/oVplJ6BZNslnqjqcyc4cl 6jeY4s6Q2bh8OMZifoUuk/EHjd1yg7Mukf9VGoBHAqig3nRSfGBCSoAfgCxNYre7YrM3 Z6kS/qfaMyl5U+Qq4XMsZRmKpasUAZtnkKRWip9Yo8PTXsxTDser1KW8Nm+KjBgxsmVO SL7sffjGfkreRDO8BUy5D4GeBizGSw+RtjSLQsRGlPiuS2paZGoQBFpmQ5MqjAafKQMy U4Imq31nvUkVgDQRO9fnQ2c10NcPO8IWZ6epzCsSwK1lCBScDdsQOeE0P+myS6Sz3hd0 8IzA== X-Gm-Message-State: ALoCoQnBAG7jkiU7J22EzhXQO1wIYvI3Nsdl78H00ygrXhf0u0OlJMSjPd+R2YTa/2cPa9Y4Omq7 X-Received: by 10.152.236.43 with SMTP id ur11mr3289944lac.74.1406713713170; Wed, 30 Jul 2014 02:48:33 -0700 (PDT) Original-Received: by 10.152.163.4 with HTTP; Wed, 30 Jul 2014 02:48:33 -0700 (PDT) In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:91967 Archived-At: --001a11345e0e2d2ca504ff660f77 Content-Type: text/plain; charset=UTF-8 On 30 July 2014 10:16, Reuben Thomas 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 --001a11345e0e2d2ca504ff660f77 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
On 3= 0 July 2014 10:16, Reuben Thomas <rrt@sc3d.org> wrote:

=C2=A0 (add-to-list 'display-buffer-alist '("\\*Async Shell Co= mmand\\*"
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0display-b= uffer-no-window (nil)))

=C2=A0 (advice-add 'comint-output-filter :after
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (lambda (process string) =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (when (and (string-= match-p "\\*Async Shell Command\\*"
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0(buffer-name (process-buffer process))))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (display-buf= fer (process-buffer process)))))

Thanks = very much. The second form seems like the "right" one: when runni= ng a command asynchronously, output should be immediately visible.

Unfortunately, this code relies on f= eatures in the upcoming 24.4. I've rewritten it to work in 24.3, and fi= xed a bug:

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

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

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

--
http://rrt.sc3d.org<= /a>
--001a11345e0e2d2ca504ff660f77--