From ec84430cf4e09ba25ec675debdf802bc28111e06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Delafond?= Date: Mon, 7 Nov 2016 10:41:54 +0100 Subject: Imported Upstream version 9.0 --- contrib/lisp/ob-mathomatic.el | 66 +++++++++++++++++++++---------------------- 1 file changed, 33 insertions(+), 33 deletions(-) (limited to 'contrib/lisp/ob-mathomatic.el') 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))) -- cgit v1.2.3