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.
This commit is contained in:
parent
cf2c7e9f18
commit
de087d0bbe
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in New Issue