summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Davison <dandavison7@gmail.com>2010-12-20 18:58:59 +0000
committerDan Davison <dandavison7@gmail.com>2010-12-21 14:19:24 +0000
commit6bcbdce94964ad7004d494f26b190fd897afc266 (patch)
tree42f787b270874dd9433e9d748df4d66beec23436
parent366abc6175f7407f41ec1007aad51fdaebd4cba5 (diff)
downloadorg-mode-6bcbdce94964ad7004d494f26b190fd897afc266.tar.gz
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.
-rw-r--r--lisp/ob-R.el5
1 files changed, 5 insertions, 0 deletions
diff --git a/lisp/ob-R.el b/lisp/ob-R.el
index fbb813b..43d0fdf 100644
--- a/lisp/ob-R.el
+++ b/lisp/ob-R.el
@@ -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