浏览代码

ob-exp.el: org-babel-exp-process-buffer reports src block w/o language

* lisp/ob-exp.el (org-babel-exp-process-buffer): Issue an error when a
  src block with no language is processed.

Throw an error with an informative message when trying to export buffer
containing `#+src_block\n'.

Reported-by: XIE Yuheng <xyheme@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/95920>
Charles Berry 10 年之前
父节点
当前提交
53c6f68896
共有 1 个文件被更改,包括 8 次插入5 次删除
  1. 8 5
      lisp/ob-exp.el

+ 8 - 5
lisp/ob-exp.el

@@ -257,12 +257,15 @@ may make them unreachable."
 		(src-block
 		 (let* ((match-start (copy-marker (match-beginning 0)))
 			(ind (org-get-indentation))
+			(lang (or (org-element-property :language element)
+				  (error "No language for src block: %s"
+					 (or (org-element-property :name element)
+					     "(unnamed)"))))
 			(headers
-			 (cons
-			  (org-element-property :language element)
-			  (let ((params (org-element-property :parameters
-							      element)))
-			    (and params (org-split-string params "[ \t]+"))))))
+			 (cons lang
+			       (let ((params
+				      (org-element-property :parameters element)))
+				 (and params (org-split-string params "[ \t]+"))))))
 		   ;; Take care of matched block: compute replacement
 		   ;; string.  In particular, a nil REPLACEMENT means
 		   ;; the block should be left as-is while an empty