diff options
author | Sébastien Delafond <sdelafond@gmail.com> | 2016-11-07 10:41:54 +0100 |
---|---|---|
committer | Sébastien Delafond <sdelafond@gmail.com> | 2016-11-07 10:41:54 +0100 |
commit | 1a7cd65ca362047cd97d4127d49108994baebc6c (patch) | |
tree | f18735f3b77120ef2e91043f2f662b03e47ccbb0 /contrib/lisp/ob-mathomatic.el | |
parent | 55074078ca876273e3fa58ee6838cba90d2b6100 (diff) | |
parent | ec84430cf4e09ba25ec675debdf802bc28111e06 (diff) |
Merge tag 'upstream/9.0'
Upstream version 9.0
Diffstat (limited to 'contrib/lisp/ob-mathomatic.el')
-rw-r--r-- | contrib/lisp/ob-mathomatic.el | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/contrib/lisp/ob-mathomatic.el b/contrib/lisp/ob-mathomatic.el index 0ec1a5f..fc08d9f 100644 --- a/contrib/lisp/ob-mathomatic.el +++ b/contrib/lisp/ob-mathomatic.el @@ -49,45 +49,45 @@ (defun org-babel-mathomatic-expand (body params) "Expand a block of Mathomatic code according to its header arguments." - (let ((vars (mapcar #'cdr (org-babel-get-header params :var)))) - (mapconcat 'identity - (list - ;; graphic output - (let ((graphic-file (org-babel-mathomatic-graphical-output-file params))) - (if graphic-file - (cond - ((string-match ".\.eps$" graphic-file) - (format ;; Need to add command to send to file. - "set plot set terminal postscript eps\\;set output %S " - graphic-file)) - ((string-match ".\.ps$" graphic-file) - (format ;; Need to add command to send to file. - "set plot set terminal postscript\\;set output %S " - graphic-file)) - - ((string-match ".\.pic$" graphic-file) - (format ;; Need to add command to send to file. - "set plot set terminal gpic\\;set output %S " - graphic-file)) - (t - (format ;; Need to add command to send to file. - "set plot set terminal png\\;set output %S " - graphic-file))) - "")) - ;; variables - (mapconcat 'org-babel-mathomatic-var-to-mathomatic vars "\n") - ;; body - body - "") - "\n"))) + (let ((vars (org-babel--get-vars params))) + (mapconcat 'identity + (list + ;; graphic output + (let ((graphic-file (org-babel-mathomatic-graphical-output-file params))) + (if graphic-file + (cond + ((string-match ".\.eps$" graphic-file) + (format ;; Need to add command to send to file. + "set plot set terminal postscript eps\\;set output %S " + graphic-file)) + ((string-match ".\.ps$" graphic-file) + (format ;; Need to add command to send to file. + "set plot set terminal postscript\\;set output %S " + graphic-file)) + + ((string-match ".\.pic$" graphic-file) + (format ;; Need to add command to send to file. + "set plot set terminal gpic\\;set output %S " + graphic-file)) + (t + (format ;; Need to add command to send to file. + "set plot set terminal png\\;set output %S " + graphic-file))) + "")) + ;; variables + (mapconcat 'org-babel-mathomatic-var-to-mathomatic vars "\n") + ;; body + body + "") + "\n"))) (defun org-babel-execute:mathomatic (body params) "Execute a block of Mathomatic entries with org-babel. This function is called by `org-babel-execute-src-block'." (message "executing Mathomatic source code block") - (let ((result-params (split-string (or (cdr (assoc :results params)) ""))) + (let ((result-params (split-string (or (cdr (assq :results params)) ""))) (result - (let* ((cmdline (or (cdr (assoc :cmdline params)) "")) + (let* ((cmdline (or (cdr (assq :cmdline params)) "")) (in-file (org-babel-temp-file "mathomatic-" ".math")) (cmd (format "%s -t -c -q %s %s" org-babel-mathomatic-command in-file cmdline))) |