summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Guerry <bzg@altern.org>2014-01-30 12:10:37 +0100
committerBastien Guerry <bzg@altern.org>2014-01-30 12:10:37 +0100
commitde087d0bbe994299e7c9e1209de2da9b4d587f7e (patch)
tree44ec6c62fae0def5b3127308f44fbd1d10db7b70
parentcf2c7e9f18ef0cd21f4dfd1102d8fd70ed189a44 (diff)
downloadorg-mode-de087d0bbe994299e7c9e1209de2da9b4d587f7e.tar.gz
ob-clojure.el (org-babel-execute:clojure): Fix output
* ob-clojure.el (org-babel-execute:clojure): Use `org-babel-result-cond' to create the correct output. Thanks to Soapy Smith who reported this and to Eric Schulte for providing the fix.
-rw-r--r--lisp/ob-clojure.el41
1 files changed, 22 insertions, 19 deletions
diff --git a/lisp/ob-clojure.el b/lisp/ob-clojure.el
index 0e0c7b3..cdf453e 100644
--- a/lisp/ob-clojure.el
+++ b/lisp/ob-clojure.el
@@ -101,37 +101,40 @@
(defun org-babel-execute:clojure (body params)
"Execute a block of Clojure code with Babel."
- (let ((expanded (org-babel-expand-body:clojure body params)))
+ (let ((expanded (org-babel-expand-body:clojure body params))
+ result)
(case org-babel-clojure-backend
(cider
(require 'cider)
- (or (nth 1 (nrepl-send-string-sync
+ (setq result
+ (or (cider-get-raw-value
+ (cider-eval-sync
expanded
(cider-current-ns)
(nrepl-current-tooling-session)))
- (error "nREPL not connected! Use M-x cider-jack-in RET")))
+ (error "nREPL not connected! Use M-x cider-jack-in RET"))))
(nrepl
(require 'nrepl)
- (if (nrepl-current-connection-buffer)
- (let* ((result (nrepl-eval expanded))
- (s (plist-get result :stdout))
- (r (plist-get result :value)))
- (if s (concat s "\n" r) r))
- (error "nREPL not connected! Use M-x nrepl-jack-in RET")))
+ (setq result
+ (if (nrepl-current-connection-buffer)
+ (let* ((result (nrepl-eval expanded))
+ (s (plist-get result :stdout))
+ (r (plist-get result :value)))
+ (if s (concat s "\n" r) r))
+ (error "nREPL not connected! Use M-x nrepl-jack-in RET"))))
(slime
(require 'slime)
(with-temp-buffer
(insert expanded)
- ((lambda (result)
- (let ((result-params (cdr (assoc :result-params params))))
- (org-babel-result-cond result-params
- result
- (condition-case nil (org-babel-script-escape result)
- (error result)))))
- (slime-eval
- `(swank:eval-and-grab-output
- ,(buffer-substring-no-properties (point-min) (point-max)))
- (cdr (assoc :package params)))))))))
+ (setq result
+ (slime-eval
+ `(swank:eval-and-grab-output
+ ,(buffer-substring-no-properties (point-min) (point-max)))
+ (cdr (assoc :package params)))))))
+ (org-babel-result-cond (cdr (assoc :result-params params))
+ result
+ (condition-case nil (org-babel-script-escape result)
+ (error result)))))
(provide 'ob-clojure)