From mboxrd@z Thu Jan 1 00:00:00 1970 From: Neil Jerram Subject: Re: [PATCH] ob-scheme: Handle :epilogue params Date: Wed, 18 Dec 2019 12:46:43 +0000 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000ece54d0599f9d692" Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:59014) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihYjE-0008H0-7w for emacs-orgmode@gnu.org; Wed, 18 Dec 2019 07:47:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihYjC-0001nD-R5 for emacs-orgmode@gnu.org; Wed, 18 Dec 2019 07:46:59 -0500 Received: from mail-qt1-x843.google.com ([2607:f8b0:4864:20::843]:34733) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihYjC-0001jp-KZ for emacs-orgmode@gnu.org; Wed, 18 Dec 2019 07:46:58 -0500 Received: by mail-qt1-x843.google.com with SMTP id 5so1849935qtz.1 for ; Wed, 18 Dec 2019 04:46:56 -0800 (PST) In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: oldk1331 Cc: Org Mode List --000000000000ece54d0599f9d692 Content-Type: text/plain; charset="UTF-8" On Wed, 18 Dec 2019, 09:25 oldk1331, 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 --000000000000ece54d0599f9d692 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


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

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

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

TINYCHANGE
---
=C2=A0lisp/ob-scheme.el | 6 ++++--
=C2=A01 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 @@
=C2=A0(defun org-babel-expand-body:scheme (body params)
=C2=A0 =C2=A0"Expand BODY according to PARAMS, return the expanded bod= y."
=C2=A0 =C2=A0(let ((vars (org-babel--get-vars params))
-=C2=A0 =C2=A0 =C2=A0 =C2=A0(prepends (cdr (assq :prologue params))))
+=C2=A0 =C2=A0 =C2=A0 =C2=A0(prepends (cdr (assq :prologue params)))
+=C2=A0 =C2=A0 =C2=A0 =C2=A0(postpends (cdr (assq :epilogue params))))
=C2=A0 =C2=A0 =C2=A0(concat (and prepends (concat prepends "\n"))=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (if (null vars) body
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (format "(let (%s)\n%= s\n)"
@@ -80,7 +81,8 @@
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0(format "%S" (print `(,(car var) ',(cdr var)= ))))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0vars
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0"\n=C2=A0 =C2=A0 =C2=A0 ")
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0body)))))
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0body))
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(and postpends (concat "\n&q= uot; postpends)))))


=C2=A0(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 wish= es,
=C2=A0 =C2=A0 =C2=A0 Neil

--000000000000ece54d0599f9d692--