浏览代码

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.
Dan Davison 14 年之前
父节点
当前提交
6bcbdce949
共有 1 个文件被更改,包括 5 次插入0 次删除
  1. 5 0
      lisp/ob-R.el

+ 5 - 0
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