ob-R: Respond to changes in handling of :file header argument

":results graphics" is now required in addition to ":file filename" in
order for graphical output to be sent automatically to file. If :file
is supplied, but not ":results graphics", then the default behavior
obtains: i.e., either "value" or "output" results are written to file,
depending on which of those options is in effect.

* lisp/ob-R.el (org-babel-R-graphical-output-file): New function
returns the name of the output file iff R has been instructed to send
graphical output to file by means of the ":results graphics"
directive.
(org-babel-expand-body:R): Use `org-babel-R-graphical-output-file'
when constructing the R code to evaluate, which may be augmented with
code implementing the writing of graohical output to file.
(org-babel-execute:R): Use `org-babel-R-graphical-output-file' to
determine whether R is taking responsibility for writing output to
file; if so, this is signalled to ob.el by returning a nil result.
This commit is contained in:
Dan Davison 2010-12-20 18:58:59 +00:00
parent 366abc6175
commit 6bcbdce949
1 changed files with 5 additions and 0 deletions

View File

@ -184,6 +184,11 @@ current code buffer."
(process-name (get-buffer-process session)))
(ess-make-buffer-current))
(defun org-babel-R-graphical-output-file (params)
"Name of file to which R should send graphical output."
(and (member "graphics" (cdr (assq :result-params params)))
(cdr (assq :file params))))
(defun org-babel-R-construct-graphics-device-call (out-file params)
"Construct the call to the graphics device."
(let ((devices