emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: roberthambrock@gmail.com
To: emacs-orgmode@gnu.org
Cc: Robert Hambrock <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	[thread overview]
Message-ID: <20180328011351.6909-2-robert.hambrock@cern.ch> (raw)
In-Reply-To: <20180328011351.6909-1-robert.hambrock@cern.ch>

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

  reply	other threads:[~2018-03-28  1:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-28  1:13 [PATCH 0/1] ob-clojure.el: Add :ns to specify evaluation namespace roberthambrock
2018-03-28  1:13 ` roberthambrock [this message]
2018-03-28 13:42   ` [PATCH 1/1] " stardiviner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180328011351.6909-2-robert.hambrock@cern.ch \
    --to=roberthambrock@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).