summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Davison <davison@stats.ox.ac.uk>2010-10-21 11:37:02 +0100
committerDan Davison <davison@stats.ox.ac.uk>2010-10-21 13:06:01 +0100
commit4eee123e17878bb0ac8672a770af70ba85371456 (patch)
tree5041e1b00d55a88cae4ff8c511cbe0ac9ff42736
parente3d9d21802c3c60876ce62b6cb40ec9379e2cafd (diff)
downloadorg-mode-4eee123e17878bb0ac8672a770af70ba85371456.tar.gz
babel: asymptote: New variable assignment scheme
* ob-asymptote.el (org-babel-execute:asymptote): Use generic expansion function (org-babel-expand-body:asymptote): Delete function (org-babel-variable-assignments:asymptote): New function
-rw-r--r--lisp/ob-asymptote.el15
1 files changed, 8 insertions, 7 deletions
diff --git a/lisp/ob-asymptote.el b/lisp/ob-asymptote.el
index aec880e..3b04b0b 100644
--- a/lisp/ob-asymptote.el
+++ b/lisp/ob-asymptote.el
@@ -55,12 +55,6 @@
'((:results . "file") (:exports . "results"))
"Default arguments when evaluating an Asymptote source block.")
-(defun org-babel-expand-body:asymptote (body params)
- "Expand BODY according to PARAMS, return the expanded body."
- (let ((vars (mapcar #'cdr (org-babel-get-header params :var))))
- (concat (mapconcat 'org-babel-asymptote-var-to-asymptote vars "\n")
- "\n" body "\n")))
-
(defun org-babel-execute:asymptote (body params)
"Execute a block of Asymptote code.
This function is called by `org-babel-execute-src-block'."
@@ -83,7 +77,9 @@ This function is called by `org-babel-execute-src-block'."
" " cmdline
" " (org-babel-process-file-name in-file))))
(with-temp-file in-file
- (insert (org-babel-expand-body:asymptote body params)))
+ (insert (org-babel-expand-body:generic
+ body params
+ (org-babel-variable-assignments:asymptote params))))
(message cmd) (shell-command cmd)
out-file))
@@ -92,6 +88,11 @@ This function is called by `org-babel-execute-src-block'."
Asymptote does not support sessions"
(error "Asymptote does not support sessions"))
+(defun org-babel-variable-assignments:asymptote (params)
+ "Return list of asymptote statements assigning the block's variables"
+ (mapcar #'org-babel-asymptote-var-to-asymptote
+ (mapcar #'cdr (org-babel-get-header params :var))))
+
(defun org-babel-asymptote-var-to-asymptote (pair)
"Convert an elisp value into an Asymptote variable.
The elisp value PAIR is converted into Asymptote code specifying