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: Thu, 23 May 2024 12:06:25 +0000
Message-ID: <87cypcybpa.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>
 <875xv5kjmg.fsf@localhost> <86zfsh6gpp.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="19369"; 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 Thu May 23 14:05:19 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 1sA7C9-0004dF-LY
	for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 23 May 2024 14:05:18 +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 1sA7Bp-0006vP-KM; Thu, 23 May 2024 08:04:57 -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 1sA7Bn-0006v5-Mr
 for bug-gnu-emacs@gnu.org; Thu, 23 May 2024 08:04:55 -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 1sA7Bn-0002jp-AW
 for bug-gnu-emacs@gnu.org; Thu, 23 May 2024 08:04: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 1sA7Bt-0001vz-Je
 for bug-gnu-emacs@gnu.org; Thu, 23 May 2024 08:05: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: Thu, 23 May 2024 12:05:01 +0000
Resent-Message-ID: <handler.71081.B71081.17164658967422@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.17164658967422
 (code B ref 71081); Thu, 23 May 2024 12:05:01 +0000
Original-Received: (at 71081) by debbugs.gnu.org; 23 May 2024 12:04:56 +0000
Original-Received: from localhost ([127.0.0.1]:59000 helo=debbugs.gnu.org)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <debbugs-submit-bounces@debbugs.gnu.org>)
 id 1sA7Bn-0001ve-FD
 for submit@debbugs.gnu.org; Thu, 23 May 2024 08:04:55 -0400
Original-Received: from mout02.posteo.de ([185.67.36.66]:41105)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <yantar92@posteo.net>) id 1sA7Bl-0001vV-4P
 for 71081@debbugs.gnu.org; Thu, 23 May 2024 08:04:54 -0400
Original-Received: from submission (posteo.de [185.67.36.169]) 
 by mout02.posteo.de (Postfix) with ESMTPS id 8F87F240103
 for <71081@debbugs.gnu.org>; Thu, 23 May 2024 14:04:40 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1716465880; bh=HJvlEt19RY2UG/IQq39hmYLPLZ6I1vNCO+lMOFdOzLg=;
 h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type:
 From;
 b=qdA6dULCE6EgA/G/uUpjjtcTQX9Bv9VaEfhHU7oMgf91UnDCyuQJzn/lXUbbXKqAK
 56WwsR1KrbvubQT9WRoZR0K7+6q5O72K7nOgab62YbPgcroubf9nEfuQ4VvBEKG/qF
 cKq0FWORMIeyrULIRs+0ssTvbqaQ4rcoGS5km4Fa5HZPO+MrFzRrg0DRjjuDYEuXnG
 D1L/YVPV8yOQjF+nY6jrN9Vpfiljl46w4hcb82CZRHb1cYbAJ40UlcXnn4HDKitUJD
 JPMTnu0hNvOBPFgcp6CtTAEcC3UhzLjG7Ggrxij2W4k9SEkTomR/8RZF9fsQOGXmNZ
 WVOxqkp2K6pjg==
Original-Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4VlRgC64rLz9rxF;
 Thu, 23 May 2024 14:04:39 +0200 (CEST)
In-Reply-To: <86zfsh6gpp.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:285699
Archived-At: <http://permalink.gmane.org/gmane.emacs.bugs/285699>

Eli Zaretskii <eliz@gnu.org> writes:

>> > 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'?
>
> No, because in general the region is some text we want to give a
> program as input.  The usual "program" in these cases is not the
> shell, but some program that gets the text and processes it in some
> way.
>
> So in most "usual" uses of shell-command-on-region, going through a
> batch file is an unnecessary overhead.

Clear. I am not a big user of shell-command-on-region.

Then, what about something like

(shell-command-to-string "echo foo\necho bar")

On Linux, it yields
"foo
bar"

On Windows, it yields

"foo"

-- 
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>