emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH 0/1] ob-clojure.el: Add :ns to specify evaluation namespace
@ 2018-03-28  1:13 roberthambrock
  2018-03-28  1:13 ` [PATCH 1/1] " roberthambrock
  0 siblings, 1 reply; 3+ messages in thread
From: roberthambrock @ 2018-03-28  1:13 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Robert Hambrock

From: Robert Hambrock <roberthambrock@gmail.com>

Dear Org maintainer,

this patch implements namespace specification for Clojure source blocks, necessary in Org files with Clojure source blocks segregated from their applicable namespace declaration (Clojure source file, REPL declaration, or another source block).
As I will be making further patches in the future, please let me know if this is the most convenient formatting for you or if you have changes to suggest.

All the best,
Robert

Robert Hambrock (1):
  ob-clojure.el: Add :ns to specify evaluation namespace

 lisp/ob-clojure.el | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

-- 
2.16.1

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

* [PATCH 1/1] ob-clojure.el: Add :ns to specify evaluation namespace
  2018-03-28  1:13 [PATCH 0/1] ob-clojure.el: Add :ns to specify evaluation namespace roberthambrock
@ 2018-03-28  1:13 ` roberthambrock
  2018-03-28 13:42   ` stardiviner
  0 siblings, 1 reply; 3+ messages in thread
From: roberthambrock @ 2018-03-28  1:13 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Robert Hambrock

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

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

* Re: [PATCH 1/1] ob-clojure.el: Add :ns to specify evaluation namespace
  2018-03-28  1:13 ` [PATCH 1/1] " roberthambrock
@ 2018-03-28 13:42   ` stardiviner
  0 siblings, 0 replies; 3+ messages in thread
From: stardiviner @ 2018-03-28 13:42 UTC (permalink / raw)
  To: emacs-orgmode

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

This implementation has some problem that some side case are not handled.

Please reference this previous patch email:

https://lists.gnu.org/archive/html/emacs-orgmode/2018-03/msg00507.html




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

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

end of thread, other threads:[~2018-03-28 13:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-28  1:13 [PATCH 0/1] ob-clojure.el: Add :ns to specify evaluation namespace roberthambrock
2018-03-28  1:13 ` [PATCH 1/1] " roberthambrock
2018-03-28 13:42   ` stardiviner

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