Browse Source

ob-clojure.el: cosmetic reformatting of a defun.

Bastien Guerry 13 years ago
parent
commit
4c714198b4
1 changed files with 10 additions and 10 deletions
  1. 10 10
      lisp/ob-clojure.el

+ 10 - 10
lisp/ob-clojure.el

@@ -62,16 +62,16 @@
 			     vars "\n      ")
 			    "]\n" body ")")
 		  body))))
-    (if (or (member "code" result-params)
-	    (member "pp" result-params))
-	(format
-	 (concat
-	  "(let [org-mode-print-catcher (java.io.StringWriter.)] "
-	  "(clojure.pprint/with-pprint-dispatch clojure.pprint/%s-dispatch "
-	  "(clojure.pprint/pprint (do %s) org-mode-print-catcher) "
-	  "(str org-mode-print-catcher)))")
-	 (if (member "code" result-params) "code" "simple") body)
-      body)))
+    (cond ((or (member "code" result-params) (member "pp" result-params))
+	   (format (concat "(let [org-mode-print-catcher (java.io.StringWriter.)] "
+			   "(clojure.pprint/with-pprint-dispatch clojure.pprint/%s-dispatch "
+			   "(clojure.pprint/pprint (do %s) org-mode-print-catcher) "
+			   "(str org-mode-print-catcher)))")
+		   (if (member "code" result-params) "code" "simple") body))
+	  ;; if (:results output), collect printed output
+	  ((member "output" result-params)
+	   (format "(clojure.core/with-out-str %s)" body))
+	  (t body))))
 
 (defun org-babel-execute:clojure (body params)
   "Execute a block of Clojure code with Babel."