From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kaushal Modi Subject: Re: Preventing RESULTS from being formatted as org table [ob-awk] Date: Mon, 13 Jun 2016 14:12:43 +0000 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a11417e54fc2afe0535297b32 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:43106) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bCSbo-0006Y1-Vv for emacs-orgmode@gnu.org; Mon, 13 Jun 2016 10:13:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bCSbm-00009l-Ke for emacs-orgmode@gnu.org; Mon, 13 Jun 2016 10:12:55 -0400 Received: from mail-oi0-x229.google.com ([2607:f8b0:4003:c06::229]:35478) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bCSbm-00009e-Dd for emacs-orgmode@gnu.org; Mon, 13 Jun 2016 10:12:54 -0400 Received: by mail-oi0-x229.google.com with SMTP id w5so130022142oib.2 for ; Mon, 13 Jun 2016 07:12:54 -0700 (PDT) In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: "Charles C. Berry" , "Thomas S. Dye" Cc: emacs-org list , eschulte@cs.unm.edu --001a11417e54fc2afe0535297b32 Content-Type: text/plain; charset=UTF-8 Hi Charles, Thomas, Thank you for the replies. They were very useful. I learned about :post for the first time. That minimal example worked great. Earlier I was confused about "*this*", but then from Info node "(org) post", I learned that it's a special variable for :post. For now, ":results verbatim" does the job for me for awk source blocks. But :post looks like a very powerful generic solution. With your reply, I at least tried it out and I will keep that in mind for when I might need to use it in future. Kaushal On Sun, Jun 12, 2016 at 5:02 PM Charles C. Berry wrote: > TL;DR: That is almost correct. `:post' header arg gives fine control of > formatting if needed. > > `org-babel-insert-result' formats anything that isn't a string or a list > using "%S". Then it tries hard to turn a list into a "table". Lists that > cannot be made into tables are formatted as strings with "%s\n". However, > various languages have their own formatting principles, so what > `org-babel-insert-result' gets as the `result' is a bit idiosyncratic. > > You can get a deeper look at the `result' by pretty printing it with the > aid of a :post header arg. Example: > > > #+NAME: I-feel-pretty > #+BEGIN_SRC emacs-lisp :results pp > *this* > #+END_SRC > > This elisp list is not revised: > > #+BEGIN_SRC emacs-lisp :post I-feel-pretty > '(a b c (d . e)) > #+END_SRC > > #+RESULTS: > : (a b c > : (d . e)) > > On Sun, 12 Jun 2016, Thomas S. Dye wrote: > I think I'm correct to say that by default a single value result is > output as a scalar, and everything else is converted to an Org mode > table. > -- -- Kaushal Modi --001a11417e54fc2afe0535297b32 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi Charles, Thomas,

Thank you for the r= eplies. They were very useful.

I learned about :po= st for the first time. That minimal example worked great. Earlier I was con= fused about "*this*", but then from Info node "(org) post&qu= ot;, I learned that it's a special variable for :post.

For now, ":results verbatim" does the job for me for awk= source blocks. But :post looks like a very powerful generic solution. With= your reply, I at least tried it out and I will keep that in mind for when = I might need to use it in future.

Kaushal

<= div class=3D"gmail_quote">
On Sun, Jun 12, 2016 at 5:02 PM = Charles C. Berry <ccberry@ucsd.edu> wrote:
TL;DR: That is almost= correct. `:post' header arg gives fine control of
formatting if needed.

`org-babel-insert-result' formats anything that isn't a string or a= list
using "%S". Then it tries hard to turn a list into a "table&= quot;. Lists that
cannot be made into tables are formatted as strings with "%s\n". = However,
various languages have their own formatting principles, so what
`org-babel-insert-result' gets as the `result' is a bit idiosyncrat= ic.

You can get a deeper look at the `result' by pretty printing it with th= e
aid of a :post header arg. Example:


#+NAME: I-feel-pretty
#+BEGIN_SRC emacs-lisp :results pp
*this*
#+END_SRC

This elisp list is not revised:

#+BEGIN_SRC emacs-lisp :post I-feel-pretty
'(a b c (d . e))
#+END_SRC

#+RESULTS:
: (a b c
:=C2=A0 =C2=A0 (d . e))
On Sun, 12 Jun 2016, Thomas S. Dye wrote:
=C2=A0I think I&= #39;m correct to say that by default a single value result is
=C2=A0outp= ut as a scalar, and everything else is converted to an Org mode
=C2=A0ta= ble.
--001a11417e54fc2afe0535297b32--