At the moment, org-babel’s Clojure evaluator assumes you’re running swank. But if you’ve made the switch from swank to nREPL, that’s not going to work. I bumped up against this problem this afternoon while writing this little Clojure-related blog post.
Getting org-babel to use nREPL is easy enough though. I’ve just added this to
(eval-after-load "ob-clojure" '(defun org-babel-execute:clojure (body params) "Execute a block of Clojure code with Babel and nREPL." (require 'nrepl) (if (nrepl-current-connection-buffer) (let ((result (nrepl-eval (org-babel-expand-body:clojure body params)))) (car (read-from-string (plist-get result :value)))) (error "nREPL not connected!"))))
It’s just a first pass. It works, but I’m not sure I’m handling all the
options correctly, so I’ll let it sit here for a while until I’ve
given it enough exercise to be worth submitting back to the main
project. Still, you might find it useful. Any feedback would be appreciated.