From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id UFGEAozgEV+BJAAA0tVLHw (envelope-from ) for ; Fri, 17 Jul 2020 17:31:56 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id yMXEOYvgEV8mWAAAB5/wlQ (envelope-from ) for ; Fri, 17 Jul 2020 17:31:55 +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 6BA5E9400C5 for ; Fri, 17 Jul 2020 17:31:55 +0000 (UTC) Received: from localhost ([::1]:57566 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jwUDB-0000rK-4M for larch@yhetil.org; Fri, 17 Jul 2020 13:31:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53456) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jwUCZ-0000qx-AO for emacs-orgmode@gnu.org; Fri, 17 Jul 2020 13:31:15 -0400 Received: from cadilhac.name ([163.172.56.42]:57398) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jwUCX-00006i-GG for emacs-orgmode@gnu.org; Fri, 17 Jul 2020 13:31:15 -0400 Received: from cadilhac.name (localhost [127.0.0.1]) by cadilhac.name (OpenSMTPD) with ESMTP id 3e64b13e for ; Fri, 17 Jul 2020 17:31:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=cadilhac.name; h= mime-version:references:in-reply-to:from:date:message-id:subject :to:cc:content-type:content-transfer-encoding; s=default; bh=EvR ilUkolS4wNJOs8st5NJGK/Z0=; b=QSX23M5JXbtrAziNOrrWBClarpODyjAScrT 224eQG+b8sE+2SfSyiAmEMmaVp1ZTef8DAb0wPlqxbvmUUq5Nr1zrzIek9wS++7U l2k2reEufWTQS+VRF+HFF1t6eoSAgvg3bgu+qTUEbcDbCnkJsQ2SscjMz6XVo1p4 rkmYfgAyrMOt6akFFf/EF5cDseEw8zli7uyo8SsH6VDIXFG66dWuY7gJQwfls1Dh 7bVzerqewtl0Ez4vfe0QOauFu1HvF4KId7bArHfFSM7mHRWBTr7RLXxyvj0u1KMt Ji+jXe/UgMSo2YGLO2cwhnMBBZpx0hP+GSbLTwGCtL65viawpTw== DomainKey-Signature: a=rsa-sha1; c=nofws; d=cadilhac.name; h= mime-version:references:in-reply-to:from:date:message-id:subject :to:cc:content-type:content-transfer-encoding; q=dns; s=default; b= n6I2BgK+QsggabtYgxghGMtNI+oys1EvVyB9asP0XaMvu5ev3vv5wHaTuq4RxcbN CMUkHhLB5tFWh9YIAvdZZs9ar1Xp4o2lZ7fnklvfm+hEofdmPMYkBGnbj27DG0tt +RYizveoBdLNOjRCJXuUUPhhqUOlcUTw7sxjn3oxEwn/56t0f1gF7NFFT109pJ7a b31zF2halFpS4Jqd8Mmlb7k2mry9fXmGPR04TOsOV8rw5s2ssZuQPMECpCtoBRsY ZNNjIG8JTjm27GwyFAmgDkI9zOcUytuJeTfQLPebKRgJFYgyzZz0a/l4TKlePOK/ 2sucHS+TiTnYZ6J2Un6XNA== Received: from mail-ua1-f49.google.com (mail-ua1-f49.google.com [209.85.222.49]) by cadilhac.name (OpenSMTPD) with ESMTPSA id 3dbd6fa7 (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256:NO) for ; Fri, 17 Jul 2020 17:31:08 +0000 (UTC) Received: by mail-ua1-f49.google.com with SMTP id c7so3125145uap.0 for ; Fri, 17 Jul 2020 10:31:08 -0700 (PDT) X-Gm-Message-State: AOAM533cWRQMjtLsdsZvBzQIA90o5LHYBezIM+YfCOD+2aJ+nKkTdc09 9xeOQEvbXOOWkeVPOzOK0L/L9pkw8GkX2TdSJUE= X-Google-Smtp-Source: ABdhPJyYg/NpBfoYtDdQ7xQ0w/gpNas/Djjs29AxusEKcpeo1ARP+kkaTMdrqK+Xrm+tb01asMdTGYnm6Rr3thMdnJI= X-Received: by 2002:ab0:41c2:: with SMTP id 60mr8186629uap.108.1595007067380; Fri, 17 Jul 2020 10:31:07 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: =?UTF-8?Q?Micha=C3=ABl_Cadilhac?= Date: Fri, 17 Jul 2020 12:30:30 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: Why is Babel-C trimming its output? To: ian martins Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=163.172.56.42; envelope-from=michael@cadilhac.name; helo=cadilhac.name X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/17 13:31:09 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=ham 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=pass header.d=cadilhac.name header.s=default header.b=QSX23M5J; dmarc=pass (policy=none) header.from=cadilhac.name; 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.71 X-TUID: KeUl2WLhYERR 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 cod= e 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 file in git, s= o there's no commit message to explain. > > My guess is that it was added to clean up cases that resulted in extra tr= ailing 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. >>