emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] [PATCH 1/1] ob-clojure.el: Add :ns to specify evaluation namespace


From: roberthambrock
Subject: [O] [PATCH 1/1] ob-clojure.el: Add :ns to specify evaluation namespace
Date: Wed, 28 Mar 2018 03:13:51 +0200

From: Robert Hambrock <address@hidden>

* 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]