Explorar o código

ob-exp: now returns an empty string when the language can't be evaluated

* lisp/ob-exp.el (org-babel-exp-results): now returns an empty string
  when the language can't be evaluated
Eric Schulte %!s(int64=14) %!d(string=hai) anos
pai
achega
ec22856978
Modificáronse 1 ficheiros con 33 adicións e 31 borrados
  1. 33 31
      lisp/ob-exp.el

+ 33 - 31
lisp/ob-exp.el

@@ -252,37 +252,39 @@ results into the buffer."
 	      pair))
 	  (nth 2 info))))
     ;; skip code blocks which we can't evaluate
-    (when (fboundp (intern (concat "org-babel-execute:" lang)))
-      (case type
-	('inline
-	  (let ((raw (org-babel-execute-src-block
-		      nil info '((:results . "silent"))))
-		(result-params (split-string (cdr (assoc :results params)))))
-	    (unless silent
-	      (cond ;; respect the value of the :results header argument
-	       ((member "file" result-params)
-		(org-babel-result-to-file raw))
-	       ((or (member "raw" result-params) (member "org" result-params))
-		(format "%s" raw))
-	       ((member "code" result-params)
-		(format "src_%s{%s}" lang raw))
-	       (t
-		(if (stringp raw)
-		    (if (= 0 (length raw)) "=(no results)="
-		      (format "%s" raw))
-		  (format "%S" raw)))))))
-	('block
-	    (org-babel-execute-src-block
-	     nil info (org-babel-merge-params
-		       params `((:results . ,(if silent "silent" "replace")))))
-	  "")
-	('lob
-	 (save-excursion
-	   (re-search-backward org-babel-lob-one-liner-regexp nil t)
-	   (org-babel-execute-src-block
-	    nil info (org-babel-merge-params
-		      params `((:results . ,(if silent "silent" "replace")))))
-	   ""))))))
+    (if (fboundp (intern (concat "org-babel-execute:" lang)))
+	(case type
+	  ('inline
+	    (let ((raw (org-babel-execute-src-block
+			nil info '((:results . "silent"))))
+		  (result-params (split-string (cdr (assoc :results params)))))
+	      (unless silent
+		(cond ;; respect the value of the :results header argument
+		 ((member "file" result-params)
+		  (org-babel-result-to-file raw))
+		 ((or (member "raw" result-params) (member "org" result-params))
+		  (format "%s" raw))
+		 ((member "code" result-params)
+		  (format "src_%s{%s}" lang raw))
+		 (t
+		  (if (stringp raw)
+		      (if (= 0 (length raw)) "=(no results)="
+			(format "%s" raw))
+		    (format "%S" raw)))))))
+	  ('block
+	      (org-babel-execute-src-block
+	       nil info (org-babel-merge-params
+			 params
+			 `((:results . ,(if silent "silent" "replace")))))
+	    "")
+	  ('lob
+	   (save-excursion
+	     (re-search-backward org-babel-lob-one-liner-regexp nil t)
+	     (org-babel-execute-src-block
+	      nil info (org-babel-merge-params
+			params `((:results . ,(if silent "silent" "replace")))))
+	     "")))
+      "")))
 
 (provide 'ob-exp)