From 53c6f68896080c37bdb9276406e8a032b9a3049f Mon Sep 17 00:00:00 2001 From: Charles Berry Date: Wed, 11 Mar 2015 19:11:11 -0700 Subject: [PATCH] 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 --- lisp/ob-exp.el | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/lisp/ob-exp.el b/lisp/ob-exp.el index 4c53a558c..522d2bb70 100644 --- a/lisp/ob-exp.el +++ b/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