From mboxrd@z Thu Jan  1 00:00:00 1970
From: roberthambrock@gmail.com
Subject: [PATCH 1/1] ob-clojure.el: Add :ns to specify evaluation namespace
Date: Wed, 28 Mar 2018 03:13:51 +0200
Message-ID: <20180328011351.6909-2-robert.hambrock@cern.ch>
References: <20180328011351.6909-1-robert.hambrock@cern.ch>
Return-path: <emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org>
Received: from eggs.gnu.org ([2001:4830:134:3::10]:34694)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <roberthambrock@gmail.com>) id 1f0zfi-0001BU-4T
	for emacs-orgmode@gnu.org; Tue, 27 Mar 2018 21:14:39 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <roberthambrock@gmail.com>) id 1f0zfe-0007Qo-4t
	for emacs-orgmode@gnu.org; Tue, 27 Mar 2018 21:14:38 -0400
Received: from mail-wr0-x235.google.com ([2a00:1450:400c:c0c::235]:44216)
	by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <roberthambrock@gmail.com>)
	id 1f0zfd-0007QQ-Us
	for emacs-orgmode@gnu.org; Tue, 27 Mar 2018 21:14:34 -0400
Received: by mail-wr0-x235.google.com with SMTP id u46so623683wrc.11
	for <emacs-orgmode@gnu.org>; Tue, 27 Mar 2018 18:14:33 -0700 (PDT)
In-Reply-To: <20180328011351.6909-1-robert.hambrock@cern.ch>
List-Id: "General discussions about Org-mode." <emacs-orgmode.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/emacs-orgmode>,
	<mailto:emacs-orgmode-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/emacs-orgmode/>
List-Post: <mailto:emacs-orgmode@gnu.org>
List-Help: <mailto:emacs-orgmode-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/emacs-orgmode>,
	<mailto:emacs-orgmode-request@gnu.org?subject=subscribe>
Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org
Sender: "Emacs-orgmode"
	<emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org>
To: emacs-orgmode@gnu.org
Cc: Robert Hambrock <roberthambrock@gmail.com>

From: Robert Hambrock <roberthambrock@gmail.com>

* lisp/ob-clojure.el (org-babel-execute:clojure): Implement :ns.
---
 lisp/ob-clojure.el | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/lisp/ob-clojure.el b/lisp/ob-clojure.el
index 890f60ada..b8c5c6375 100644
--- a/lisp/ob-clojure.el
+++ b/lisp/ob-clojure.el
@@ -109,7 +109,9 @@ using the :show-process parameter."
       (cider
        (require 'cider)
        (let ((result-params (cdr (assq :result-params params)))
-	     (show (cdr (assq :show-process params))))
+	     (show (cdr (assq :show-process params)))
+	     ;; if :ns is specified, use this in lieu of the default "user" ns
+	     (namespace (or (cdr (assq :ns params)) (cider-current-ns))))
          (if (member show '(nil "no"))
 	     ;; Run code without showing the process.
 	     (progn
@@ -118,7 +120,7 @@ using the :show-process parameter."
 			    org-babel-clojure-sync-nrepl-timeout))
 		       (nrepl-sync-request:eval expanded
 						(cider-current-connection)
-						(cider-current-ns))))
+						namespace)))
 	       (setq result
 		     (concat
 		      (nrepl-dict-get response
@@ -153,7 +155,7 @@ using the :show-process parameter."
 		;; Update the status of the nREPL output session.
 		(setq status (nrepl-dict-get response "status")))
 	      (cider-current-connection)
-	      (cider-current-ns))
+	      namespace)
 
 	     ;; Wait until the nREPL code finished to be processed.
 	     (while (not (member "done" status))
-- 
2.16.1