diff options
Diffstat (limited to 'lisp/org/ob-octave.el')
-rw-r--r-- | lisp/org/ob-octave.el | 37 |
1 files changed, 28 insertions, 9 deletions
diff --git a/lisp/org/ob-octave.el b/lisp/org/ob-octave.el index 2003a6f18f7..7de1455b820 100644 --- a/lisp/org/ob-octave.el +++ b/lisp/org/ob-octave.el @@ -5,7 +5,6 @@ ;; Author: Dan Davison ;; Keywords: literate programming, reproducible research ;; Homepage: http://orgmode.org -;; Version: 7.7 ;; This file is part of GNU Emacs. @@ -87,13 +86,24 @@ end") (org-babel-expand-body:generic body params (org-babel-variable-assignments:octave params))) (result (org-babel-octave-evaluate - session full-body result-type matlabp))) - (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)))))) + session + (if (org-babel-octave-graphical-output-file params) + (mapconcat 'identity + (list + "set (0, \"defaultfigurevisible\", \"off\");" + full-body + (format "print -dpng %s" (org-babel-octave-graphical-output-file params))) + "\n") + full-body) + result-type matlabp))) + (if (org-babel-octave-graphical-output-file params) + nil + (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." @@ -118,7 +128,11 @@ specifying a variable of the same value." (if (listp var) (concat "[" (mapconcat #'org-babel-octave-var-to-octave var (if (listp (car var)) "; " ",")) "]") - (format "%s" (or var "nil")))) + (cond + ((stringp var) + (format "\'%s\'" var)) + (t + (format "%s" var))))) (defun org-babel-prep-session:octave (session params &optional matlabp) "Prepare SESSION according to the header arguments specified in PARAMS." @@ -256,6 +270,11 @@ This removes initial blank and comment lines and then calls (match-string 1 string) string)) +(defun org-babel-octave-graphical-output-file (params) + "Name of file to which maxima should send graphical output." + (and (member "graphics" (cdr (assq :result-params params))) + (cdr (assq :file params)))) + (provide 'ob-octave) |