From mboxrd@z Thu Jan  1 00:00:00 1970
Path: news.gmane.org!.POSTED!not-for-mail
From: Tino Calancha <tino.calancha@gmail.com>
Newsgroups: gmane.emacs.bugs
Subject: bug#30280: async-shell-command-display-buffer doesn't work anymore
Date: Mon, 07 May 2018 16:35:03 +0900
Message-ID: <87zi1budeg.fsf@gmail.com>
References: <87a7wxd1g9.fsf@mail.linkov.net> <83607kinmx.fsf@gnu.org>
	<877erz41re.fsf@tcd.ie> <87zi4tu2ic.fsf@mail.linkov.net>
	<83lggbd661.fsf@gnu.org> <87tvuyqhz8.fsf@tcd.ie>
	<87tvuxojag.fsf@mail.linkov.net> <874ljkn4fb.fsf@tcd.ie>
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: text/plain
X-Trace: blaine.gmane.org 1525678448 557 195.159.176.226 (7 May 2018 07:34:08 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Mon, 7 May 2018 07:34:08 +0000 (UTC)
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)
Cc: rrt@sc3d.org, tino.calancha@gmail.com, 30280@debbugs.gnu.org,
	Juri Linkov <juri@linkov.net>
To: Basil L. Contovounesios <contovob@tcd.ie>
Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon May 07 09:34:03 2018
Return-path: <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org>
Envelope-to: geb-bug-gnu-emacs@m.gmane.org
Original-Received: from lists.gnu.org ([208.118.235.17])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org>)
	id 1fFaep-0008T4-3T
	for geb-bug-gnu-emacs@m.gmane.org; Mon, 07 May 2018 09:34:03 +0200
Original-Received: from localhost ([::1]:44593 helo=lists.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org>)
	id 1fFagv-0005xz-Us
	for geb-bug-gnu-emacs@m.gmane.org; Mon, 07 May 2018 03:36:13 -0400
Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48212)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1fFagp-0005xh-BS
	for bug-gnu-emacs@gnu.org; Mon, 07 May 2018 03:36:08 -0400
Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1fFagk-0001Bi-F9
	for bug-gnu-emacs@gnu.org; Mon, 07 May 2018 03:36:07 -0400
Original-Received: from debbugs.gnu.org ([208.118.235.43]:44034)
	by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <Debian-debbugs@debbugs.gnu.org>)
	id 1fFagk-0001Bb-Ai
	for bug-gnu-emacs@gnu.org; Mon, 07 May 2018 03:36:02 -0400
Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1fFagk-0005rF-2P
	for bug-gnu-emacs@gnu.org; Mon, 07 May 2018 03:36:02 -0400
X-Loop: help-debbugs@gnu.org
Resent-From: Tino Calancha <tino.calancha@gmail.com>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@gnu.org
Resent-Date: Mon, 07 May 2018 07:36:01 +0000
Resent-Message-ID: <handler.30280.B30280.152567852022465@debbugs.gnu.org>
Resent-Sender: help-debbugs@gnu.org
X-GNU-PR-Message: followup 30280
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
Original-Received: via spool by 30280-submit@debbugs.gnu.org id=B30280.152567852022465
	(code B ref 30280); Mon, 07 May 2018 07:36:01 +0000
Original-Received: (at 30280) by debbugs.gnu.org; 7 May 2018 07:35:20 +0000
Original-Received: from localhost ([127.0.0.1]:51931 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces@debbugs.gnu.org>)
	id 1fFag3-0005qH-VV
	for submit@debbugs.gnu.org; Mon, 07 May 2018 03:35:20 -0400
Original-Received: from mail-pf0-f174.google.com ([209.85.192.174]:45692)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <tino.calancha@gmail.com>) id 1fFag2-0005pz-2c
	for 30280@debbugs.gnu.org; Mon, 07 May 2018 03:35:19 -0400
Original-Received: by mail-pf0-f174.google.com with SMTP id c10so22162248pfi.12
	for <30280@debbugs.gnu.org>; Mon, 07 May 2018 00:35:18 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; 
	h=from:to:cc:subject:references:date:in-reply-to:message-id
	:user-agent:mime-version;
	bh=cQEwMH4CfqGDh5YUPchZooXIy4IRTI22uxukLxTsAy0=;
	b=oBG0/DuQopZS2WDHwhhzMTv6wRvLnF9UZG5VFQ0QgvYdidC56QanQTN1J6dP1/sktg
	8rCmv0ZiyLsEMOZ7Ye118hQmL2jIvcXHmUA9sIDyP34k9GppopsxTwWtEsz3HLKI4LoF
	QKj+M37L3VTZKi+6Kv9jqD1vLqyt8B60sUYY4gMw0DGQPihPQ3HSMafT5rpPko0toPfb
	clxS+7lF80GxBkyNZAXjZ7uRmd/F9tHxHsk11Hz1Ax4A87pmoqp6h2CWbkbghY+KWJOm
	r3Hy99YvxYwiThEOHnDQYsxWzoJ4kpEYG7hHU/t8LAEH0GhDnr3E4rUv0yc5o1yYPGcN
	pYDA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=1e100.net; s=20161025;
	h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to
	:message-id:user-agent:mime-version;
	bh=cQEwMH4CfqGDh5YUPchZooXIy4IRTI22uxukLxTsAy0=;
	b=EjWjdx1gTdbvF8LbOyryVu66F60eSMBrc3IZpENqknIjJ/gcryoeWv77YR8H2JZiZr
	UNsHEpJ43cHmLmqp6d+DUxOjV4DxIA4rdhisV843LjYLI0SLCtfjXXehypB+J7xb+nZg
	mDyatlB3pNqqPR4fetrH17DUOkHXXhazmwqsbhXANFZSkRJlZ07QOtinY7Bul2DggfyC
	p5uDKH4ToSLj9U35efoRbCStGVkThV7c+bu+J6IkxB7YRHBZYWK5ArErYYJ2k4Grq5BF
	2xdnJ1dQCj+UsH8KfYBiRM3X5L9YwxuknaI8P8a3q6OLGXJqZZhmb+RWHJ0lHOhHaNM+
	xSwA==
X-Gm-Message-State: ALQs6tA7m8IYTY/7nlbkO8/LYUsYUGqoq9ObnkCJNEqIGcNbl3KVMMjV
	OHZTAt9Jy9wpQ5RiA3cyMEg=
X-Google-Smtp-Source: AB8JxZp0jYElC6zO+SMiKjo8bPN27EEm9JxXySnKBwh5x0IsIuZLnsysuLP86ualIhDcCWjsdIfd6A==
X-Received: by 10.98.110.136 with SMTP id j130mr35434936pfc.111.1525678512162; 
	Mon, 07 May 2018 00:35:12 -0700 (PDT)
Original-Received: from calancha-pc (228.225.128.101.dy.bbexcite.jp. [101.128.225.228])
	by smtp.gmail.com with ESMTPSA id
	g68sm44045382pfk.53.2018.05.07.00.35.09
	(version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
	Mon, 07 May 2018 00:35:11 -0700 (PDT)
In-Reply-To: <874ljkn4fb.fsf@tcd.ie> (Basil L. Contovounesios's message of
	"Sun, 06 May 2018 17:18:32 +0100")
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 208.118.235.43
X-BeenThere: bug-gnu-emacs@gnu.org
List-Id: "Bug reports for GNU Emacs,
	the Swiss army knife of text editors" <bug-gnu-emacs.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-gnu-emacs>,
	<mailto:bug-gnu-emacs-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-gnu-emacs/>
List-Post: <mailto:bug-gnu-emacs@gnu.org>
List-Help: <mailto:bug-gnu-emacs-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-gnu-emacs>,
	<mailto:bug-gnu-emacs-request@gnu.org?subject=subscribe>
Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org
Original-Sender: "bug-gnu-emacs"
	<bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org>
Xref: news.gmane.org gmane.emacs.bugs:146057
Archived-At: <http://permalink.gmane.org/gmane.emacs.bugs/146057>

"Basil L. Contovounesios" <contovob@tcd.ie> writes:

> I attach two patches.  The first tries to make this test succeed in
> accordance with the resulting bugfix.  The second suggests some
> simplifications to the logic in shell-command.  WDYT?

Basil, thank you for fixing that test!

Concerning the 2nd patch; it adds a bug when
`async-shell-command-buffer' is
confirm-rename-buffer
;; or
rename-buffer

Following is a recipe:

emacs -Q -eval "(setq async-shell-command-buffer 'rename-buffer)" \
-eval '(async-shell-command "while true; do echo foo; sleep 3;done")' \
-eval '(async-shell-command "while true; do echo bar; sleep 3;done")'

;; Now execute the following form:
(cdr 
  (delq nil
     (mapcar (lambda (b) (if (string-match "\*Async Shell Command\*" (buffer-name b)) (buffer-name b)))(buffer-list))))
=> nil
;; It shouldn't be nil: there must be 2 buffers matching '*Async Shell Command*'.
;; Here we are using 1 buffer for 2 shell processes.

;; The original code binds bname below so that we can create the new
;; buffer with the proper name:
(let* ((buffer (get-buffer-create
                (or output-buffer "*Async Shell Command*")))
       (bname (buffer-name buffer))
       (directory default-directory)
       proc)