From mboxrd@z Thu Jan  1 00:00:00 1970
Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail
From: Ihor Radchenko <yantar92@posteo.net>
Newsgroups: gmane.emacs.bugs
Subject: bug#71081: 30.0.50;
 shell-command-on-region outputs boilerplate text on Windows
Date: Wed, 22 May 2024 14:26:47 +0000
Message-ID: <875xv5kjmg.fsf@localhost>
References: <875xv8qqlv.fsf@localhost> <86y1848g3a.fsf@gnu.org>
 <863fc61b-5ad5-47e5-9f95-96cdcfcfd016@gutov.dev> <8634qa8tp0.fsf@gnu.org>
 <87le42jcj0.fsf@localhost> <86a5ki6kf1.fsf@gnu.org>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214";
	logging-data="17590"; mail-complaints-to="usenet@ciao.gmane.io"
Cc: dmitry@gutov.dev, 71081@debbugs.gnu.org, matt@excalamus.com
To: Eli Zaretskii <eliz@gnu.org>
Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed May 22 16:26:07 2024
Return-path: <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org>
Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org
Original-Received: from lists.gnu.org ([209.51.188.17])
	by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
	(Exim 4.92)
	(envelope-from <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org>)
	id 1s9mut-0004MB-2z
	for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 22 May 2024 16:26:07 +0200
Original-Received: from localhost ([::1] helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <bug-gnu-emacs-bounces@gnu.org>)
	id 1s9mul-0004PW-Ju; Wed, 22 May 2024 10:25:59 -0400
Original-Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>)
 id 1s9mui-0004PC-89
 for bug-gnu-emacs@gnu.org; Wed, 22 May 2024 10:25:56 -0400
Original-Received: from debbugs.gnu.org ([2001:470:142:5::43])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>)
 id 1s9muh-0002Hd-Ut
 for bug-gnu-emacs@gnu.org; Wed, 22 May 2024 10:25:55 -0400
Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2)
 (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1s9mun-0003Ya-NE
 for bug-gnu-emacs@gnu.org; Wed, 22 May 2024 10:26:01 -0400
X-Loop: help-debbugs@gnu.org
Resent-From: Ihor Radchenko <yantar92@posteo.net>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@gnu.org
Resent-Date: Wed, 22 May 2024 14:26:01 +0000
Resent-Message-ID: <handler.71081.B71081.171638791913661@debbugs.gnu.org>
Resent-Sender: help-debbugs@gnu.org
X-GNU-PR-Message: followup 71081
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: notabug
Original-Received: via spool by 71081-submit@debbugs.gnu.org id=B71081.171638791913661
 (code B ref 71081); Wed, 22 May 2024 14:26:01 +0000
Original-Received: (at 71081) by debbugs.gnu.org; 22 May 2024 14:25:19 +0000
Original-Received: from localhost ([127.0.0.1]:56261 helo=debbugs.gnu.org)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <debbugs-submit-bounces@debbugs.gnu.org>)
 id 1s9mu7-0003YH-1J
 for submit@debbugs.gnu.org; Wed, 22 May 2024 10:25:19 -0400
Original-Received: from mout02.posteo.de ([185.67.36.66]:33183)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <yantar92@posteo.net>) id 1s9mu5-0003YB-EW
 for 71081@debbugs.gnu.org; Wed, 22 May 2024 10:25:18 -0400
Original-Received: from submission (posteo.de [185.67.36.169]) 
 by mout02.posteo.de (Postfix) with ESMTPS id D15B4240101
 for <71081@debbugs.gnu.org>; Wed, 22 May 2024 16:25:05 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1716387905; bh=pswhxqRMDIXZyLQjpn6sKQPMcXyokaF1daM9U3ukhac=;
 h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type:
 From;
 b=qTO9WG+teM+hLTmnvvZ2zQ1EfdRNBCBV8ePh87W7kSeIi0vvnILfVPSGr4eMjlWGY
 KLmxCKjpJTYr0X/xZd5YG0ER6dzyXbURR3I3G83rCmkKpValmOUaJaAUdXNKRhwv25
 416Ptt2AeRuWZuJwgyHUuM4uDHjiwbilCMM2Pd8Tm3JOozc8Aa2pXC5+MHJBgzycHS
 1fBcQXrjLOPW6nCqNFAsVon81x/a8VdvbB+F1O8A4QDMzyUm4SnsM1sf+F9QuXvI3p
 0Dd7RZyyWozGzSWfwOTspl0H9ZYFcGGX6J01PFu4Yj2v8VtAF6adgrmyx/GsbgCYiq
 CsFZLTzSpYUGw==
Original-Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4Vktqh3bvvz9rxM;
 Wed, 22 May 2024 16:25:04 +0200 (CEST)
In-Reply-To: <86a5ki6kf1.fsf@gnu.org>
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
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: <https://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-mx.org@gnu.org
Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org
Xref: news.gmane.io gmane.emacs.bugs:285629
Archived-At: <http://permalink.gmane.org/gmane.emacs.bugs/285629>

Eli Zaretskii <eliz@gnu.org> writes:

>> When using comint, piping commands to shell process input is the only
>> way to keep the shell running as we send it more commands. However, the
>> same problem persists - when sending the very first command, cmd.exe
>> generates its version data, which we cannot easily distinguish from the
>> rest of the output. We cannot easily see stderr either.
>
> The easiest way of solving this conundrum is to create a temporary
> batch file, insert all the commands into it, with the first line being
>
>   @echo off
>
> and then submit the name of that batch file to the Windows shell as
> the sole command-line argument after shell-command-switch.  So my
> recommendation is to do just that, on Windows.

May it be something you also want to do for `shell-command-on-region'?

At the end, the current Emacs behaviour is unexpected from the user
perspective, even though it is a result of the cmd.exe behaviour. If
there is a workable workaround, `shell-command-on-region' and Org mode
may as well use it; preferably implemented on Emacs side to not
duplicate the code.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>