One half of this patch is a revert of c167a4ac32.
These changes are necessary so that :results output works correctly
with #+lob calls. For example the following example did not work:
--------------------------------------------------
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
When evaluating R code in a persistent session, lines of output
typically start with a single prompt character. However, under certain
circumstances, lines start with a concatenation of (primary and
secondary) prompt characters separated by spaces. This seems to be
related to having blank lines in the input. This fix ensures that all
such prompt characters are removed from the output.
And when merging header args, those from enclosing scopes take
precedence. For example, output to file from a source block is
implemented by (a) sending the output to file, and (b) having the
source block return the file name as its result. Before this change,
the file name returned could be set by a referenced source block (a
nested call), regardless of the value of the :file header arg of the
top-level source block.
Prior to this, reference resolution could fail with quoted
strings. E.g. this didn't work:
\#+srcname: py-id(a=1)
\#+begin_src python
a
\#+end_src
\#+lob: py-id(a="1")
This change allows org-file-properties to supply header args, and also
allows property inheritance if it has been enabled. Header-args
aquired from the item (or by inheritance) have precedence over those
aquired from org-file-properties.
If a [:file filename.ext] header arg is provided, then all graphical
output from the source block is captured on disk, and output of the
source block is a link to the resulting file, as with the
graphics-only languages such as gnuplot, ditaa, dot, asymptote. An
attempt is made to find a graphics device corresponding to the file
extension (currently .png, .jpg, .jpeg, .tiff, .bmp, .pdf, .ps,
.postscript are recognised); if that fails, png format output is
created.
Additionally, values for several arguments to the R graphics
device can be passed using header args:
:width :height :bg :units :pointsize
:antialias :quality :compression :res :type
:family :title :fonts :version :paper :encoding
:pagecentre :colormodel :useDingbats :horizontal
Arguments to the R graphics device that are not supported as header
args can be passed as a string in R argument syntax, using the header
arg :R-dev-args
An example block is (although both bg and fg can be passed directly as
header args)
\#+begin_src R :file z.pdf :width 8 :height 8 :R-dev-args bg="olivedrab", fg="hotpink"
plot(matrix(rnorm(100), ncol=2), type="l")
\#+end_src
This includes the required changes to org-babel.el and a
language-specific implementation for emacs-lisp. The emacs-lisp
changes are from a patch by Benny Andresen.
This allows python code to be tangled (i.e. extracted) correctly by
org-babel-tangle. Previously, if e.g. methods of a class were in
separate blocks, then they would be incorrectly indented as top-level
functions in the tangled output.