Re: [Orgmode] [babel] Is :results output inline possible
-- 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). Hello Dan, Wow - that was fixed quickly ! org-mode is a great package, and babel and #+lob bring such nice integration with several useful languages. I'm probably just beginning to realize the potential. Thanks very much for your response, al ___ 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
Re: [Orgmode] [babel] Is :results output inline possible
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? (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 ? The 4 examples below show things I have tried. 1. and 2. work fine. 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 = 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
Re: [Orgmode] [babel] Is :results output inline possible
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? (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 ? The 4 examples below show things I have tried. 1. and 2. work fine. 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 = 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
Re: [Orgmode] [babel] Is :results output inline possible
Hi Al, emailorama emailor...@yahoo.com.au writes: [...] Also, I've been looking at #+lob: which looks like another really useful idea, Yes, #+lob calls are the canonical way to hide source code in org-babel; with this approach, source blocks are viewed more as function definitions with arguments than as executable blocks that produce output, and the #+lob line is used to call the function and actually do something. There have been a few examples on the list recently where it would make sense to use #+lob. I've fixed a few things related to #+lob recently and will post some more documentation on Worg soon. 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 ? Both these were bugs, which are fixed in my development branch -- they should be merged into org-core by Eric soon. 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 --8---cut here---start-8--- * 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. --8---cut here---end---8--- 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 =
Re: [Orgmode] [babel] Is :results output inline possible
Dan Davison davi...@stats.ox.ac.uk 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
Re: [Orgmode] [babel] Is :results output inline possible ?
Hi al, This is currently possible by adding either raw or org to your results headers. So the following should work. #+srcname: demoruby #+begin_src ruby :results output org require 'date' puts * heading for demo puts This demo done on #{Date.today} puts Try to create a table in org-mode syntax puts | letter | number | puts |-| puts | a | 1 | puts | b | 2 | #+end_src I need to update the documentation to reflect some of the more recent development. Best -- Eric emailorama emailor...@yahoo.com.au writes: The org-babel package looks very nice. Thanks to Eric for doing this. It seems to have so many possibilities. I wonder, is it possible to get inline output ? It seems to be very close to the existing option :results output but would just put the output inline rather than in a quoted block. (So maybe it would need a closing delimiter, as in the example below). This would allow writing a program to generate output in org-mode syntax. This effect might also be thought of as a sort of multilingual macro replacement. Right now I can get this effect by simply removing the : characters from the beginning of each line of the quoted block results. But it seems like there must be cleaner ways to do it. If not, could this be considered a feature request ? An example (demo) is shown below, in the ruby language. (although the idea is not specific to ruby - it would apply to other languages as well) I'm not sure what the best name such an option would be. Maybe inline or org. Thank you for any thoughts about this, al currently got #+srcname: demoruby #+begin_src ruby :results output require 'date' puts * heading for demo puts This demo done on #{Date.today} puts Try to create a table in org-mode syntax puts | letter | number | puts |-| puts | a | 1 | puts | b | 2 | #+end_src #+resname: demoruby : * heading for demo : This demo done on 2009-10-19 : Try to create a table in org-mode syntax : | letter | number | : |-| : | a | 1 | : | b | 2 | would like something like this #+srcname: demoruby #+begin_src ruby :results output inline require 'date' puts * heading for demo puts This demo done on #{Date.today} puts Try to create a table in org-mode syntax puts | letter | number | puts |-| puts | a | 1 | puts | b | 2 | #+end_src #+resname: demoruby * heading for demo This demo done on 2009-10-19 Try to create a table in org-mode syntax | letter | number | |+| | a | 1 | | b | 2 | #+endresname: demoruby ___ 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
[Orgmode] [babel] Is :results output inline possible ?
The org-babel package looks very nice. Thanks to Eric for doing this. It seems to have so many possibilities. I wonder, is it possible to get inline output ? It seems to be very close to the existing option :results output but would just put the output inline rather than in a quoted block. (So maybe it would need a closing delimiter, as in the example below). This would allow writing a program to generate output in org-mode syntax. This effect might also be thought of as a sort of multilingual macro replacement. Right now I can get this effect by simply removing the : characters from the beginning of each line of the quoted block results. But it seems like there must be cleaner ways to do it. If not, could this be considered a feature request ? An example (demo) is shown below, in the ruby language. (although the idea is not specific to ruby - it would apply to other languages as well) I'm not sure what the best name such an option would be. Maybe inline or org. Thank you for any thoughts about this, al currently got #+srcname: demoruby #+begin_src ruby :results output require 'date' puts * heading for demo puts This demo done on #{Date.today} puts Try to create a table in org-mode syntax puts | letter | number | puts |-| puts | a | 1 | puts | b | 2 | #+end_src #+resname: demoruby : * heading for demo : This demo done on 2009-10-19 : Try to create a table in org-mode syntax : | letter | number | : |-| : | a | 1 | : | b | 2 | would like something like this #+srcname: demoruby #+begin_src ruby :results output inline require 'date' puts * heading for demo puts This demo done on #{Date.today} puts Try to create a table in org-mode syntax puts | letter | number | puts |-| puts | a | 1 | puts | b | 2 | #+end_src #+resname: demoruby * heading for demo This demo done on 2009-10-19 Try to create a table in org-mode syntax | letter | number | |+| | a | 1 | | b | 2 | #+endresname: demoruby ___ 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