Browse Source

ob-emacs-lisp: respect the ":results scalar" header argument combination

* lisp/ob-emacs-lisp.el (org-babel-execute:emacs-lisp): Respect the
  ":results scalar" header argument combination.
Eric Schulte 9 years ago
parent
commit
adf16ffdd7
1 changed files with 12 additions and 6 deletions
  1. 12 6
      lisp/ob-emacs-lisp.el

+ 12 - 6
lisp/ob-emacs-lisp.el

@@ -56,16 +56,22 @@
 (defun org-babel-execute:emacs-lisp (body params)
   "Execute a block of emacs-lisp code with Babel."
   (save-window-excursion
-    (org-babel-reassemble-table
+    ((lambda (result)
+       (if (member "scalar" (cdr (assoc :result-params params)))
+	   (let ((print-level nil)
+		 (print-length nil))
+	     (format "%S" result))
+	 (org-babel-reassemble-table
+	  result
+	  (org-babel-pick-name (cdr (assoc :colname-names params))
+			       (cdr (assoc :colnames params)))
+	  (org-babel-pick-name (cdr (assoc :rowname-names params))
+			       (cdr (assoc :rownames params))))))
      (eval (read (format (if (member "output"
 				     (cdr (assoc :result-params params)))
 			     "(with-output-to-string %s)"
 			   "(progn %s)")
-			 (org-babel-expand-body:emacs-lisp body params))))
-     (org-babel-pick-name (cdr (assoc :colname-names params))
-			  (cdr (assoc :colnames params)))
-       (org-babel-pick-name (cdr (assoc :rowname-names params))
-			    (cdr (assoc :rownames params))))))
+			 (org-babel-expand-body:emacs-lisp body params)))))))
 
 (provide 'ob-emacs-lisp)