From 2759b6621db495a8f64aa9d713b3e36028b41f64 Mon Sep 17 00:00:00 2001 From: Eric Schulte Date: Thu, 15 Apr 2010 23:07:57 -0600 Subject: [PATCH] org-babel-expand-body:octave --- contrib/babel/lisp/langs/org-babel-octave.el | 22 ++++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/contrib/babel/lisp/langs/org-babel-octave.el b/contrib/babel/lisp/langs/org-babel-octave.el index 740e156be..72183a155 100644 --- a/contrib/babel/lisp/langs/org-babel-octave.el +++ b/contrib/babel/lisp/langs/org-babel-octave.el @@ -41,6 +41,18 @@ (defvar org-babel-octave-shell-command "octave -q" "Shell command to use to run octave as an external process.") +(defun org-babel-expand-body:octave (org-babel-process-params params) + (let ((vars (second (or processed-params (org-babel-process-params params))))) + (concat + ;; prepend code to define all arguments passed to the code block + ;; (may not be appropriate for all languages) + (mapconcat + (lambda (pair) + (format "%s=%s" + (car pair) + (org-babel-octave-var-to-octave (cdr pair)))) + vars "\n") "\n" body "\n"))) + (defun org-babel-execute:octave (body params &optional matlabp) "Execute a block of octave code with org-babel." (message (format "executing %s source code block" (if matlabp "matlab" "octave"))) @@ -52,15 +64,7 @@ (result-params (third processed-params)) (result-type (fourth processed-params)) (out-file (cdr (assoc :file params))) - (augmented-body (concat - ;; prepend code to define all arguments passed to the code block - ;; (may not be appropriate for all languages) - (mapconcat - (lambda (pair) - (format "%s=%s" - (car pair) - (org-babel-octave-var-to-octave (cdr pair)))) - vars "\n") "\n" body "\n")) + (augmented-body (org-babel-expand-body:octave body params processed-params)) (result (org-babel-octave-evaluate session augmented-body result-type matlabp))) (or out-file (org-babel-reassemble-table