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

* Re: [patch] adding :prologue and :epilogue parameters for Maxima src blocks
  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>
  1 sibling, 0 replies; 5+ messages in thread
From: Nicolas Goaziou @ 2017-01-07 14:53 UTC (permalink / raw)
  To: emacs-orgmode

Hello,

Eric S Fraga <e.fraga@ucl.ac.uk> writes:

> 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.

Thank you. Applied.

Would you mind providing an ORG-NEWS entry for this?

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

Indeed. You are already in the Org Hall of Fame
(<http://orgmode.org/worg/org-contribute.html#contributors_with_fsf_papers>)

Regards,

-- 
Nicolas Goaziou

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

* Re: [patch] adding :prologue and :epilogue parameters for Maxima src blocks
       [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>
  0 siblings, 2 replies; 5+ messages in thread
From: Eric S Fraga @ 2017-01-08 14:22 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1028 bytes --]

On Saturday,  7 Jan 2017 at 14:53, Nicolas Goaziou wrote:
> Hello,
>
> Eric S Fraga <e.fraga@ucl.ac.uk> writes:
>
>> 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.
>
> Thank you. Applied.

Thank you!

> Would you mind providing an ORG-NEWS entry for this?

Sure although I'm not entirely sure what format you want this in nor how
long an entry you would like so here goes:

Babel options ":prologue" and ":epilogue" have been implemented for
Maxima src blocks which prepend and append, respectively, the given code
strings.  This can be useful for specifying formatting settings which
would add clutter to exported code.  For instance, you can use this
~:prologue "fpprintprec: 2; linel: 50;"~ for presenting Maxima results
in a beamer presentation.

Thanks again,
eric

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 26.0.50.1, Org release_9.0.2-104-gf5b7de

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 194 bytes --]

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

* Re: [patch] adding :prologue and :epilogue parameters for Maxima src blocks
  2017-01-08 14:22   ` Eric S Fraga
@ 2017-01-08 23:39     ` Nicolas Goaziou
       [not found]     ` <8d9297470dab49329e0ca673f966e64c@HE1PR01MB1898.eurprd01.prod.exchangelabs.com>
  1 sibling, 0 replies; 5+ messages in thread
From: Nicolas Goaziou @ 2017-01-08 23:39 UTC (permalink / raw)
  To: emacs-orgmode

Hello,

Eric S Fraga <e.fraga@ucl.ac.uk> writes:

> Sure although I'm not entirely sure what format you want this in nor how
> long an entry you would like so here goes:

Anything is fine as long as users are notified there was a change in
that area.

> Babel options ":prologue" and ":epilogue" have been implemented for
> Maxima src blocks which prepend and append, respectively, the given code
> strings.  This can be useful for specifying formatting settings which
> would add clutter to exported code.  For instance, you can use this
> ~:prologue "fpprintprec: 2; linel: 50;"~ for presenting Maxima results
> in a beamer presentation.

Applied. Thank you.

Regards,

-- 
Nicolas Goaziou

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

* Re: [patch] adding :prologue and :epilogue parameters for Maxima src blocks
       [not found]     ` <8d9297470dab49329e0ca673f966e64c@HE1PR01MB1898.eurprd01.prod.exchangelabs.com>
@ 2017-01-09  6:40       ` Eric S Fraga
  0 siblings, 0 replies; 5+ messages in thread
From: Eric S Fraga @ 2017-01-09  6:40 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 175 bytes --]

On Sunday,  8 Jan 2017 at 23:39, Nicolas Goaziou wrote:
> Applied. Thank you.

Thanks.

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 26.0.50.1, Org release_9.0.2-104-gf5b7de

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 194 bytes --]

^ permalink raw reply	[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).