From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id 3LlOJIhNHF9XMwAA0tVLHw (envelope-from ) for ; Sat, 25 Jul 2020 15:19:36 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id MACSH4hNHF+oawAAbx9fmQ (envelope-from ) for ; Sat, 25 Jul 2020 15:19:36 +0000 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 CE4859403A9 for ; Sat, 25 Jul 2020 15:19:35 +0000 (UTC) Received: from localhost ([::1]:50726 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jzLxV-00028F-VL for larch@yhetil.org; Sat, 25 Jul 2020 11:19:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43904) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jzLxB-000287-Ja for emacs-orgmode@gnu.org; Sat, 25 Jul 2020 11:19:13 -0400 Received: from mail-ej1-f41.google.com ([209.85.218.41]:46226) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jzLx9-0002MV-8W for emacs-orgmode@gnu.org; Sat, 25 Jul 2020 11:19:13 -0400 Received: by mail-ej1-f41.google.com with SMTP id l4so12783391ejd.13 for ; Sat, 25 Jul 2020 08:19:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=HiNaTdvw+6bI5yZ3oSeArEzeZX+c6VyzqtkbL5xBdiw=; b=GWqsKtnGXeZIXmJf6VHNiiX4s7j1Zb1ib9Rex6V6s8XNeheKzLaHc/oWq5WMN0StlW ur6/QirDGX6JkW2XNA9H5YlJNt31V9xfCIRd+bNQKg6iA5WZvCJ5u0XRDpQ8KKsekAsx LenL49Erb4j2U2D0Jmfn+4hlOINSnpV+LV/CPQuhM92U0ImCKXLjn6ZACNamiam9U7tH wIi1FbaQbTOL+M5aYcUT6+YVcXPRMOiP4QqHtMPoj+NQVCK1VNbCfJx8QcVbu6Yd+Nc7 LZh/FOcN639+aIZwd2E8b/93QnnSGrOy/OIBK09wlfu/0x+H4FDlneT2xkNip8BbUXhP igjA== X-Gm-Message-State: AOAM533O4d4IL4kmw5RFPgSTdnc6jaFCOd9E3d4o3KZ2jHNu0oyfF4yF AhQi9ESWScgddDyt6R0G5moPy35GFzKE6E6ebdeX2eLI X-Google-Smtp-Source: ABdhPJwDxbf/BioVII0aM5rR8WIXUUcjdoVKYFOXZXQwn/irVj5nAlzPkhA/zQtnl/uYgtFkvPSh4fowqTYr2xuStgk= X-Received: by 2002:a17:907:4240:: with SMTP id oi24mr13671497ejb.23.1595690349019; Sat, 25 Jul 2020 08:19:09 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: ian martins Date: Sat, 25 Jul 2020 11:18:57 -0400 Message-ID: Subject: Re: Why is Babel-C trimming its output? To: =?UTF-8?Q?Micha=C3=ABl_Cadilhac?= Content-Type: multipart/alternative; boundary="0000000000006cc62905ab459ca6" Received-SPF: pass client-ip=209.85.218.41; envelope-from=ianxm1@gmail.com; helo=mail-ej1-f41.google.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/25 11:19:09 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: 3 X-Spam_score: 0.3 X-Spam_bar: / X-Spam_report: (0.3 / 5.0 requ) BAYES_00=-1.9, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FORGED_FROMDOMAIN=1, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Org-Mode mailing list Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=jhu.edu (policy=none); spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Spam-Score: 0.09 X-TUID: ySNnRcAZGXEO --0000000000006cc62905ab459ca6 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable That's up to the maintainers. If you just want to fix it on your end you could advise/replace `org-babel-C-execute` but unfortunately there's a lot there. On Fri, Jul 17, 2020, 1:31 PM Micha=C3=ABl Cadilhac wrote: > Thanks for the investigation Ian. So, since the tests run just fine > without it, and it offers an inconsistent and at times detrimental > feature, can we consider removing it, and/or adding some options for > that? > > I'd be fine having to flag my src-block with a ":verbatim t" option to > make sure that the output is not mangled. > > Thoughts? > > On Fri, Jul 17, 2020 at 7:30 AM ian martins wrote: > > > > Fortunately the author wrote tests, so we can tie the behavior of the > code to use cases. Unfortunately all the tests pass with the call to > org-trim removed. Also the call is there from the first commit of the fil= e > in git, so there's no commit message to explain. > > > > My guess is that it was added to clean up cases that resulted in extra > trailing whitespace, but I dunno. > > > > > > On Wed, Jul 15, 2020 at 7:12 PM Micha=C3=ABl Cadilhac > wrote: > >> > >> Hello, > >> > >> Quick question here: in ob-C.el, before returning the output of a C > >> file, there's this line: > >> > >> (setq results (org-trim (org-remove-indentation results))) > >> > >> That seems quite arbitrary; is it on purpose? I have a C file that > >> outputs some sort of list of formatted numbers, e.g.: > >> > >> 0 -17.8 > >> 40 4.4 > >> 80 26.7 > >> 120 48.9 > >> > >> and only the first line gets trimmed, leading to a faulty output. > >> > >> This does not seem to be a universal thing in Babel; for instance: > >> > >> #+begin_src emacs-lisp :exports both :results value raw > >> " 0\n 1\n2\n" > >> #+end_src > >> > >> =E2=80=A6results in: > >> > >> #+RESULTS: > >> 0 > >> 1 > >> 2 > >> > >> But the same thing in C: > >> > >> #+begin_src C :exports both :results output raw > >> printf (" 0\n 1\n2\n"); > >> #+end_src > >> > >> =E2=80=A6results in: > >> #+RESULTS: > >> 0 > >> 1 > >> 2 > >> > >> Cheers, > >> M. > >> > --0000000000006cc62905ab459ca6 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
That's up to the maintainers.

If you just want to fix it on your e= nd you could advise/replace `org-babel-C-execute` but unfortunately there&#= 39;s a lot there.

On Fri, Jul 17, 2020, 1:31 PM Micha=C3=ABl= Cadilhac <mi= chael@cadilhac.name> wrote:
Thanks for the investigation Ian.=C2=A0 So, since the te= sts run just fine
without it, and it offers an inconsistent and at times detrimental
feature, can we consider removing it, and/or adding some options for
that?

I'd be fine having to flag my src-block with a ":verbatim t" = option to
make sure that the output is not mangled.

Thoughts?

On Fri, Jul 17, 2020 at 7:30 AM ian martins <ianxm@jhu.edu> wrote:
>
> Fortunately the author wrote tests, so we can tie the behavior of the = code to use cases. Unfortunately all the tests pass with the call to org-tr= im removed. Also the call is there from the first commit of the file in git= , so there's no commit message to explain.
>
> My guess is that it was added to clean up cases that resulted in extra= trailing whitespace, but I dunno.
>
>
> On Wed, Jul 15, 2020 at 7:12 PM Micha=C3=ABl Cadilhac <michael@c= adilhac.name> wrote:
>>
>> Hello,
>>
>> Quick question here: in ob-C.el, before returning the output of a = C
>> file, there's this line:
>>
>> (setq results (org-trim (org-remove-indentation results)))
>>
>> That seems quite arbitrary; is it on purpose?=C2=A0 I have a C fil= e that
>> outputs some sort of list of formatted numbers, e.g.:
>>
>>=C2=A0 =C2=A00=C2=A0 -17.8
>>=C2=A0 40=C2=A0 =C2=A0 4.4
>>=C2=A0 80=C2=A0 =C2=A026.7
>> 120=C2=A0 =C2=A048.9
>>
>> and only the first line gets trimmed, leading to a faulty output.<= br> >>
>> This does not seem to be a universal thing in Babel; for instance:=
>>
>> #+begin_src emacs-lisp :exports both :results value raw
>>=C2=A0 =C2=A0" 0\n 1\n2\n"
>> #+end_src
>>
>> =E2=80=A6results in:
>>
>> #+RESULTS:
>>=C2=A0 0
>>=C2=A0 1
>> 2
>>
>> But the same thing in C:
>>
>> #+begin_src C :exports both :results output raw
>>=C2=A0 =C2=A0printf (" 0\n 1\n2\n");
>> #+end_src
>>
>> =E2=80=A6results in:
>> #+RESULTS:
>> 0
>>=C2=A0 1
>> 2
>>
>> Cheers,
>> M.
>>
--0000000000006cc62905ab459ca6--