emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] ob-scheme: Handle :epilogue params
@ 2019-12-18  9:08 oldk1331
  2019-12-18 12:46 ` Neil Jerram
  2020-02-03 19:26 ` Bastien
  0 siblings, 2 replies; 3+ messages in thread
From: oldk1331 @ 2019-12-18  9:08 UTC (permalink / raw)
  To: emacs-orgmode

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

Hi all,

This is a simple change that adds support for :epilogue in ob-scheme.

Best wishes,
Qian

==========

* lisp/ob-scheme.el (org-babel-expand-body:scheme): Add :epilogue
  param support.

TINYCHANGE
---
 lisp/ob-scheme.el | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lisp/ob-scheme.el b/lisp/ob-scheme.el
index 21d9fad2b..ee0d93c13 100644
--- a/lisp/ob-scheme.el
+++ b/lisp/ob-scheme.el
@@ -71,7 +71,8 @@
 (defun org-babel-expand-body:scheme (body params)
   "Expand BODY according to PARAMS, return the expanded body."
   (let ((vars (org-babel--get-vars params))
-	(prepends (cdr (assq :prologue params))))
+	(prepends (cdr (assq :prologue params)))
+	(postpends (cdr (assq :epilogue params))))
     (concat (and prepends (concat prepends "\n"))
 	    (if (null vars) body
 	      (format "(let (%s)\n%s\n)"
@@ -80,7 +81,8 @@
 			 (format "%S" (print `(,(car var) ',(cdr var)))))
 		       vars
 		       "\n      ")
-		      body)))))
+		      body))
+	    (and postpends (concat "\n" postpends)))))


 (defvar org-babel-scheme-repl-map (make-hash-table :test #'equal)
-- 
2.24.0



[-- Attachment #2: 0001-ob-scheme-Handle-epilogue-params.patch --]
[-- Type: text/x-patch, Size: 1210 bytes --]

From 168aaf5ea6c855dfab96d1df6ea85996ba643253 Mon Sep 17 00:00:00 2001
From: Qian Yun <oldk1331@gmail.com>
Date: Wed, 18 Dec 2019 16:53:01 +0800
Subject: [PATCH] ob-scheme: Handle :epilogue params

* lisp/ob-scheme.el (org-babel-expand-body:scheme): Add :epilogue
  param support.

TINYCHANGE
---
 lisp/ob-scheme.el | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lisp/ob-scheme.el b/lisp/ob-scheme.el
index 21d9fad2b..ee0d93c13 100644
--- a/lisp/ob-scheme.el
+++ b/lisp/ob-scheme.el
@@ -71,7 +71,8 @@
 (defun org-babel-expand-body:scheme (body params)
   "Expand BODY according to PARAMS, return the expanded body."
   (let ((vars (org-babel--get-vars params))
-	(prepends (cdr (assq :prologue params))))
+	(prepends (cdr (assq :prologue params)))
+	(postpends (cdr (assq :epilogue params))))
     (concat (and prepends (concat prepends "\n"))
 	    (if (null vars) body
 	      (format "(let (%s)\n%s\n)"
@@ -80,7 +81,8 @@
 			 (format "%S" (print `(,(car var) ',(cdr var)))))
 		       vars
 		       "\n      ")
-		      body)))))
+		      body))
+	    (and postpends (concat "\n" postpends)))))
 
 
 (defvar org-babel-scheme-repl-map (make-hash-table :test #'equal)
-- 
2.24.0



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

* Re: [PATCH] ob-scheme: Handle :epilogue params
  2019-12-18  9:08 [PATCH] ob-scheme: Handle :epilogue params oldk1331
@ 2019-12-18 12:46 ` Neil Jerram
  2020-02-03 19:26 ` Bastien
  1 sibling, 0 replies; 3+ messages in thread
From: Neil Jerram @ 2019-12-18 12:46 UTC (permalink / raw)
  To: oldk1331; +Cc: Org Mode List

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

On Wed, 18 Dec 2019, 09:25 oldk1331, <oldk1331@gmail.com> wrote:

> Hi all,
>
> This is a simple change that adds support for :epilogue in ob-scheme.
>
> Best wishes,
> Qian
>
> ==========
>
> * lisp/ob-scheme.el (org-babel-expand-body:scheme): Add :epilogue
>   param support.
>
> TINYCHANGE
> ---
>  lisp/ob-scheme.el | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/lisp/ob-scheme.el b/lisp/ob-scheme.el
> index 21d9fad2b..ee0d93c13 100644
> --- a/lisp/ob-scheme.el
> +++ b/lisp/ob-scheme.el
> @@ -71,7 +71,8 @@
>  (defun org-babel-expand-body:scheme (body params)
>    "Expand BODY according to PARAMS, return the expanded body."
>    (let ((vars (org-babel--get-vars params))
> -       (prepends (cdr (assq :prologue params))))
> +       (prepends (cdr (assq :prologue params)))
> +       (postpends (cdr (assq :epilogue params))))
>      (concat (and prepends (concat prepends "\n"))
>             (if (null vars) body
>               (format "(let (%s)\n%s\n)"
> @@ -80,7 +81,8 @@
>                          (format "%S" (print `(,(car var) ',(cdr var)))))
>                        vars
>                        "\n      ")
> -                     body)))))
> +                     body))
> +           (and postpends (concat "\n" postpends)))))
>
>
>  (defvar org-babel-scheme-repl-map (make-hash-table :test #'equal)
> --
> 2.24.0
>

LGTM as another ob-scheme user. I don't think Scheme code should need the
"\n", but it's consistent with the existing handling for prologue.

Best wishes,
      Neil

[-- Attachment #2: Type: text/html, Size: 2451 bytes --]

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

* Re: [PATCH] ob-scheme: Handle :epilogue params
  2019-12-18  9:08 [PATCH] ob-scheme: Handle :epilogue params oldk1331
  2019-12-18 12:46 ` Neil Jerram
@ 2020-02-03 19:26 ` Bastien
  1 sibling, 0 replies; 3+ messages in thread
From: Bastien @ 2020-02-03 19:26 UTC (permalink / raw)
  To: oldk1331; +Cc: emacs-orgmode

Hi Qian,

applied to master, thanks!

-- 
 Bastien

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

end of thread, other threads:[~2020-02-03 19:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-18  9:08 [PATCH] ob-scheme: Handle :epilogue params oldk1331
2019-12-18 12:46 ` Neil Jerram
2020-02-03 19:26 ` Bastien

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