浏览代码

ob-maxima.el: Add prologue and epilogue src block options for Maxima

* ob-maxima.el (org-babel-maxima-expand): add contents of prologue and
  epilogue src block options to the body of code.
Eric S Fraga 8 年之前
父节点
当前提交
7d4b3bbdb7
共有 1 个文件被更改,包括 7 次插入1 次删除
  1. 7 1
      lisp/ob-maxima.el

+ 7 - 1
lisp/ob-maxima.el

@@ -48,9 +48,13 @@
 
 (defun org-babel-maxima-expand (body params)
   "Expand a block of Maxima code according to its header arguments."
-  (let ((vars (org-babel--get-vars params)))
+  (let ((vars (org-babel--get-vars params))
+	(epilogue (cdr (assq :epilogue params)))
+	(prologue (cdr (assq :prologue params))))
     (mapconcat 'identity
 	       (list
+		;; Any code from the specified prologue at the start.
+		prologue
 		;; graphic output
 		(let ((graphic-file (ignore-errors (org-babel-graphical-output-file params))))
 		  (if graphic-file
@@ -62,6 +66,8 @@
 		(mapconcat 'org-babel-maxima-var-to-maxima vars "\n")
 		;; body
 		body
+		;; Any code from the specified epilogue at the end.
+		epilogue
 		"gnuplot_close ()$")
 	       "\n")))