From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Davison Subject: Re: [babel] Is ":results output inline" possible Date: Tue, 20 Oct 2009 11:20:46 -0400 Message-ID: <87oco2ozw1.fsf@stats.ox.ac.uk> References: <491466.67684.qm@web111303.mail.gq1.yahoo.com> <87ws2q41uk.fsf@stats.ox.ac.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1N0GW7-0005tA-Rx for emacs-orgmode@gnu.org; Tue, 20 Oct 2009 11:20:55 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1N0GW3-0005s8-5o for emacs-orgmode@gnu.org; Tue, 20 Oct 2009 11:20:55 -0400 Received: from [199.232.76.173] (port=38354 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N0GW3-0005s5-0R for emacs-orgmode@gnu.org; Tue, 20 Oct 2009 11:20:51 -0400 Received: from markov.stats.ox.ac.uk ([163.1.210.1]:59354) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1N0GW2-0000CU-0c for emacs-orgmode@gnu.org; Tue, 20 Oct 2009 11:20:50 -0400 In-Reply-To: <87ws2q41uk.fsf@stats.ox.ac.uk> (Dan Davison's message of "Tue, 20 Oct 2009 09:44:03 -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: emailorama Cc: emacs-orgmode@gnu.org Dan Davison writes: [...] >> >> -- Is it possible to use #+lob: with ":results output org" ? >> >> -- Is it possible for #+lob: to take a string argument ? > > Both these were bugs, which are fixed in my development branch -- they > should be merged into org-core by Eric soon. Those changes are in the main org git repo now, so your examples should work. Note that with your third example, the header args need to be placed on the #+lob line rather than with the source block, so that #+lob knows that it is to output org code (header args placed with #+lob are inherited by the referenced source block). Dan * test -------------------------------------------------- 3. :results output org -> doesn't work with #+lob: -------------------------------------------------- #+srcname: randthree(n,max) #+begin_src ruby number = n maximum = max puts "* Random numbers\n" + "Here are some random numbers: " + (1..number).collect {|x| (rand * maximum).ceil }.join(", ") + "." #+end_src #+lob: randthree(n=3,max=10) :results output raw #+resname: randthree(n=3,max=10) * Random numbers Here are some random numbers: 5, 1, 10. > My output from your examples is below. > > Thanks a lot for the testing. > > Dan > >> >> The 4 examples below show things I have tried. >> 1. and 2. work fine. >> 3. and 4. are what I can't work out. >> > > Here's my output > > * Al tests (emailorama) > -------------------------------------------------- > 1. :results output org -> works > -------------------------------------------------- > #+srcname: randone > #+begin_src ruby :results output org > description = "lucky" > number = 3 > maximum = 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: 15, 52, 93. > > > > -------------------------------------------------- > 2. :results value -> works with #+lob: > -------------------------------------------------- > #+srcname: randtwo(n,max) > #+begin_src ruby :results value > number = n > maximum = max > "* Random numbers\n" + > "Here are some random numbers: " + > (1..number).collect {|x| (rand * maximum).ceil }.join(", ") + > "." > #+end_src > > #+lob: randtwo(n=3,max=100) > > #+resname: randtwo(n=3,max=100) > : * Random numbers > : Here are some random numbers: 47, 100, 38. > > > > > -------------------------------------------------- > 3. :results output org -> doesn't work with #+lob: > -------------------------------------------------- > #+srcname: randthree(n,max) > #+begin_src ruby > number = n > maximum = max > puts "* Random numbers\n" + > "Here are some random numbers: " + > (1..number).collect {|x| (rand * maximum).ceil }.join(", ") + > "." > #+end_src > > #+lob: randthree(n=3,max=10) :results output org > > #+resname: randthree(n=3,max=10) > * Random numbers > Here are some random numbers: 9, 3, 7. > > > -------------------------------------------------- > 4. Not sure how to use string argument with #+lob: > -------------------------------------------------- > #+srcname: randfour(n,max,desc) > #+begin_src ruby :results value > description = desc > number = n > maximum = max > "* Random numbers\n" + > "Here are some #{description} numbers: " + > (1..number).collect {|x| (rand * maximum).ceil }.join(", ") + > "." > #+end_src > > #+lob: randfour(n=3,max=100,desc="lucky") > > #+resname: randfour(n=3,max=100,desc="lucky") > : * Random numbers > : Here are some lucky numbers: 65, 24, 42. > > > > > >> Thanks for any ideas you have about these things. >> >> al >> >> -------------------------------------------------- >> 1. :results output org -> works >> -------------------------------------------------- >> #+srcname: randone >> #+begin_src ruby :results output org >> description = "lucky" >> number = 3 >> maximum = 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 = n >> maximum = max >> "* Random numbers\n" + >> "Here are some random numbers: " + >> (1..number).collect {|x| (rand * maximum).ceil }.join(", ") + >> "." >> #+end_src >> >> #+lob: randtwo(n=3,max=100) >> >> #+resname: randtwo(n=3,max=100) >> : * 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 = n >> maximum = max >> puts "* Random numbers\n" + >> "Here are some random numbers: " + >> (1..number).collect {|x| (rand * maximum).ceil }.join(", ") + >> "." >> #+end_src >> >> #+lob: randthree(n=3,max=10) >> >> #+resname: randthree(n=3,max=10) >> : nil >> >> >> -------------------------------------------------- >> 4. Not sure how to use string argument with #+lob: >> -------------------------------------------------- >> #+srcname: randfour(n,max,desc) >> #+begin_src ruby :results value >> description = desc >> number = n >> maximum = max >> "* Random numbers\n" + >> "Here are some #{description} numbers: " + >> (1..number).collect {|x| (rand * maximum).ceil }.join(", ") + >> "." >> #+end_src >> >> #+lob: randfour(n=3,max=100,desc="lucky") >> >> #+resname: randfour(n=3,max=100,desc="lucky") >> : randfour >> >> >> >> >> >> >> _______________________________________________ >> Emacs-orgmode mailing list >> Remember: use `Reply All' to send replies to the list. >> Emacs-orgmode@gnu.org >> http://lists.gnu.org/mailman/listinfo/emacs-orgmode > > > > _______________________________________________ > Emacs-orgmode mailing list > Remember: use `Reply All' to send replies to the list. > Emacs-orgmode@gnu.org > http://lists.gnu.org/mailman/listinfo/emacs-orgmode