Pārlūkot izejas kodu

ob: Bug fix in writing results to file

* lisp/ob.el (org-babel-execute-src-block): Avoid calling
`orgtbl-to-generic' on number results
Dan Davison 14 gadi atpakaļ
vecāks
revīzija
70349cd0c2
1 mainītis faili ar 10 papildinājumiem un 6 dzēšanām
  1. 10 6
      lisp/ob.el

+ 10 - 6
lisp/ob.el

@@ -417,12 +417,16 @@ block."
 		  (when (cdr (assoc :file params))
 		    (when result
 		      (with-temp-file (cdr (assoc :file params))
-			(if (stringp result)
-			    (insert result)
-			  (insert (orgtbl-to-generic
-				   result
-				   (list :sep (or (cdr (assoc :sep params)) "\t")
-					 :fmt 'echo-res))))))
+			(insert
+			 (if (listp result)
+			     ;; table result
+			     (orgtbl-to-generic
+			      result
+			      (list
+			       :sep (or (cdr (assoc :sep (nth 2 info))) "\t")
+			       :fmt 'echo-res))
+			   ;; scalar result
+			   (echo-res result)))))
 		    (setq result (cdr (assoc :file params)))))
 		(org-babel-insert-result
 		 result result-params info new-hash indent lang)