emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Eric S Fraga <e.fraga@ucl.ac.uk>
To: emacs-orgmode@gnu.org
Subject: [patch] adding :prologue and :epilogue parameters for Maxima src blocks
Date: Thu, 05 Jan 2017 15:07:49 +0000	[thread overview]
Message-ID: <8760lta6ka.fsf@ucl.ac.uk> (raw)


[-- 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 --]

             reply	other threads:[~2017-01-05 15:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-05 15:07 Eric S Fraga [this message]
2017-01-07 14:53 ` [patch] adding :prologue and :epilogue parameters for Maxima src blocks 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8760lta6ka.fsf@ucl.ac.uk \
    --to=e.fraga@ucl.ac.uk \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).