GNU bug report logs - #40896
27.0.91; Moving point fails sometimes in shell-command

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Michael Albinus <michael.albinus@HIDDEN>; dated Mon, 27 Apr 2020 08:29:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 40896 <at> debbugs.gnu.org:


Received: (at 40896) by debbugs.gnu.org; 28 Jan 2022 15:34:28 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jan 28 10:34:28 2022
Received: from localhost ([127.0.0.1]:60261 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nDTGe-0007hy-4Q
	for submit <at> debbugs.gnu.org; Fri, 28 Jan 2022 10:34:28 -0500
Received: from quimby.gnus.org ([95.216.78.240]:43184)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1nDTGb-0007hg-UG
 for 40896 <at> debbugs.gnu.org; Fri, 28 Jan 2022 10:34:26 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org;
 s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:
 References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:
 Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:
 Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=ne69dVcuQd1f/Y0UuNvKpQXcO1wE+1iyMbn3UYzsiyU=; b=Jq3BuXrRmiqPNixYbn7nmVWd6g
 4AvorMw+p5FX+Mp/W2iw9kAAqTlRNYMbNWTwMzOOdx7N01vOSnk9dLzbamCdSr8a0DfL+bjy3DWR1
 8CcIE9i6h3vk9z9Ssm/YkPg9DQjVw24CclUOcjGfT3vJT9IzoDJLNKOqVxsfbV1HYgbg=;
Received: from [84.212.220.105] (helo=giant)
 by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>)
 id 1nDTGS-0003nN-WF; Fri, 28 Jan 2022 16:34:19 +0100
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: Michael Albinus <michael.albinus@HIDDEN>
Subject: Re: bug#40896: 27.0.91; Moving point fails sometimes in shell-command
References: <877dy1miy4.fsf@HIDDEN> <83v9ll3s68.fsf@HIDDEN>
 <87lfmgyfzy.fsf@HIDDEN> <837dxz3kww.fsf@HIDDEN>
 <87tv13wuzo.fsf@HIDDEN> <874kt113zx.fsf@HIDDEN>
 <83mu6qu13b.fsf@HIDDEN> <87zhaqwkem.fsf@HIDDEN>
X-Now-Playing: Phew's _Phew_: "Doze"
Date: Fri, 28 Jan 2022 16:34:16 +0100
In-Reply-To: <87zhaqwkem.fsf@HIDDEN> (Michael Albinus's message of "Sat, 02
 May 2020 15:12:17 +0200")
Message-ID: <871r0rg9hj.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview:  Michael Albinus <michael.albinus@HIDDEN> writes: > Almost.
 But it is not documented. Maybe we shall apply the appended > patch. And
 if shell-command-dont-erase-buffer is end-last-out with > output buffer not
 being the current one, the behavior is si [...] 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 40896
Cc: Eli Zaretskii <eliz@HIDDEN>, 40896 <at> debbugs.gnu.org,
 tino.calancha@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Michael Albinus <michael.albinus@HIDDEN> writes:

> Almost. But it is not documented. Maybe we shall apply the appended
> patch. And if shell-command-dont-erase-buffer is end-last-out with
> output buffer not being the current one, the behavior is simply
> wrong, see my previous analysis. At least *this* case must be fixed.

I've now applied the proposed patch, with some slight alterations.

And the parameters to these shell functions are very, very confusing.
At this point, perhaps it'd be better to write some new functions in
this area that have less weird parameters.  But fixing end-last-out
would also be nice.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#40896; Package emacs. Full text available.

Message received at 40896 <at> debbugs.gnu.org:


Received: (at 40896) by debbugs.gnu.org; 2 May 2020 13:12:39 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat May 02 09:12:38 2020
Received: from localhost ([127.0.0.1]:51517 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jUrwR-0002AV-36
	for submit <at> debbugs.gnu.org; Sat, 02 May 2020 09:12:38 -0400
Received: from mout.gmx.net ([212.227.17.22]:57475)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <michael.albinus@HIDDEN>) id 1jUrwP-0002AE-HD
 for 40896 <at> debbugs.gnu.org; Sat, 02 May 2020 09:12:26 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net;
 s=badeba3b8450; t=1588425138;
 bh=GLDFbV0HfHq3MxZCYlxUHOp7ORs3gOa7FuZoGju68o8=;
 h=X-UI-Sender-Class:From:To:Cc:Subject:References:Date:In-Reply-To;
 b=O4OHfkqJE4NyQaOCpAriDc7THviv4lw/ijmwOVmQZJgQN+WEIdTI1y1N93DUrLYLU
 mISe/QWjWHwWdMvh/cZrCbcx2cZm4CBISWRe7ldZs7to8KCXDu5TdGfJSy3qaZK26q
 Se831OEPNQtWnP+TTeTZikOo4ntEmWXCiOr2z5xg=
X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c
Received: from gandalf.gmx.de ([79.140.112.148]) by mail.gmx.com (mrgmx105
 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MrhUK-1iqGFa2t3k-00njt1; Sat, 02
 May 2020 15:12:18 +0200
From: Michael Albinus <michael.albinus@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#40896: 27.0.91; Moving point fails sometimes in shell-command
References: <877dy1miy4.fsf@HIDDEN> <83v9ll3s68.fsf@HIDDEN>
 <87lfmgyfzy.fsf@HIDDEN> <837dxz3kww.fsf@HIDDEN>
 <87tv13wuzo.fsf@HIDDEN> <874kt113zx.fsf@HIDDEN>
 <83mu6qu13b.fsf@HIDDEN>
Date: Sat, 02 May 2020 15:12:17 +0200
In-Reply-To: <83mu6qu13b.fsf@HIDDEN> (Eli Zaretskii's message of "Sat, 02 May
 2020 12:40:08 +0300")
Message-ID: <87zhaqwkem.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Provags-ID: V03:K1:wDLIOsySDZvnXSAQvJjIms80H9Nxtxwti2jUeE6vLtSw5k6n6i6
 hJZMrYKyBJ6aQ3yd9X0JBY82odVIdiFyrZU5BP0vYLn0w950EVie4ZHvunfopQwLwOwwA6+
 vAf7dFpesup5+X5vC1FXeA/vETLbYzBZffc+qNNjP0IGUovWDumcb9jMNsAMo7Ygq9lypLP
 0CeDAnHN2zt9bIpqNeKgQ==
X-Spam-Flag: NO
X-UI-Out-Filterresults: notjunk:1;V03:K0:CS8hCbzb0h0=:ivKRNnrz3XH30fQHq4rvht
 kV31lhPbDUc7hXKy8nPOA5AtwXKuveQ4kxr1hfz3nzlzwx3MjD2SyOFQPsO9wyrKpJGvxGufn
 PAHRVIGRsm0bQfRrhCGHX5UBU6rdLFMipAAdV2V7Hjl0ahmoq0q0kqi2sw05tlVfROs4EDkVG
 1pwRUFYeqs8KedmVJpkSEWiy9eTRDAqooc1o9LTSW+pcKUmo/8oz0VogyVK7KZ9Ag3xcELdhA
 pFaDQYnLBb7TDqPcTwm/w8yI6IeIl+4yRau1+FWuqGYM3O1V8WaWOit5cjzb2le4gXSuhnxfb
 TCOUqqaFN4n1z104BF7EGX7SnxAakXdd0nRs8ltCUBEWG+gHhrSsxRe73Pg/VlBfq7WWutvgn
 DB3SWMxEZgozUPS9HVysYlMLHpX/61WozNdUunb3rR9uc9Hqx+RkU3Wohf4t9cEkLbepFswd+
 2DNPsXKNxA8y3qqdrj9RmMSvjnvkYzLaz1y73XeFMQnvowvf78SuQ6I7l7Ileg2qr83jTgwjy
 FHw6OqLgMxDX00SeikGynguX2KF/5IfR3Brg0jF5GyPNgob/QaoiF1XiVrh5VVSIGjoXGK3fK
 tTLur04t4HhimbtWILtKgkk2bXGkev85pZ38VRrykQHgG+wDvi1Di7jgRgNMx1zHx6eRYDl/C
 Uww+GHPbHJzZwhA1ovqfgykA9luhBmNNMDkc6YP9YtmcR7kHOrfQRZGH1//ie1xoSfZSsR+0Y
 K/BzsrlgupgBlaoOa4RAYd2DaFDyVfbEiiqI5L9pvWQOxEHib+T+rE1OB4T3z6Awoh8BsOBC+
 Dv4txwP2uudrFArhHh1VcGj9uQ+jZTWISfBsVfYBnBYjQa5jzV8wZRD8Lhaj6MLQI2KvQFDTO
 b7vIq9a0rHmMeXfPXeF1mhad9T29689XO1kd2hQ/KkjN9VEa7cyb8rVEmK8azoqIJiM8fWwBM
 lyiijfzQ9a8loMICATg4aoEm9FKUevGBD7CXN3DYCRXoAs9D0LkMsXbR90BcUmyR9kTf53H9N
 AY+hmIqHDHTkLllO9tg9kPmENDgjX5pjhrPb58aMAVawHR366ZRXJd8bhu+sRxWwB+U5qYsQP
 k6K9BHCsTjh4w3Akf8IRFJOEWUzKAXnvvweosiNuEWfIa0kirljnIyd7sp0WoOIuuA/RBm91M
 3E0ucM/ZUeJILL8Y/mWDelxQTk6E6BJ6HfuPrafNqq5PQPY3yDGxC168b7FM0/sjcIOCSArcH
 cJELM6chKi2UZHzTO
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 40896
Cc: 40896 <at> debbugs.gnu.org, tino.calancha@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--=-=-=
Content-Type: text/plain

Eli Zaretskii <eliz@HIDDEN> writes:

Hi Eli,

>> In order to understand the situation better, I have enhanced my test
>> code to cover all different values of shell-command-dont-erase-buffer,
>> and whether the OUTPUT-BUFFER argument of shell-command is the current
>> buffer, or not. Here's the code:
>
> AFAIU, the use case of OUTPUT-BUFFER being different from the current
> buffer is meant for the case where subsequent commands accumulate the
> output in that buffer, which is why the output is appended in that
> case.
>
> Does what you see make more sense now?

Almost. But it is not documented. Maybe we shall apply the appended
patch. And if shell-command-dont-erase-buffer is end-last-out with
output buffer not being the current one, the behavior is simply
wrong, see my previous analysis. At least *this* case must be fixed.

Best regards, Michael.


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment
Content-Transfer-Encoding: quoted-printable

diff --git a/doc/emacs/misc.texi b/doc/emacs/misc.texi
index 47f195d0b2..ca3d52c36a 100644
=2D-- a/doc/emacs/misc.texi
+++ b/doc/emacs/misc.texi
@@ -846,6 +846,9 @@ Single Shell
 shell-command output.
 @end table

+In case the output buffer is not the current buffer, shell command
+output is appended at the end of this buffer.
+
 @node Interactive Shell
 @subsection Interactive Subshell

diff --git a/lisp/simple.el b/lisp/simple.el
index ab277c4e11..2f0626d96e 100644
=2D-- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -3606,6 +3606,9 @@ shell-command
 interactively when the prefix argument is given), insert the
 output in current buffer after point leaving mark after it.  This
 cannot be done asynchronously.
+If OUTPUT-BUFFER is a buffer or buffer name different from the
+current buffer, append the output in this buffer instead of
+inserting it at point.

 The user option `shell-command-dont-erase-buffer', which see, controls
 whether the output buffer is erased and where to put point after

--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#40896; Package emacs. Full text available.

Message received at 40896 <at> debbugs.gnu.org:


Received: (at 40896) by debbugs.gnu.org; 2 May 2020 09:40:39 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat May 02 05:40:38 2020
Received: from localhost ([127.0.0.1]:51270 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jUodE-0003Do-2t
	for submit <at> debbugs.gnu.org; Sat, 02 May 2020 05:40:38 -0400
Received: from eggs.gnu.org ([209.51.188.92]:34294)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1jUodD-0003Da-D9
 for 40896 <at> debbugs.gnu.org; Sat, 02 May 2020 05:40:23 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:54136)
 by eggs.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <eliz@HIDDEN>)
 id 1jUod7-00046q-7w; Sat, 02 May 2020 05:40:17 -0400
Received: from [176.228.60.248] (port=3307 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1jUod6-0002h4-KW; Sat, 02 May 2020 05:40:17 -0400
Date: Sat, 02 May 2020 12:40:08 +0300
Message-Id: <83mu6qu13b.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Michael Albinus <michael.albinus@HIDDEN>
In-Reply-To: <874kt113zx.fsf@HIDDEN> (message from Michael Albinus on Thu, 30
 Apr 2020 15:45:38 +0200)
Subject: Re: bug#40896: 27.0.91; Moving point fails sometimes in shell-command
References: <877dy1miy4.fsf@HIDDEN> <83v9ll3s68.fsf@HIDDEN>
 <87lfmgyfzy.fsf@HIDDEN> <837dxz3kww.fsf@HIDDEN>
 <87tv13wuzo.fsf@HIDDEN> <874kt113zx.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 40896
Cc: 40896 <at> debbugs.gnu.org, tino.calancha@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

> From: Michael Albinus <michael.albinus@HIDDEN>
> Cc: 40896 <at> debbugs.gnu.org,  tino.calancha@HIDDEN
> Date: Thu, 30 Apr 2020 15:45:38 +0200
> 
> In order to understand the situation better, I have enhanced my test
> code to cover all different values of shell-command-dont-erase-buffer,
> and whether the OUTPUT-BUFFER argument of shell-command is the current
> buffer, or not. Here's the code:

AFAIU, the use case of OUTPUT-BUFFER being different from the current
buffer is meant for the case where subsequent commands accumulate the
output in that buffer, which is why the output is appended in that
case.

Does what you see make more sense now?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#40896; Package emacs. Full text available.

Message received at 40896 <at> debbugs.gnu.org:


Received: (at 40896) by debbugs.gnu.org; 30 Apr 2020 13:45:51 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Apr 30 09:45:51 2020
Received: from localhost ([127.0.0.1]:45522 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jU9Vf-00048n-EL
	for submit <at> debbugs.gnu.org; Thu, 30 Apr 2020 09:45:51 -0400
Received: from mout.gmx.net ([212.227.17.22]:41771)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <michael.albinus@HIDDEN>) id 1jU9Vd-00048a-MT
 for 40896 <at> debbugs.gnu.org; Thu, 30 Apr 2020 09:45:50 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net;
 s=badeba3b8450; t=1588254339;
 bh=1bqqIQL5FsPf7A8jl+5A2IBW5GP0qc+r88zzmiCs/BI=;
 h=X-UI-Sender-Class:From:To:Cc:Subject:References:Date:In-Reply-To;
 b=fn2GhwaZCWU88fbXMO83p+N9LjbxPmoVWwV9SSDCU3Jz4puhTfvIxXi7Vd1mMT+Gp
 DVxJQ5zBvyfXzmGF0/dzwz2+5Kh17Xpc/i5oMHChhmLno0/0KO5CN5B4dZp8Fl54qC
 M8OkZNZOd+GK8sXcjZqmRuXDKeXQnYcXD+7XHhvw=
X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c
Received: from gandalf.gmx.de ([212.86.54.201]) by mail.gmx.com (mrgmx104
 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MbzyJ-1itRe82uyt-00dZWW; Thu, 30
 Apr 2020 15:45:39 +0200
From: Michael Albinus <michael.albinus@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#40896: 27.0.91; Moving point fails sometimes in shell-command
References: <877dy1miy4.fsf@HIDDEN> <83v9ll3s68.fsf@HIDDEN>
 <87lfmgyfzy.fsf@HIDDEN> <837dxz3kww.fsf@HIDDEN>
 <87tv13wuzo.fsf@HIDDEN>
Date: Thu, 30 Apr 2020 15:45:38 +0200
In-Reply-To: <87tv13wuzo.fsf@HIDDEN> (Michael Albinus's message of "Tue, 28
 Apr 2020 16:22:19 +0200")
Message-ID: <874kt113zx.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Provags-ID: V03:K1:rafodoqAaVBM7zIzX0CBd+AWg2twRBb7J5hwYW+uJ4OxE8HscCl
 cQ/Uhp/8nIIkvj4pExiM/6iqHQxRlFCbg5yotMmNnUxGNanNfZBBDY+bcHVf/YhRDeYBQku
 nGxAke8JPjYvzm4GSlIUcD4tTlmJfX4Ngzlpv0JxSTzQn0rt8sisQSQ+XeU60QRpfZrYUXa
 GQvuC0zUwYRUJ7mswyUUA==
X-Spam-Flag: NO
X-UI-Out-Filterresults: notjunk:1;V03:K0:yff2P+viOhA=:z4WrfOh41l1R0QbHth9Fgp
 TOf3IoktbCbKhPL3Z18c7NDoQcUkKrCYkqFEiIiFr0/u3IJedvlw0cNKSWCR74YcDnRKAP3mL
 K8bOgdVkl1Vkn1Io0yhiarrVPrijhJrBwhwEZg/uylLpTLScz2z5qD2rA3xNGY2kc+pwOjg1I
 tKPrNPxwxlYV2E4nc4KELVISH64Y0CbWDO7TX+QfWSds4cDrpH6dJT2+vjp6+GZ04ZUEXvevq
 F9wQxQvqEm2hWBgslf2IaJpH/7Hqe1ieNCZ13Lc+aUggA02HO7qqXtKFY5GfKra+rhxDkRhed
 vB8hTIw6sH+Uom8VEqpN1V2fsHv7qxB2XiZwfRnGH3DpbghPsmPHxPDLlIdVrpImQua0cqgHx
 TKaoW2WCzfSxLu1kqndgVpYHZjGwHRvcI+Tfw86+XS0iVYBfbRpn1Og1aNH9mxw0ZEiqmVz6J
 JUiMT8ZQEMojcpOAnqvQ0FTqEGExdId9g0K7hqF8WSGip6Z38Ro2c01LbWhqYHOBIpOBFTEgp
 lY72VQZn+/qYSd0Rod3LwB75yZjapKzeD5niJrVqZPcRcTsX3/BJCN6ejtMdmFTlbeAlMx9Uc
 KRewFYG2xjP6Q60KsFUf122Y69m6K2u+9SE5fsyvG5tDTSEgfy5+uE0rFG/2Jd6CwbAwPgHcV
 8JpIxPK/WJx4Kfn+mjktb1wmlUPOAPgO5HfbRo7xqJ/7LH26e1waXAfluKV00UllmzmexT7Ud
 DK5LMUZnzjYGOg0UpRI4dAGee0OS1D7doj7oMXQsgfFOuzpAI5xTPXVj8IXsqTeFKooeY5P/D
 sxXqOvuMi+tRjl6dxJoNFJoMLHk1VTijjJ1gxgvklB4XwgsjBKzt0wvLTgfmkNfGuLGriS79Y
 RxNJ0AUq+Zg+V7/OqMFLW1hV/SxRLSBpsq+RmeTUBfIy7CVbA6GmCL5uwgPdl8Z8Z4ezuT08w
 JdyHkqN8KaZe3G2y6MDbLvtA1gduFWpo3BMEuDjaSKhhID651Lc1BoSgjt9mlljrTSlK+h+dU
 R2NnSj/V0ul2Us4RgY1TDMITSRdRDxeyZgbilnp2p9QNtIEUW7fnUcQ6dqWn+VjsMxkxSiXyl
 yCXe94BE0pWEDr13rw4KnXDpN8ecMmhfqmpuXINq9UenxgGWgK5iaqKOnlkepw/mYv08PhI71
 zTVMEtP8HNtYMl0iQXzyBk6pXVI8I52P1aMC1Sp0R16zcrtYoOFnaE8XUTH7WgR++Qlc0z+1K
 wBCJRbzypFLkgboCR
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 40896
Cc: 40896 <at> debbugs.gnu.org, tino.calancha@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

Michael Albinus <michael.albinus@HIDDEN> writes:

Hi Eli,

> Maybe all of this is irrelevant in real life. But I'm fighting with
> Tramp, in order to let its shell-command implementation behave like in
> the local case.

In order to understand the situation better, I have enhanced my test
code to cover all different values of shell-command-dont-erase-buffer,
and whether the OUTPUT-BUFFER argument of shell-command is the current
buffer, or not. Here's the code:

--8<---------------cut here---------------start------------->8---
(progn
  (message "   s-c-d-e-b current-buffer buffer-string point")
  (message "===============================================")

  (let ((default-directory temporary-file-directory)
	buffer)
    ;; These are the possible values of `shell-command-dont-erase-buffer'.
    ;; `random' is taken as non-nil value without special meaning.
    (dolist (shell-command-dont-erase-buffer
	     '(nil erase beg-last-out end-last-out save-point random))
      ;; `shell-command' might work over the current buffer, or not.
      (dolist (current '(t nil))
	(with-temp-buffer
	  ;; We insert the string "foobar" into an empty buffer.
	  ;; Point is set between "foo" and "bar".
	  (setq buffer (current-buffer))
	  (insert "foobar")
	  (goto-char (- (point) 3))

	  ;; Apply `shell-command'.  It shall output the string
	  ;; "bazz".  Messages in the *Messages* buffer are
	  ;; suppressed.
          (let (message-log-max)
	    (if current
		(shell-command "echo -n bazz" (current-buffer))
	      (with-temp-buffer (shell-command "echo -n bazz" buffer))))

	  ;; Print result.
	  (message
	   "%12s %14s %13s %5d"
	   shell-command-dont-erase-buffer current (buffer-string) (point))))
      (message "-----------------------------------------------"))))
--8<---------------cut here---------------end--------------->8---

In a temporary buffer, the string "foobar" is inserted. Point is set
between "foo" and "bar". Then, shell-command is called, which outputs
the string "bazz".

The result can be seen in the *Messages* buffer. Honestly, I cannot say
whether this is conform to the docstring of shell-command (I have read
it several times), because it describes too many cases, and it is not
always clear how the combination of the cases is meant. But at least, I
would say the results look inconsistent.

A first observation is, that the output is inserted at (point) if
OUTPUT-BUFFER is the current buffer, and it is appended at (point-max)
if OUTPUT-BUFFER is not the current buffer. The fact, that the output is
appended at the end of the buffer, isn't mentioned anywhere in the doc AFAICT.

Now, let's see the details:

--8<---------------cut here---------------start------------->8---
   s-c-d-e-b current-buffer buffer-string point
===============================================
         nil              t    foobazzbar     4
         nil            nil          bazz     5
--8<---------------cut here---------------end--------------->8---

shell-command-dont-erase-buffer is nil. In case OUTPUT-BUFFER is the
current one, "bazz" is inserted at (point), and (point) is
preserved. Fine. In case OUTPUT-BUFFER is not the current one, the
buffer is erased, which as OK. However, (point) is NOT preserved, but
moved to the end of the shell command output. That doesn't sound right.

--8<---------------cut here---------------start------------->8---
       erase              t          bazz     1
       erase            nil          bazz     5
--8<---------------cut here---------------end--------------->8---

shell-command-dont-erase-buffer is erase. In both cases of
OUTPUT-BUFFER, the buffer is erased (as expected), but again, in case
OUTPUT-BUFFER is not the current one, (point) is moved after the shell
command output.

--8<---------------cut here---------------start------------->8---
beg-last-out              t    foobazzbar     4
beg-last-out            nil    foobarbazz     7
--8<---------------cut here---------------end--------------->8---

shell-command-dont-erase-buffer is beg-last-out. Shell command output is
inserted in case OUTPUT-BUFFER is the current one, and it is appended
otherwise. (point) is moved in both cases to the begin of the shell
command output, which is consistent, but I don't still see why the
output is either inserted, or appended.

--8<---------------cut here---------------start------------->8---
end-last-out              t    foobazzbar     4
end-last-out            nil    foobazzbar    11
--8<---------------cut here---------------end--------------->8---

shell-command-dont-erase-buffer is end-last-out. In case OUTPUT-BUFFER
is the current one everything looks as expected. But in the other case,
OUTPUT-BUFFER is not the current buffer, the result is irritating. Shell
command is inserted in this case at (point), and (point) is not moved to the
end of the shell command output, but to the end of the buffer. Strange!

--8<---------------cut here---------------start------------->8---
  save-point              t    foobazzbar     4
  save-point            nil    foobarbazz     4
--8<---------------cut here---------------end--------------->8---

shell-command-dont-erase-buffer is save-point. And indeed, (point) is
saved in both cases. But again, shell command output is appended at the
end of the buffer, instead of being inserted at (point).

--8<---------------cut here---------------start------------->8---
      random              t    foobazzbar     4
      random            nil    foobazzbar    11
--8<---------------cut here---------------end--------------->8---

shell-command-dont-erase-buffer is random, which stands for a non-nil
value which has no special meaning. It behaves like end-last-out. I
don't know whether this is intended; if yes, it shall be documented.

Best regards, Michael.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#40896; Package emacs. Full text available.

Message received at 40896 <at> debbugs.gnu.org:


Received: (at 40896) by debbugs.gnu.org; 28 Apr 2020 14:22:31 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Apr 28 10:22:31 2020
Received: from localhost ([127.0.0.1]:41009 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jTR83-0002Ov-E5
	for submit <at> debbugs.gnu.org; Tue, 28 Apr 2020 10:22:31 -0400
Received: from mout.gmx.net ([212.227.15.19]:33393)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <michael.albinus@HIDDEN>) id 1jTR81-0002Oe-6f
 for 40896 <at> debbugs.gnu.org; Tue, 28 Apr 2020 10:22:29 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net;
 s=badeba3b8450; t=1588083742;
 bh=KiZ2lkNoByOP5VlyCnPTYjTvIk0nCF0sGt3EJ0UMmC8=;
 h=X-UI-Sender-Class:From:To:Cc:Subject:References:Date:In-Reply-To;
 b=VkxXSvEVax1FNnvGUFTVN06hln9yymIVC40JqeYYt26Jy1+y5w3x17z26+K5gB2Zz
 3xVaiEhc2dOWJrLjbDl9wDz0bh6xAugrpIx4nvuAIAv5Q+GKbGljG1sdjxOgqjsD6i
 hCkuzZ8n5TqyifVaBot6sJCsRq5i6D9EYwZzIe20=
X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c
Received: from gandalf.gmx.de ([212.86.41.135]) by mail.gmx.com (mrgmx004
 [212.227.17.190]) with ESMTPSA (Nemesis) id 1M6DWs-1jVbuf3flg-006cy6; Tue, 28
 Apr 2020 16:22:22 +0200
From: Michael Albinus <michael.albinus@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#40896: 27.0.91; Moving point fails sometimes in shell-command
References: <877dy1miy4.fsf@HIDDEN> <83v9ll3s68.fsf@HIDDEN>
 <87lfmgyfzy.fsf@HIDDEN> <837dxz3kww.fsf@HIDDEN>
Date: Tue, 28 Apr 2020 16:22:19 +0200
In-Reply-To: <837dxz3kww.fsf@HIDDEN> (Eli Zaretskii's message of "Tue, 28 Apr
 2020 14:32:47 +0300")
Message-ID: <87tv13wuzo.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Provags-ID: V03:K1:1qsc+xH8bWhVCzJuj44WyzUOt6p1H0Kgye2bqPMs6hu4fP5KTlL
 BLq0LeqQo4RRevVbArUEw7bm82g7tDrIQIYBXh5MkQG+61RndDAYePhQfJPGLDm9CXqe3AQ
 6hxIIY0il6sZqI6FQ4MjQ2Nw+hUeiA9iH+VHYGGul+z0op3Rzt4JdlKCPK9yFJNtV8oRHT2
 0aFoskc+c4Hr6QOoopkbw==
X-Spam-Flag: NO
X-UI-Out-Filterresults: notjunk:1;V03:K0:uHeXBxJO7Rk=:5WlgnWhOJY7pihihOUm5h1
 vC8QvBp+qfQhAOYctqvcPNItNtaSyoLLUtLnf6AYSeYuihpcdR8phbj38SwJZiVIrx3OOdfB0
 F0RcuNp2ThCAFDpFkVZlFZUG2F9oGeWP7qEXxov8jvip0NgFiXVGh6MJ85oQDshMI0CAg6Khh
 yMeD01/EtAUEIJtiGCImF27IQCjGcFgfHwahXHru2i1Ef9RKP8aAV+mwY605ahj4YCZl9l7qx
 M7+28nubQ2c9TZ/kd6FGX5D1Vmlqf7vfO08VbqIldHUlMzZuAlYKRzm6kvm+PqHv8pX1ri/wD
 Mmzk7nNJ8V1cLNaUi4fxtaxN1SlDrE0DwxvOktbY+Xs4ogX8dhluQRArIh/V6Y7y/y9J2BzwU
 mvLFk21ann3rzmRb7Ke9jFlOtvy+s+hBPWxXwa1PG5D/eHuj4CIXdU2xQcsNcaBXJv/1XqByX
 73hy3c2/DH6LUY0KAtNsK00HHj3Ldq74Q2ScBT1GnkWfdzGId8SDXW0a2/mwAEEx+uIaiMOgP
 bD4cpAGqGmsybZgNj8uqQvPkyuzpU2yr3doWJNR9hTxlSoOrML1RW28+FOOR0NV6JnXNvKJV5
 sQu9VapVoByEszNL4b/x0mnt/ZfAH/B+wjFXxoK5jGvV7hcMzsXOavIrjDEOIGBA+4NtxEWRN
 stKIAe4YX9fp79TO8okFklKRe5ip9/qk1QvQwNUuUSY+so6bbJGEwFKWxmguZZDCHTq5r6Ikj
 94nnGypiufazkNgD/AtFfIWBa5U9hp3RK5L9vXrGOvPfxOtFAiaRKEdKlwuGthn/Fc9xQ34RM
 C0JXBkXK67EXdk01iSoPUigrqP+XQNW88Pb6OI+6lqPPVKG+bRws7mdX4mt84t+E1aHtVUhNu
 Q9YfrkKIo3LckQT4w/0fDwI1qcbGk1VgbfEkbWn5G0jY5wXnMEAySyaOyTG8NhgOdbZ5Rqz7E
 0GwOHr0vWzOTGsQ9D8uj4aXUyXc5p7TnwOywHP1OOoFr1aGK3REx74zRBavwbO26DpxIdNwPh
 umGtF9mX4MG/An1E9fvaRMR/AB/ema/gLICwLN1F6CAhL388OennZ1gewedfA1jQWxnCGfrQD
 5TCzzeGLOsFjrsdgjAyuO9x+mJi05T0bymYwyNyo8kck+lIy3Lsa8M63aEyXGVAaLmMPHeHB7
 B4SAuijPRDgOU0SAPia3Bti2KXeUL8aW5ye5lmsbGdv/ztWnqHjkoSyTX7m7sdk6SE9chA90P
 HFCDOL4nfWF2oPdQu
X-Spam-Score: 0.3 (/)
X-Debbugs-Envelope-To: 40896
Cc: 40896 <at> debbugs.gnu.org, tino.calancha@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

Eli Zaretskii <eliz@HIDDEN> writes:

>> From: Michael Albinus <michael.albinus@HIDDEN>
>> Cc: 40896 <at> debbugs.gnu.org,  tino.calancha@HIDDEN
>> Date: Mon, 27 Apr 2020 19:50:57 +0200
>>=20
>> Hmm, maybe I have been biased with the Tramp behaviour. But still,
>> there's suspicious behaviour with shell-command:
>
> I think these also behave as intended.  In general, all the non-nil
> values of shell-command-dont-erase-buffer are set up to accumulate
> output of several consecutive commands.  Once again, perhaps the
> documentation needs to be clarified.

Whatever shell-command-dont-erase-buffer says, shell-command output in
non-interactive mode shall be inserted at point, possibly after erasing
the buffer first. The first example I gave shows that this doesn't happen:

--8<---------------cut here---------------start------------->8---
;; Don't erase if the buffer is not the current one and
;; `shell-command-dont-erase-buffer' is set to `save-point'.
;; Check point.
(let ((default-directory temporary-file-directory)
      (shell-command-dont-erase-buffer 'save-point)
      buffer point)
  (with-temp-buffer
    (setq buffer (current-buffer))
    (insert "foobar")
    (goto-char (- (point-max) 3))
    (setq point (point))
    (cl-assert (string-equal "foobar" (buffer-string)))
    (cl-assert (string-equal "foo" (buffer-substring (point-min) (point))))
    (cl-assert (string-equal "bar" (buffer-substring (point) (point-max))))
    (cl-assert (=3D (point) (- (point-max) 3)))
    (with-temp-buffer
      (shell-command "echo baz" buffer))
    ;; The shell command output should be inserted between "foo" and "bar".
    (cl-assert (string-equal "foobaz\nbar" (buffer-string)) 'show-args)
    (cl-assert (=3D point (point)) 'show-args)))
--8<---------------cut here---------------end--------------->8---

Note that in case the buffer the output has to be inserted in is the
current one, this test succeeds. You can achieve this be replacing
'(with-temp-buffer (shell-command "echo baz" buffer))' by
'(shell-command "echo baz" buffer)'. This is inconsistent, isn't it? And
I haven't found any indication, that in case the buffer is not the
current one, shell command is inserted at the end of the buffer instead
of being inserted at point.

The second test case I've shown indicates, that a random value of
shell-command-dont-erase-buffer (I use the symbol 'random' here) doesn't
behave as expected. The docstring of that user option is not clear to
me: could it be, that the special symbols 'beg-last-out', 'end-last-out'
and =E2=80=98save-point=E2=80=99 indicate only setting the point if the buf=
fer is the
current one? Why that? It's inconsistent in my eyes.

Maybe all of this is irrelevant in real life. But I'm fighting with
Tramp, in order to let its shell-command implementation behave like in
the local case.

Best regards, Michael.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#40896; Package emacs. Full text available.

Message received at 40896 <at> debbugs.gnu.org:


Received: (at 40896) by debbugs.gnu.org; 28 Apr 2020 11:33:18 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Apr 28 07:33:18 2020
Received: from localhost ([127.0.0.1]:39173 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jTOUI-0006H9-Bm
	for submit <at> debbugs.gnu.org; Tue, 28 Apr 2020 07:33:18 -0400
Received: from eggs.gnu.org ([209.51.188.92]:47740)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1jTOUG-0006Gv-Ee
 for 40896 <at> debbugs.gnu.org; Tue, 28 Apr 2020 07:33:16 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:56883)
 by eggs.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <eliz@HIDDEN>)
 id 1jTOUB-0000Oo-48; Tue, 28 Apr 2020 07:33:11 -0400
Received: from [176.228.60.248] (port=3161 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1jTOU8-0004z9-2B; Tue, 28 Apr 2020 07:33:10 -0400
Date: Tue, 28 Apr 2020 14:32:47 +0300
Message-Id: <837dxz3kww.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Michael Albinus <michael.albinus@HIDDEN>
In-Reply-To: <87lfmgyfzy.fsf@HIDDEN> (message from Michael Albinus on Mon, 27
 Apr 2020 19:50:57 +0200)
Subject: Re: bug#40896: 27.0.91; Moving point fails sometimes in shell-command
References: <877dy1miy4.fsf@HIDDEN> <83v9ll3s68.fsf@HIDDEN>
 <87lfmgyfzy.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 40896
Cc: 40896 <at> debbugs.gnu.org, tino.calancha@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Michael Albinus <michael.albinus@HIDDEN>
> Cc: 40896 <at> debbugs.gnu.org,  tino.calancha@HIDDEN
> Date: Mon, 27 Apr 2020 19:50:57 +0200
> 
> Hmm, maybe I have been biased with the Tramp behaviour. But still,
> there's suspicious behaviour with shell-command:

I think these also behave as intended.  In general, all the non-nil
values of shell-command-dont-erase-buffer are set up to accumulate
output of several consecutive commands.  Once again, perhaps the
documentation needs to be clarified.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#40896; Package emacs. Full text available.

Message received at 40896 <at> debbugs.gnu.org:


Received: (at 40896) by debbugs.gnu.org; 27 Apr 2020 17:51:11 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Apr 27 13:51:11 2020
Received: from localhost ([127.0.0.1]:38053 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jT7uQ-0003jl-Rp
	for submit <at> debbugs.gnu.org; Mon, 27 Apr 2020 13:51:11 -0400
Received: from mout.gmx.net ([212.227.17.20]:46609)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <michael.albinus@HIDDEN>) id 1jT7uM-0003jA-Ll
 for 40896 <at> debbugs.gnu.org; Mon, 27 Apr 2020 13:51:09 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net;
 s=badeba3b8450; t=1588009859;
 bh=oUA2ik3RJ4wwS+a6eWe/foFQEdSnFRdePdg3TJ3J7oE=;
 h=X-UI-Sender-Class:From:To:Cc:Subject:References:Date:In-Reply-To;
 b=bJ6zOJ2uHpssb2ry/d8lYxndQf0EOHzdsk17Ck912MnXtCzf7iN8ILY7JC9l/Y17o
 Xi502cXuGZzM8dgXciTskajVjUBAffuh6wbaG6ap8yxoZNutiVavtLU6LdxJAJXrx+
 5gB7pS5IskNl5ZUaTYdTKGxAVTMvakpZLB1UDY9Y=
X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c
Received: from gandalf.gmx.de ([212.86.61.231]) by mail.gmx.com (mrgmx105
 [212.227.17.168]) with ESMTPSA (Nemesis) id 1Mr9G2-1io2Gz0s7i-00oEPE; Mon, 27
 Apr 2020 19:50:59 +0200
From: Michael Albinus <michael.albinus@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#40896: 27.0.91; Moving point fails sometimes in shell-command
References: <877dy1miy4.fsf@HIDDEN> <83v9ll3s68.fsf@HIDDEN>
Date: Mon, 27 Apr 2020 19:50:57 +0200
In-Reply-To: <83v9ll3s68.fsf@HIDDEN> (Eli Zaretskii's message of "Mon, 27 Apr
 2020 17:43:43 +0300")
Message-ID: <87lfmgyfzy.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Provags-ID: V03:K1:1Lv1GE111BK+4jf8qv+w/Keits81tO0kgizGsbcxN2Rh07GlXd3
 NJHPmwHMWeokOpMk3LG3dC6pQHYtDlvDMcQysCjyHCqZHUpEhKHiFYU9Dyo4XuYjUqOA4lz
 CYw5/LJH52San3jiMZTW84TNiWlpZHAyL1jmM3aiDri6pOqw4Ox2BVrxEbd6uqyoY1yPqZQ
 oJQviB15BEQNZOrZhMnCw==
X-Spam-Flag: NO
X-UI-Out-Filterresults: notjunk:1;V03:K0:QHKsilRFFdU=:M4ax3+L7cMihOEQlh0tEcH
 QCCmlz4eP+rH7D4APmCivOpA0QXPgGf8cQrQoT74pnxhqYgRTN2DEjFOVV9hwsiL12FYLGQSJ
 VXczhMRdPf5SkPaM8Qth/y7PfH8jix4JIvNlzcQ/n8OHbju4IN85dSA+QQMVvEwp3WKFTs0Ht
 bq044eXobzTfMes2D9hBKRxP9E1GM36An69vj0AOWjnoLmf5bcC8u9G86phXOchaNZDho1Lvc
 etcCzC8NlGsc927+H3DtjLZ4QVusIUDBvcdaaL43RXqW6bFUTcuYWboVlI49FcUOXhfsp8Vg0
 +7Rkarfw+LAFU5vrDgj3Xrwy3+6ByTxVR78S4lXnI48aweS7Ozx3K+n6LuAyXcUqLTYoeoH6M
 LcqhfPsY/Fsv6uV2aHwCHCTh6t1R6npZUxKMadfaE6tIJoXVLVX2SFy1j8KqhDtL++D8SCVzA
 ywzYA4rq7p0/dADlE89u7Ak2uIGtZxMSjIetRWkV2yZFdmE2HWhbpr12w+OMsJLDdKjNYX/Ay
 xK+SOefEMh7xlPenLxHzfZOp+3oPjXUJqRkO6xbjwMH7nD7T5EJacbzOLHSfIekuh48rO1pE7
 GBVWiL152grE6KMstR2WE6wzJEcm7LOxlA2vKFfItawMLvSprHZlkPxmZUKq49pFT6TqkGHek
 UbPAqe6/6O5hnZYkufPvds3LNYwlc3gkoFphsIbyFeaD8qfeRSznigwQFebsNavSgV8Ii4NPI
 KtMGYeA2pj8EAOawH5hpMUZEYlep6IOntteVpfsAbRwp4kLPDfvO74csElWzKre0ZnSaOAnep
 keMKTdNsZhhR0OASphUDyb/cOc2v3nIFFVUHRa8Q6a7VaVDmz65tMFCv21l84KEB9KKoPMauc
 E/nAhaivyod3M8f3PT4lTzvR4yx/kFp1unkqqo5LWI5NxW0N6IlQJr7ec3iTMB7a+ofN+yKmm
 t+er7RmFiQpOkGwU4vQ/paRVAkfnUYgrPHEYo2JaPzSAd1WqzIZC67oydPR5rQCTulPrfJrKR
 vyBOn8psKQfqplg4caVPlX/LK4Lfe9ZZRuYHWP3XIP9Zq7W+xS45Zr4CPVOvGSDzxhqVYdOe2
 lT5KKd51+HrvT8BdIE0NB6fkCCTE5JIMqzoDQV8RrxzxZPLfQVXLLAVqxH9hnmXNi7umcWq83
 HtnqySfhklwm+/qqX5EzVxyTTKknB+stsgVBLlUeYjSIyBfRaV5iq+Ccl4fkf0Oh+1kwn6E7x
 FvRbGyNZsmWhIn/dr
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 40896
Cc: 40896 <at> debbugs.gnu.org, tino.calancha@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

Eli Zaretskii <eliz@HIDDEN> writes:

Hi Eli,

>> `shell-command' shall move the point after the output of the command,
>> unless indicated otherwise by `shell-command-dont-erase-buffer'.
>
> Which part(s) of the documentation caused this interpretation?  AFAIK,
> the truth is that the output is inserted at point (i.e. point is left
> _before_ the output), unless indicated otherwise by
> shell-command-dont-erase-buffer.  So if something we say tricks you to
> think otherwise, we need to fix that text.

Hmm, maybe I have been biased with the Tramp behaviour. But still,
there's suspicious behaviour with shell-command:

--8<---------------cut here---------------start------------->8---
;; Don't erase if the buffer is not the current one and
;; `shell-command-dont-erase-buffer' is set to `save-point'.
;; Check point.
(let ((default-directory temporary-file-directory)
      (shell-command-dont-erase-buffer 'save-point)
      buffer point)
  (with-temp-buffer
    (setq buffer (current-buffer))
    (insert "foobar")
    (goto-char (- (point-max) 3))
    (setq point (point))
    (cl-assert (string-equal "foobar" (buffer-string)))
    (cl-assert (string-equal "foo" (buffer-substring (point-min) (point))))
    (cl-assert (string-equal "bar" (buffer-substring (point) (point-max))))
    (cl-assert (= (point) (- (point-max) 3)))
    (with-temp-buffer
      (shell-command "echo baz" buffer))
    ;; The shell command output should be inserted between "foo" and "bar".
    (cl-assert (string-equal "foobaz\nbar" (buffer-string)) 'show-args)
    (cl-assert (= point (point)) 'show-args)))

;; Don't erase if the buffer is not the current one and
;; `shell-command-dont-erase-buffer' is set to a non-nil value.
;; Point should be before shell command output.
(let ((default-directory temporary-file-directory)
      (shell-command-dont-erase-buffer 'random)
      buffer point)
  (with-temp-buffer
    (setq buffer (current-buffer))
    (insert "foobar")
    (setq point (point))
    (cl-assert (string-equal "foobar" (buffer-string)))
    (cl-assert (= (point) (point-max)))
    (with-temp-buffer
      (shell-command "echo baz" buffer))
    (cl-assert (string-equal "foobarbaz\n" (buffer-string)) 'show-args)
    ;; Point should be the same.
    (cl-assert (= point (point)) 'show-args)))
--8<---------------cut here---------------end--------------->8---

Unless I still misunderstand something, these cases should be checked. I
will work on Tramp when clarified.

> Thanks.

Best regards, Michael.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#40896; Package emacs. Full text available.

Message received at 40896 <at> debbugs.gnu.org:


Received: (at 40896) by debbugs.gnu.org; 27 Apr 2020 14:43:57 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Apr 27 10:43:57 2020
Received: from localhost ([127.0.0.1]:37778 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jT4zF-0008S6-LK
	for submit <at> debbugs.gnu.org; Mon, 27 Apr 2020 10:43:57 -0400
Received: from eggs.gnu.org ([209.51.188.92]:54584)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1jT4zE-0008Rt-0A
 for 40896 <at> debbugs.gnu.org; Mon, 27 Apr 2020 10:43:56 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:36888)
 by eggs.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <eliz@HIDDEN>)
 id 1jT4z7-0003aN-EL; Mon, 27 Apr 2020 10:43:49 -0400
Received: from [176.228.60.248] (port=2381 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1jT4z5-00081c-Rt; Mon, 27 Apr 2020 10:43:48 -0400
Date: Mon, 27 Apr 2020 17:43:43 +0300
Message-Id: <83v9ll3s68.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Michael Albinus <michael.albinus@HIDDEN>
In-Reply-To: <877dy1miy4.fsf@HIDDEN> (message from Michael Albinus on Mon, 27
 Apr 2020 10:28:03 +0200)
Subject: Re: bug#40896: 27.0.91; Moving point fails sometimes in shell-command
References: <877dy1miy4.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 40896
Cc: 40896 <at> debbugs.gnu.org, tino.calancha@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Michael Albinus <michael.albinus@HIDDEN>
> Date: Mon, 27 Apr 2020 10:28:03 +0200
> Cc: Tino Calancha <tino.calancha@HIDDEN>
> 
> `shell-command' shall move the point after the output of the command,
> unless indicated otherwise by `shell-command-dont-erase-buffer'.

Which part(s) of the documentation caused this interpretation?  AFAIK,
the truth is that the output is inserted at point (i.e. point is left
_before_ the output), unless indicated otherwise by
shell-command-dont-erase-buffer.  So if something we say tricks you to
think otherwise, we need to fix that text.

Thanks.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#40896; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 27 Apr 2020 08:28:18 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Apr 27 04:28:18 2020
Received: from localhost ([127.0.0.1]:35593 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jSz7h-00009c-T8
	for submit <at> debbugs.gnu.org; Mon, 27 Apr 2020 04:28:18 -0400
Received: from lists.gnu.org ([209.51.188.17]:54922)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <michael.albinus@HIDDEN>) id 1jSz7f-00009U-Ua
 for submit <at> debbugs.gnu.org; Mon, 27 Apr 2020 04:28:16 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:49854)
 by lists.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <michael.albinus@HIDDEN>) id 1jSz7e-0003gN-Rz
 for bug-gnu-emacs@HIDDEN; Mon, 27 Apr 2020 04:28:15 -0400
X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,
 DKIM_VALID,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS
 autolearn=unavailable autolearn_force=no version=3.4.2
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1)
 (envelope-from <michael.albinus@HIDDEN>) id 1jSz7a-00068y-CO
 for bug-gnu-emacs@HIDDEN; Mon, 27 Apr 2020 04:28:14 -0400
Received: from mout.gmx.net ([212.227.17.20]:56803)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <michael.albinus@HIDDEN>)
 id 1jSz7Z-00068n-Kn
 for bug-gnu-emacs@HIDDEN; Mon, 27 Apr 2020 04:28:10 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net;
 s=badeba3b8450; t=1587976086;
 bh=hjDn1ldAru4EQnNza4iczgXXQib+TY5FlQXekfI6ZtI=;
 h=X-UI-Sender-Class:From:To:Cc:Subject:Date;
 b=SC8RXMr1vaOCUShwXJFD8m3v6mYi6qGuJ9FFxjOiDMd7DOKELpOWjXvtyVWLolFzj
 4zx9ln1AxsbLhpbpp4iifG80N9c9m4DDOaO4TJ1tRQSeII0t0NBazPeNnfQ6aiF7jY
 JmsoJDCNA/BFwo6IfOkDtX1QNew8ZO5MbOruR7U0=
X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c
Received: from gandalf.gmx.de ([212.86.61.231]) by mail.gmx.com (mrgmx105
 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MbivG-1iuCXA1PHK-00dCjP; Mon, 27
 Apr 2020 10:28:06 +0200
From: Michael Albinus <michael.albinus@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 27.0.91; Moving point fails sometimes in shell-command
Date: Mon, 27 Apr 2020 10:28:03 +0200
Message-ID: <877dy1miy4.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Provags-ID: V03:K1:hKeze9+mVkraO2HCcfPliIlTGFmB87dhSg/vz0dAr2mB2Y3e0Qk
 7Fdov8Gf0tAz7XQxKr1rkunCz8uE46/Hnh1bAVTZcMwGfvvtiYfgg3HZp9mYnZXwNASQiQ9
 HISMxppBWid+7AWzOGP+wcxcYMXe4HnQTWKQb3n/yZ6CBSStuig75PsXPGu/02l+yOMJHtc
 Bbk+r5VNHhl+ZB2Y2k7Eg==
X-UI-Out-Filterresults: notjunk:1;V03:K0:khkILE2oX/g=:50WqCa8UgQWwBJzVhNNUcW
 0YQ3N3YI9MZfO6H6ptSjk/HqIGWtvFZZZUV+6VW3O7Kuhhcs3MK/fm3nV9ijHThoHpQWXUlrh
 PjUOmiswRm48D0fjA5TRC5eii3jg5UOfQJ7zWj6lK3VxHrxBF1jxf1JnvTMBxp5sNKrzPzs8s
 xcOgxg4lMKLBueK3ocpQHeWGa+eh2IEiEvC/7uUsNbxiCrtw3mow4WofxLwlh+HMHHigyBGiS
 tan6TRZbnK4o+/72eorrYKYxXcEPwNxHvxTw0i2mD2NybyofkQOMBrqK2EDJA9Czwa6o+PTlz
 nKAcEjZFW/WhKcJTdVsH4p5Fgr7Sf2m7I7jq4Y5deXmz2xktfcsWufsIhWirX0XaPm1sPfTjA
 wA1KX8/DJzG+tuJGYJ3kXFuMyGeHjHM6pC+Cc+LknLz+94jjdDF7afGOUq4PK0pJcEzXbk6Or
 ZWlITm1WZnx1itEv2rwqlntb1QnrIy2G/906GN7LzLL4IxSqiMTq5P/EwVIii0zIgGG8H4vZr
 dAJiO8BR2CWmoLfF1BgakNcSLTO9l1wWVxW1a5O635+LrIhAfOjoC2ZgdUuBkR2gnzAcDcqJR
 g4GaZ3mZoDWTiXLdfdJTHIo6VusgDyAy22CZ7hW/meacK03rlAy15ecTMuM27xf8mmRw/Ioq+
 OQmDD2zbW6kLmapQrdOdCl8aqQ+n4XPWiwONGnyk2DFZvlH68NbXF7Cq6aQe8WOb4SMcg7Ctt
 14iyGw4lweTyO3DGt0e14Z87jMbTdO2pglW8EzHZqJt0Raccm4NO0IR76M+gFFgi2odGpQQ4w
 O7ncns1g164W8pyGCd8EfWVBvz69utV1HZMsLhrN7TWt3LxRWCf7JsuulMXStipSVBiTrIhnf
 Jf/L+e0eLdWRm29jt9RcnocRTl5/wxK7rODMFeIVrs7zf+AV32niwZcykENV6EBJA5M0uOwAs
 kH4gXLo7q0WO8TUfwiWfoMRF9jwgg174PvZzWezW2P8sI3htE8KSuKTJBadzjV5FtN/147Zam
 ebefSp9/pLIZ9qjwmcJDdIxzvWMkrJQyuiCtsUlJQKX8J8ZvUDHS96yZPUswfU/wRi+iCDDYu
 CzPPYVQ9/IBjtPtzraGNW41nA98LT7E/UKigtLK0FgJmVttmHdBit10XmPOrGowiZQ5H/+VWG
 z+DRY9pgzyJrfpjOEsmn6GJRMzaOD0Q7E669CyZQ6s36rrQGOrmvEKAIkzx8/z7uqjm2oEA6O
 HBr7kLLeS0CGsc5mf
Received-SPF: pass client-ip=212.227.17.20;
 envelope-from=michael.albinus@HIDDEN; helo=mout.gmx.net
X-detected-operating-system: by eggs.gnu.org: First seen = 2020/04/27 02:37:28
X-ACL-Warn: Detected OS   = Linux 3.11 and newer
X-Received-From: 212.227.17.20
X-Spam-Score: 0.6 (/)
X-Debbugs-Envelope-To: submit
Cc: Tino Calancha <tino.calancha@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.4 (--)


Hi,

`shell-command' shall move the point after the output of the command,
unless indicated otherwise by `shell-command-dont-erase-buffer'. This
works almost, but not always. I have extracted three test cases which fail.

--8<---------------cut here---------------start------------->8---
;; Erase if buffer is the current one, but
;; `shell-command-dont-erase-buffer' is set to `erase'.
;; Move point to `point-max'.
(let ((default-directory temporary-file-directory)
      (shell-command-dont-erase-buffer 'erase))
  (with-temp-buffer
    (insert "bar")
    (cl-assert (string-equal "bar" (buffer-string)))
    (cl-assert (= (point) (point-max)))
    (shell-command "echo baz" (current-buffer))
    (cl-assert (string-equal "baz\n" (buffer-string)))
    ;; Point is not moved after the inserted text.
    (cl-assert (= (point) (point-max)) 'show-args)))

;; Don't erase if the buffer is the current one and
;; `shell-command-dont-erase-buffer' is set to `end-last-out'.
;; Move point to `point-max'.
(let ((default-directory temporary-file-directory)
      (shell-command-dont-erase-buffer 'end-last-out))
  (with-temp-buffer
    (insert "bar")
    (cl-assert (string-equal "bar" (buffer-string)))
    (cl-assert (= (point) (point-max)))
    (shell-command "echo baz" (current-buffer))
    (cl-assert (string-equal "barbaz\n" (buffer-string)))
    ;; Point is not moved after the inserted text.
    (cl-assert (= (point) (point-max)) 'show-args)))

;; Don't erase if the buffer is the current one and
;; `shell-command-dont-erase-buffer' is set to a random value.
;; Move point to `point-max'.
(let ((default-directory temporary-file-directory)
      (shell-command-dont-erase-buffer 'random))
  (with-temp-buffer
    (insert "bar")
    (cl-assert (string-equal "bar" (buffer-string)))
    (cl-assert (= (point) (point-max)))
    (shell-command "echo baz" (current-buffer))
    (cl-assert (string-equal "barbaz\n" (buffer-string)))
    ;; Point is not moved after the inserted text.
    (cl-assert (= (point) (point-max)) 'show-args)))
--8<---------------cut here---------------end--------------->8---

If it is undecided where point will be in the first and third case, this
shall be documented at least.

Best regards, Michael.


In GNU Emacs 27.0.91 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.13)
 of 2020-04-26 built on gandalf
Repository revision: 68f4a740a13ee6a1d98079ef655dd42924d24d41
Repository branch: emacs-27
Windowing system distributor 'Fedora Project', version 11.0.12006000
System Description: Fedora 31 (Workstation Edition)

Recent messages:
Reading active file from news via nntp...
Opening nntp server on news...done
Opening connection to imap.gmx.net via tls...
Opening connection to imap.gmx.net...done
Reading active file via nnml...
Reading incoming mail from pop...
nnml: Reading incoming mail (no new mail)...done
Reading active file via nnml...done
Reading active file via nndraft...done
Checking new news...done

Configured features:
XPM JPEG TIFF GIF PNG RSVG SOUND GPM DBUS GSETTINGS GLIB NOTIFY INOTIFY
ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE HARFBUZZ M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES THREADS PDUMPER LCMS2 GMP

Important settings:
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8

Major mode: Group

Minor modes in effect:
  gnus-undo-mode: t
  erc-notify-mode: t
  erc-notifications-mode: t
  display-time-mode: t
  shell-dirtrack-mode: t
  delete-selection-mode: t
  icomplete-mode: t
  show-paren-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
/home/albinus/src/tramp/lisp/tramp-sh hides /home/albinus/.emacs.d/elpa/tramp-2.4.3.3/tramp-sh
/home/albinus/src/tramp/lisp/tramp-compat hides /home/albinus/.emacs.d/elpa/tramp-2.4.3.3/tramp-compat
/home/albinus/src/tramp/lisp/tramp hides /home/albinus/.emacs.d/elpa/tramp-2.4.3.3/tramp
/home/albinus/src/tramp/lisp/tramp-rclone hides /home/albinus/.emacs.d/elpa/tramp-2.4.3.3/tramp-rclone
/home/albinus/src/tramp/lisp/tramp-cmds hides /home/albinus/.emacs.d/elpa/tramp-2.4.3.3/tramp-cmds
/home/albinus/src/tramp/lisp/tramp-gvfs hides /home/albinus/.emacs.d/elpa/tramp-2.4.3.3/tramp-gvfs
/home/albinus/src/tramp/lisp/tramp-uu hides /home/albinus/.emacs.d/elpa/tramp-2.4.3.3/tramp-uu
/home/albinus/src/tramp/lisp/tramp-integration hides /home/albinus/.emacs.d/elpa/tramp-2.4.3.3/tramp-integration
/home/albinus/src/tramp/lisp/tramp-archive hides /home/albinus/.emacs.d/elpa/tramp-2.4.3.3/tramp-archive
/home/albinus/src/tramp/lisp/tramp-adb hides /home/albinus/.emacs.d/elpa/tramp-2.4.3.3/tramp-adb
/home/albinus/src/tramp/lisp/trampver hides /home/albinus/.emacs.d/elpa/tramp-2.4.3.3/trampver
/home/albinus/src/tramp/lisp/tramp-ftp hides /home/albinus/.emacs.d/elpa/tramp-2.4.3.3/tramp-ftp
/home/albinus/src/tramp/lisp/tramp-smb hides /home/albinus/.emacs.d/elpa/tramp-2.4.3.3/tramp-smb
/home/albinus/src/tramp/lisp/tramp-cache hides /home/albinus/.emacs.d/elpa/tramp-2.4.3.3/tramp-cache
/home/albinus/src/tramp/lisp/tramp-sudoedit hides /home/albinus/.emacs.d/elpa/tramp-2.4.3.3/tramp-sudoedit
/home/albinus/src/tramp/lisp/tramp-loaddefs hides /home/albinus/.emacs.d/elpa/tramp-2.4.3.3/tramp-loaddefs
/home/albinus/src/elpa/packages/tramp-theme/tramp-theme-autoloads hides /home/albinus/.emacs.d/elpa/tramp-theme-0.2/tramp-theme-autoloads
/home/albinus/src/elpa/packages/tramp-theme/tramp-theme hides /home/albinus/.emacs.d/elpa/tramp-theme-0.2/tramp-theme
/home/albinus/src/elpa/packages/tramp-theme/tramp-theme-pkg hides /home/albinus/.emacs.d/elpa/tramp-theme-0.2/tramp-theme-pkg
/home/albinus/src/tramp/lisp/tramp-sh hides /home/albinus/src/emacs-27/lisp/net/tramp-sh
/home/albinus/src/tramp/lisp/tramp-cmds hides /home/albinus/src/emacs-27/lisp/net/tramp-cmds
/home/albinus/src/tramp/lisp/tramp-gvfs hides /home/albinus/src/emacs-27/lisp/net/tramp-gvfs
/home/albinus/src/tramp/lisp/tramp-ftp hides /home/albinus/src/emacs-27/lisp/net/tramp-ftp
/home/albinus/src/tramp/lisp/tramp-adb hides /home/albinus/src/emacs-27/lisp/net/tramp-adb
/home/albinus/src/tramp/lisp/tramp hides /home/albinus/src/emacs-27/lisp/net/tramp
/home/albinus/src/tramp/lisp/tramp-cache hides /home/albinus/src/emacs-27/lisp/net/tramp-cache
/home/albinus/src/tramp/lisp/tramp-rclone hides /home/albinus/src/emacs-27/lisp/net/tramp-rclone
/home/albinus/src/tramp/lisp/tramp-compat hides /home/albinus/src/emacs-27/lisp/net/tramp-compat
/home/albinus/src/tramp/lisp/tramp-integration hides /home/albinus/src/emacs-27/lisp/net/tramp-integration
/home/albinus/src/tramp/lisp/tramp-archive hides /home/albinus/src/emacs-27/lisp/net/tramp-archive
~/lisp/dbus hides /home/albinus/src/emacs-27/lisp/net/dbus
/home/albinus/src/tramp/lisp/tramp-sudoedit hides /home/albinus/src/emacs-27/lisp/net/tramp-sudoedit
/home/albinus/src/tramp/lisp/tramp-loaddefs hides /home/albinus/src/emacs-27/lisp/net/tramp-loaddefs
/home/albinus/src/tramp/lisp/tramp-uu hides /home/albinus/src/emacs-27/lisp/net/tramp-uu
/home/albinus/src/tramp/lisp/tramp-smb hides /home/albinus/src/emacs-27/lisp/net/tramp-smb
/home/albinus/src/tramp/lisp/trampver hides /home/albinus/src/emacs-27/lisp/net/trampver

Features:
(shadow sort mail-extr warnings emacsbug pop3 utf-7 nndraft nnmh nnml
gnutls network-stream nsm gnus-agent gnus-srvr gnus-score score-mode
nnvirtual gnus-msg gnus-art mm-uu mml2015 mm-view mml-smime smime dig
gnus-cache gnus-sum url url-proxy url-privacy url-expand url-methods
url-history mailcap shr url-cookie url-domsuf url-util svg dom nnnil
smtpmail sendmail gnus-demon nntp gnus-group gnus-undo gnus-start
gnus-cloud nnimap nnmail mail-source utf7 netrc nnoo gnus-spec gnus-int
gnus-range message rmc puny rfc822 mml mml-sec epa derived epg
epg-config mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev
gmm-utils mailheader gnus-win gnus nnheader gnus-util rmail
rmail-loaddefs rfc2047 rfc2045 ietf-drums text-property-search
mail-utils mm-util mail-prsvr wid-edit eieio-opt cl-extra speedbar
sb-image ezimage dframe help-fns radix-tree cl-print debug backtrace
help-mode find-func vc vc-dispatcher erc-notify erc-networks
erc-desktop-notifications erc-match notifications dbus xml erc-goodies
erc erc-backend erc-compat thingatpt pp erc-loaddefs cperl-mode time
tramp-sh vagrant-tramp dash term disp-table ehelp tramp tramp-loaddefs
trampver tramp-integration files-x tramp-compat shell pcomplete comint
ansi-color ring parse-time iso8601 time-date ls-lisp format-spec delsel
ido jka-compr icomplete paren dired dired-loaddefs info package easymenu
browse-url url-handlers url-parse auth-source cl-seq eieio eieio-core
cl-macs eieio-loaddefs password-cache json subr-x map url-vars seq
byte-opt gv bytecomp byte-compile cconv cl-loaddefs cl-lib tooltip eldoc
electric uniquify ediff-hook vc-hooks lisp-float-type mwheel term/x-win
x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode elisp-mode lisp-mode
prog-mode register page tab-bar menu-bar rfn-eshadow isearch timer
select scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame minibuffer cl-generic cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms
cp51932 hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese composite charscript charprop case-table epa-hook
jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice loaddefs
button faces cus-face macroexp files text-properties overlay sha1 md5
base64 format env code-pages mule custom widget hashtable-print-readable
backquote threads dbusbind inotify lcms2 dynamic-setting
system-font-setting font-render-setting move-toolbar gtk x-toolkit x
multi-tty make-network-process emacs)

Memory information:
((conses 16 212745 10654)
 (symbols 48 21733 1)
 (strings 32 66828 3046)
 (string-bytes 1 2267312)
 (vectors 16 31843)
 (vector-slots 8 397198 17284)
 (floats 8 253 37)
 (intervals 56 2268 0)
 (buffers 1000 24))




Acknowledgement sent to Michael Albinus <michael.albinus@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#40896; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Fri, 28 Jan 2022 15:45:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.