emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [patch] adding :prologue and :epilogue parameters for Maxima src blocks
@ 2017-01-05 15:07 Eric S Fraga
  2017-01-07 14:53 ` Nicolas Goaziou
       [not found] ` <375b747191414095afed5428fe55e5d3@HE1PR01MB1898.eurprd01.prod.exchangelabs.com>
  0 siblings, 2 replies; 5+ messages in thread
From: Eric S Fraga @ 2017-01-05 15:07 UTC (permalink / raw)
  To: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 335 bytes --]

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)

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-ob-maxima.el-add-prologue-and-epilogue-src-block-opt.patch --]
[-- Type: text/x-diff, Size: 1381 bytes --]

From 7b6a19418bd2e1fd4593939d825496618d86e65e Mon Sep 17 00:00:00 2001
From: Eric S Fraga <e.fraga@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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 194 bytes --]

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-01-09 12:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-05 15:07 [patch] adding :prologue and :epilogue parameters for Maxima src blocks Eric S Fraga
2017-01-07 14:53 ` Nicolas Goaziou
     [not found] ` <375b747191414095afed5428fe55e5d3@HE1PR01MB1898.eurprd01.prod.exchangelabs.com>
2017-01-08 14:22   ` Eric S Fraga
2017-01-08 23:39     ` Nicolas Goaziou
     [not found]     ` <8d9297470dab49329e0ca673f966e64c@HE1PR01MB1898.eurprd01.prod.exchangelabs.com>
2017-01-09  6:40       ` Eric S Fraga

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).