summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Davison <dandavison7@gmail.com>2010-12-21 10:21:28 +0000
committerDan Davison <dandavison7@gmail.com>2010-12-21 14:19:24 +0000
commite030d95ddb226542c9c01c15fefa7041b2270ef2 (patch)
tree22a68c50e6d370f4f264525beba52cd0508f7951
parent6bcbdce94964ad7004d494f26b190fd897afc266 (diff)
downloadorg-mode-e030d95ddb226542c9c01c15fefa7041b2270ef2.tar.gz
ob: language-specific changes in response to :file arg changes
These languages are capable of writing results to file; for several of them this is their only mode of operation. These changes cause the languages to return to ob.el either the computed result, or nil, when they have written results to file themselves. This is in place of the previous method of returning the output file name as a string to ob.el. * lisp/ob-asymptote.el (org-babel-execute:asymptote): Return nil to signal that the intended content has been written to file. * lisp/ob-ditaa.el (org-babel-execute:ditaa): Return nil to signal that the intended content has been written to file. * lisp/ob-dot.el (org-babel-execute:dot): Return nil to signal that the intended content has been written to file. * lisp/ob-gnuplot.el (org-babel-execute:gnuplot): Return nil to signal that the intended content has been written to file. * lisp/ob-latex.el (org-babel-execute:latex): Return nil to signal that the intended content has been written to file. * lisp/ob-mscgen.el (org-babel-execute:mscgen): Return nil to signal that the intended content has been written to file. * lisp/ob-octave.el (org-babel-execute:octave): Return result; not name of output file. * lisp/ob-plantuml.el (org-babel-execute:plantuml): Return nil to signal that the intended content has been written to file. * lisp/ob-python.el (org-babel-execute:python): Return result; not name of output file. * lisp/ob-ruby.el (org-babel-execute:ruby): Return result; not name of output file. * lisp/ob-sass.el (org-babel-execute:sass): Return nil if result has been written to file
-rw-r--r--lisp/ob-asymptote.el2
-rw-r--r--lisp/ob-ditaa.el2
-rw-r--r--lisp/ob-dot.el2
-rw-r--r--lisp/ob-gnuplot.el2
-rw-r--r--lisp/ob-latex.el2
-rw-r--r--lisp/ob-mscgen.el2
-rw-r--r--lisp/ob-octave.el13
-rw-r--r--lisp/ob-plantuml.el2
-rw-r--r--lisp/ob-python.el13
-rw-r--r--lisp/ob-ruby.el13
-rw-r--r--lisp/ob-sass.el4
11 files changed, 28 insertions, 29 deletions
diff --git a/lisp/ob-asymptote.el b/lisp/ob-asymptote.el
index ab2abda..bc40570 100644
--- a/lisp/ob-asymptote.el
+++ b/lisp/ob-asymptote.el
@@ -80,7 +80,7 @@ This function is called by `org-babel-execute-src-block'."
body params
(org-babel-variable-assignments:asymptote params))))
(message cmd) (shell-command cmd)
- out-file))
+ nil)) ;; signal that output has already been written to file
(defun org-babel-prep-session:asymptote (session params)
"Return an error if the :session header argument is set.
diff --git a/lisp/ob-ditaa.el b/lisp/ob-ditaa.el
index 097f938..b5a86e9 100644
--- a/lisp/ob-ditaa.el
+++ b/lisp/ob-ditaa.el
@@ -61,7 +61,7 @@ This function is called by `org-babel-execute-src-block'."
(error "Could not find ditaa.jar at %s" org-ditaa-jar-path))
(with-temp-file in-file (insert body))
(message cmd) (shell-command cmd)
- out-file))
+ nil)) ;; signal that output has already been written to file
(defun org-babel-prep-session:ditaa (session params)
"Return an error because ditaa does not support sessions."
diff --git a/lisp/ob-dot.el b/lisp/ob-dot.el
index 36baddb..1c309b0 100644
--- a/lisp/ob-dot.el
+++ b/lisp/ob-dot.el
@@ -77,7 +77,7 @@ This function is called by `org-babel-execute-src-block'."
" " (org-babel-process-file-name in-file)
" " cmdline
" -o " (org-babel-process-file-name out-file)) "")
- out-file))
+ nil)) ;; signal that output has already been written to file
(defun org-babel-prep-session:dot (session params)
"Return an error because Dot does not support sessions."
diff --git a/lisp/ob-gnuplot.el b/lisp/ob-gnuplot.el
index 423e47e..bc747d4 100644
--- a/lisp/ob-gnuplot.el
+++ b/lisp/ob-gnuplot.el
@@ -157,7 +157,7 @@ This function is called by `org-babel-execute-src-block'."
(gnuplot-send-buffer-to-gnuplot)))
(if (member "output" (split-string result-type))
output
- out-file))))
+ nil)))) ;; signal that output has already been written to file
(defun org-babel-prep-session:gnuplot (session params)
"Prepare SESSION according to the header arguments in PARAMS."
diff --git a/lisp/ob-latex.el b/lisp/ob-latex.el
index 96afbcd..8943ded 100644
--- a/lisp/ob-latex.el
+++ b/lisp/ob-latex.el
@@ -122,7 +122,7 @@ This function is called by `org-babel-execute-src-block'."
((string-match "\\.\\([^\\.]+\\)$" out-file)
(error "can not create %s files, please specify a .png or .pdf file"
(match-string 1 out-file))))
- out-file)
+ nil) ;; signal that output has already been written to file
body))
(defun org-babel-latex-tex-to-pdf (file)
diff --git a/lisp/ob-mscgen.el b/lisp/ob-mscgen.el
index 98230da..5f0e463 100644
--- a/lisp/ob-mscgen.el
+++ b/lisp/ob-mscgen.el
@@ -73,7 +73,7 @@ mscgen supported formats."
(error "
ERROR: no output file specified. Add \":file name.png\" to the src header"))
(org-babel-eval (concat "mscgen -T " filetype " -o " out-file) body)
- out-file))
+ nil)) ;; signal that output has already been written to file
(defun org-babel-prep-session:mscgen (session params)
"Raise an error because Mscgen doesn't support sessions."
diff --git a/lisp/ob-octave.el b/lisp/ob-octave.el
index 9fcd825..92f16be 100644
--- a/lisp/ob-octave.el
+++ b/lisp/ob-octave.el
@@ -88,13 +88,12 @@ end")
body params (org-babel-variable-assignments:octave params)))
(result (org-babel-octave-evaluate
session full-body result-type matlabp)))
- (or out-file
- (org-babel-reassemble-table
- result
- (org-babel-pick-name
- (cdr (assoc :colname-names params)) (cdr (assoc :colnames params)))
- (org-babel-pick-name
- (cdr (assoc :rowname-names params)) (cdr (assoc :rownames params)))))))
+ (org-babel-reassemble-table
+ result
+ (org-babel-pick-name
+ (cdr (assoc :colname-names params)) (cdr (assoc :colnames params)))
+ (org-babel-pick-name
+ (cdr (assoc :rowname-names params)) (cdr (assoc :rownames params))))))
(defun org-babel-prep-session:matlab (session params)
"Prepare SESSION according to PARAMS."
diff --git a/lisp/ob-plantuml.el b/lisp/ob-plantuml.el
index fb81dc8..5159f6a 100644
--- a/lisp/ob-plantuml.el
+++ b/lisp/ob-plantuml.el
@@ -70,7 +70,7 @@ This function is called by `org-babel-execute-src-block'."
(error "Could not find plantuml.jar at %s" org-plantuml-jar-path))
(with-temp-file in-file (insert (concat "@startuml\n" body "\n@enduml")))
(message "%s" cmd) (org-babel-eval cmd "")
- out-file))
+ nil)) ;; signal that output has already been written to file
(defun org-babel-prep-session:plantuml (session params)
"Return an error because plantuml does not support sessions."
diff --git a/lisp/ob-python.el b/lisp/ob-python.el
index b5b546c..2660cc1 100644
--- a/lisp/ob-python.el
+++ b/lisp/ob-python.el
@@ -66,13 +66,12 @@ This function is called by `org-babel-execute-src-block'."
params (org-babel-variable-assignments:python params)))
(result (org-babel-python-evaluate
session full-body result-type result-params preamble)))
- (or (cdr (assoc :file params))
- (org-babel-reassemble-table
- result
- (org-babel-pick-name (cdr (assoc :colname-names params))
- (cdr (assoc :colnames params)))
- (org-babel-pick-name (cdr (assoc :rowname-names params))
- (cdr (assoc :rownames params)))))))
+ (org-babel-reassemble-table
+ result
+ (org-babel-pick-name (cdr (assoc :colname-names params))
+ (cdr (assoc :colnames params)))
+ (org-babel-pick-name (cdr (assoc :rowname-names params))
+ (cdr (assoc :rownames params))))))
(defun org-babel-prep-session:python (session params)
"Prepare SESSION according to the header arguments in PARAMS.
diff --git a/lisp/ob-ruby.el b/lisp/ob-ruby.el
index 3f2af39..b13eb03 100644
--- a/lisp/ob-ruby.el
+++ b/lisp/ob-ruby.el
@@ -63,13 +63,12 @@ This function is called by `org-babel-execute-src-block'."
body params (org-babel-variable-assignments:ruby params)))
(result (org-babel-ruby-evaluate
session full-body result-type result-params)))
- (or (cdr (assoc :file params))
- (org-babel-reassemble-table
- result
- (org-babel-pick-name (cdr (assoc :colname-names params))
- (cdr (assoc :colnames params)))
- (org-babel-pick-name (cdr (assoc :rowname-names params))
- (cdr (assoc :rownames params)))))))
+ (org-babel-reassemble-table
+ result
+ (org-babel-pick-name (cdr (assoc :colname-names params))
+ (cdr (assoc :colnames params)))
+ (org-babel-pick-name (cdr (assoc :rowname-names params))
+ (cdr (assoc :rownames params))))))
(defun org-babel-prep-session:ruby (session params)
"Prepare SESSION according to the header arguments specified in PARAMS."
diff --git a/lisp/ob-sass.el b/lisp/ob-sass.el
index b3acc8b..7075daf 100644
--- a/lisp/ob-sass.el
+++ b/lisp/ob-sass.el
@@ -56,7 +56,9 @@ This function is called by `org-babel-execute-src-block'."
" " (org-babel-process-file-name out-file))))
(with-temp-file in-file
(insert (org-babel-expand-body:generic body params))) (shell-command cmd)
- (or file (with-temp-buffer (insert-file-contents out-file) (buffer-string)))))
+ (if file
+ nil ;; signal that output has already been written to file
+ (with-temp-buffer (insert-file-contents out-file) (buffer-string)))))
(defun org-babel-prep-session:sass (session params)
"Raise an error because sass does not support sessions."