From mboxrd@z Thu Jan 1 00:00:00 1970 From: emailorama Subject: Re: [babel] Is ":results output inline" possible Date: Mon, 19 Oct 2009 23:12:10 -0700 (PDT) Message-ID: <419427.62143.qm@web111310.mail.gq1.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1N07xB-0005vY-B0 for emacs-orgmode@gnu.org; Tue, 20 Oct 2009 02:12:17 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1N07x6-0005ov-19 for emacs-orgmode@gnu.org; Tue, 20 Oct 2009 02:12:16 -0400 Received: from [199.232.76.173] (port=35113 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N07x5-0005oZ-Qs for emacs-orgmode@gnu.org; Tue, 20 Oct 2009 02:12:11 -0400 Received: from web111310.mail.gq1.yahoo.com ([67.195.15.185]:44455) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1N07x5-0007QG-6V for emacs-orgmode@gnu.org; Tue, 20 Oct 2009 02:12:11 -0400 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Thanks very much for your reply Eric. So the ":results org" feature was there all along. Searching for "raw" in "org-babel.el" shows it's nicely explained in the doc-string for "org-babel-insert-result". (maybe I should have done that sooner) I also noticed the ":results html" and ":results latex" options which look very useful. The latex option encloses the output in a #+BEGIN_LaTeX ... #+END_LaTeX block, which is nice because when the source block is re-executed, the new results replace the old results. -- Would it be possible to have something like that for "raw" or "org" mode? =20 (Maybe that would need a #+BEGIN_org ... #+END_org kind of construct.) Also, I've been looking at #+lob: which looks like another really useful idea, and there are two things I am wondering about. -- Is it possible to use #+lob: with ":results output org" ? -- Is it possible for #+lob: to take a string argument ? =20 The 4 examples below show things I have tried. 1. and 2. work fine. =20 3. and 4. are what I can't work out. Thanks for any ideas you have about these things. al -------------------------------------------------- 1. :results output org -> works -------------------------------------------------- #+srcname: randone #+begin_src ruby :results output org description =3D "lucky" number =3D 3 maximum =3D 100 puts "* Random numbers\n" + "Here are some #{description} numbers: " + (1..number).collect {|x| (rand * maximum).ceil }.join(", ") + "." #+end_src #+resname: randone * Random numbers Here are some lucky numbers: 48, 69, 6. -------------------------------------------------- 2. :results value -> works with #+lob: -------------------------------------------------- #+srcname: randtwo(n,max) #+begin_src ruby :results value number =3D n maximum =3D max "* Random numbers\n" + "Here are some random numbers: " + (1..number).collect {|x| (rand * maximum).ceil }.join(", ") + "." #+end_src #+lob: randtwo(n=3D3,max=3D100) #+resname: randtwo(n=3D3,max=3D100) : * Random numbers : Here are some random numbers: 14, 77, 75. -------------------------------------------------- 3. :results output org -> doesn't work with #+lob: -------------------------------------------------- #+srcname: randthree(n,max) #+begin_src ruby :results output org number =3D n maximum =3D max puts "* Random numbers\n" + "Here are some random numbers: " + (1..number).collect {|x| (rand * maximum).ceil }.join(", ") + "." #+end_src #+lob: randthree(n=3D3,max=3D10) #+resname: randthree(n=3D3,max=3D10) : nil -------------------------------------------------- 4. Not sure how to use string argument with #+lob: -------------------------------------------------- #+srcname: randfour(n,max,desc) #+begin_src ruby :results value description =3D desc number =3D n maximum =3D max "* Random numbers\n" + "Here are some #{description} numbers: " + (1..number).collect {|x| (rand * maximum).ceil }.join(", ") + "." #+end_src #+lob: randfour(n=3D3,max=3D100,desc=3D"lucky") #+resname: randfour(n=3D3,max=3D100,desc=3D"lucky") : randfour =0A=0A=0A