Hello,

Please find attached a small patch for consideration.  This patch adds
two new parameters to the Maxima babel src blocks: prologue and
epilogue, as already exist for gnuplot for instance.

I have signed the copyright assignment already (many years ago).

Thanks,
eric

-- 
Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D)
From 7b6a19418bd2e1fd4593939d825496618d86e65e Mon Sep 17 00:00:00 2001
From: Eric S Fraga <e.fr...@ucl.ac.uk>
Date: Thu, 5 Jan 2017 15:03:05 +0000
Subject: [PATCH] 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.
---
 lisp/ob-maxima.el | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/lisp/ob-maxima.el b/lisp/ob-maxima.el
index 4d16156ce..9ff9ff346 100644
--- a/lisp/ob-maxima.el
+++ b/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")))
 
-- 
2.11.0

Attachment: signature.asc
Description: PGP signature

Reply via email to