From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <emacs-orgmode-bounces+larch=yhetil.org@gnu.org>
Received: from mp12.migadu.com ([2001:41d0:8:6d80::])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	by ms5.migadu.com with LMTPS
	id wM4pOAYzqGPyAgEAbAwnHQ
	(envelope-from <emacs-orgmode-bounces+larch=yhetil.org@gnu.org>)
	for <larch@yhetil.org>; Sun, 25 Dec 2022 12:24:54 +0100
Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	by mp12.migadu.com with LMTPS
	id aAAyOAYzqGMvvwAAauVa8A
	(envelope-from <emacs-orgmode-bounces+larch=yhetil.org@gnu.org>)
	for <larch@yhetil.org>; Sun, 25 Dec 2022 12:24:54 +0100
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by aspmx1.migadu.com (Postfix) with ESMTPS id 903C63D123
	for <larch@yhetil.org>; Sun, 25 Dec 2022 12:24:54 +0100 (CET)
Received: from localhost ([::1] helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <emacs-orgmode-bounces@gnu.org>)
	id 1p9P6v-0003ma-1w; Sun, 25 Dec 2022 06:24:09 -0500
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 <yantar92@posteo.net>)
 id 1p9P6s-0003mQ-Nf
 for emacs-orgmode@gnu.org; Sun, 25 Dec 2022 06:24:06 -0500
Received: from mout02.posteo.de ([185.67.36.66])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <yantar92@posteo.net>)
 id 1p9P6q-00012I-Ht
 for emacs-orgmode@gnu.org; Sun, 25 Dec 2022 06:24:06 -0500
Received: from submission (posteo.de [185.67.36.169]) 
 by mout02.posteo.de (Postfix) with ESMTPS id 9290424029E
 for <emacs-orgmode@gnu.org>; Sun, 25 Dec 2022 12:24:00 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1671967442; bh=CjeHMiEHBgBiz96Lhagyo1gb01ANBQtuns2lOHc25yo=;
 h=From:To:Cc:Subject:Date:From;
 b=r64PArf5Uh2Pviey8fVoyYqu+b73BgG3PwrKh81YN8E2kBp/R9c3Tb+OWGgF+o30p
 9dnwGzK4MRU6pCS+CWghO/hMGvuAktL8TA2VjYHF99MU7P/Nc+nxhLTnH1sYsTuPet
 J2EjmawdwBus4HI7XhP2LkBdmsHJPJMst6dTiMTRTnMEBgPQJ7t5YyY8QIwex69uDV
 OMWgC6gMxVt7eYeMh+bjeeNrBdjwlZbfwVb2GvhGqxDVkaHboWmKw1WSwTb39d8R51
 OBSSNr9t+IuRME/n30TiR/cdajZyVu+Rj5GpZzHPselDOI8UqPGhfYOCSUDuVng8zx
 DEBJv2Q8D/xng==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4Nfz7x0yZSz6tm9;
 Sun, 25 Dec 2022 12:23:57 +0100 (CET)
From: Ihor Radchenko <yantar92@posteo.net>
To: Matt <matt@excalamus.com>
Cc: =?utf-8?Q?Rudolf_Adamkovi=C4=8D?= <salutis@me.com>, emacs-orgmode
 <emacs-orgmode@gnu.org>
Subject: Re: Bash results broken?
In-Reply-To: <1852d9eb52f.c4c534f9581400.7140516675874523594@excalamus.com>
References: <m2tu1v8gj8.fsf@me.com> <878rj7s0ti.fsf@localhost>
 <87pmch6js6.fsf@localhost> <m2r0wu29b7.fsf@me.com>
 <1852d9eb52f.c4c534f9581400.7140516675874523594@excalamus.com>
Date: Sun, 25 Dec 2022 11:23:53 +0000
Message-ID: <87h6xjsp4m.fsf@localhost>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
Received-SPF: pass client-ip=185.67.36.66; envelope-from=yantar92@posteo.net;
 helo=mout02.posteo.de
X-Spam_score_int: -43
X-Spam_score: -4.4
X-Spam_bar: ----
X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
 RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-BeenThere: emacs-orgmode@gnu.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "General discussions about Org-mode." <emacs-orgmode.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/emacs-orgmode>,
 <mailto:emacs-orgmode-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/archive/html/emacs-orgmode>
List-Post: <mailto:emacs-orgmode@gnu.org>
List-Help: <mailto:emacs-orgmode-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/emacs-orgmode>,
 <mailto:emacs-orgmode-request@gnu.org?subject=subscribe>
Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org
Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org
X-Migadu-Country: US
X-Migadu-Flow: FLOW_IN
ARC-Seal: i=1; s=key1; d=yhetil.org; t=1671967494; a=rsa-sha256; cv=none;
	b=T71gCKgVGuqawfFI7sPeTU0U0lVjivKylY6w2SOFbFvQEciKlnsU+QD4ivNAeE1PRoDHGg
	5gyVDhLbROxLZ5qvlLfRfmnsggj/QgSRd6lRc5vo4u+o9lGuS6ltXIorYSgESEYSrOQ+Eg
	MtA29haoTbjcCJvPU0XwTKiOcNJ0PHiLlS+trt10uRAXQ35A17D9VdPHwu8ou0PhkrTlxO
	jUO2a3qy8X7xkwUtIHm5774Cp+FMI9q7XB6DrurDvlF5nr29ywjZTAzwcZuRMWIinLmski
	xvvoKKaZ/TJE9W0CKH5tLFuPfrjbZyahH3P6L8noWWJzE+iqnqgdelnSBQP+ZA==
ARC-Authentication-Results: i=1;
	aspmx1.migadu.com;
	dkim=pass header.d=posteo.net header.s=2017 header.b=r64PArf5;
	spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org";
	dmarc=pass (policy=none) header.from=posteo.net
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org;
	s=key1; t=1671967494;
	h=from:from:sender:sender:reply-to:subject:subject:date:date:
	 message-id:message-id:to:to:cc:cc:mime-version:mime-version:
	 content-type:content-type:in-reply-to:in-reply-to:
	 references:references:list-id:list-help:list-unsubscribe:
	 list-subscribe:list-post:dkim-signature;
	bh=hcOKRzCigrhs0SsGa+DDe46ON3StO1jlFftcykBiYHI=;
	b=tGC6DpBrGODstrOa7WZL9FP/9qQbefedrIWQiagFSCfDr0YHWMTme02kHsFgN2lgGfnt7f
	IK8KGDdY36GJAPcl6naYfmu8DsBGKEjxPeJibEEgqO0UE9eZjyr25QiN25xNfRJvFVjSkC
	4ZBoCuATL2j398y61sPL3GuJOSk7MrNY2cwCYjhMITbw+/NMY4GwlLLetv92in+IWC4IUg
	PGn87wmTX4tRWKs6oX4XKubDelU2lWPGKYhM/P1IGimrwD1Z5TQRCcp1z6j537Cw9xmS1B
	FbJ+hDdZlN6KSpPemCVq7GbJComhzEIP2R/pdl1swyjjkT9CzsfR6kyHBgFM5Q==
X-Spam-Score: -10.06
X-Migadu-Queue-Id: 903C63D123
Authentication-Results: aspmx1.migadu.com;
	dkim=pass header.d=posteo.net header.s=2017 header.b=r64PArf5;
	spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org";
	dmarc=pass (policy=none) header.from=posteo.net
X-Migadu-Scanner: scn0.migadu.com
X-Migadu-Spam-Score: -10.06
X-TUID: TTbuRdPdzAwc

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

Matt <matt@excalamus.com> writes:

> For :results list, the manual says, "Interpret the results as an Org list.  If the result is a single value, create a list of one element".  I don't find that clarifies what would be best.
>
> Thoughts?

In my patch, I followed the previous code branch:

(list (if (stringp e) e (format "%S" e)))

As you see, "%S" have been used previously for non-string results.
I cannot find explanation in git log.

That said, I think that it will be more consistent to leave strings
specifically as is. See the attached patch.


--=-=-=
Content-Type: text/x-patch
Content-Disposition: inline;
 filename=0001-org-babel-insert-result-Output-strings-as-is-for-lis.patch

>From 22ee116511a40cc9cbee02e66799fdeb3e81ba78 Mon Sep 17 00:00:00 2001
Message-Id: <22ee116511a40cc9cbee02e66799fdeb3e81ba78.1671967390.git.yantar92@posteo.net>
From: Ihor Radchenko <yantar92@posteo.net>
Date: Sun, 25 Dec 2022 14:20:48 +0300
Subject: [PATCH] org-babel-insert-result: Output strings as is for lists of
 strings

* lisp/ob-core.el (org-babel-insert-result): Do not use %S format for
lists of strings in :results list output.  This is more consistent
with single string output.

Reported-by: Matt <matt@excalamus.com>
Link: https://orgmode.org/list/1852d9eb52f.c4c534f9581400.7140516675874523594@excalamus.com
---
 lisp/ob-core.el | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lisp/ob-core.el b/lisp/ob-core.el
index c2a367375..300c9d92f 100644
--- a/lisp/ob-core.el
+++ b/lisp/ob-core.el
@@ -2461,13 +2461,18 @@ (defun org-babel-insert-result (result &optional result-params info hash lang ex
 		    (insert
 		     (org-trim
 		      (org-list-to-org
+                       ;; We arbitrarily choose to format non-strings
+                       ;; as %S.
 		       (cons 'unordered
 			     (mapcar
 			      (lambda (e)
                                 (cond
                                  ((stringp e) (list e))
                                  ((listp e)
-                                  (mapcar (lambda (x) (format "%S" x)) e))
+                                  (mapcar
+                                   (lambda (x)
+                                     (if (stringp x) x (format "%S" x)))
+                                   e))
                                  (t (list (format "%S" e)))))
 			      (if (listp result) result
 				(split-string result "\n" t))))
-- 
2.38.1


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



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

--=-=-=--