浏览代码

ob.el: Bugfix about `nil' body variable when parsing block.

* ob.el (org-babel-strip-protective-commas): Return `nil'
instead of an error if no argument is given.
(org-babel-parse-src-block-match): Make sure body is defined
in the let construct.
Bastien Guerry 13 年之前
父节点
当前提交
b93da58e1f
共有 1 个文件被更改,包括 5 次插入3 次删除
  1. 5 3
      lisp/ob.el

+ 5 - 3
lisp/ob.el

@@ -960,8 +960,9 @@ may be specified in the current buffer."
          (body (org-babel-clean-text-properties
 		(let* ((body (match-string 5))
 		       (sub-length (- (length body) 1)))
-		  (when (string= "\n" (substring body sub-length))
-		    (substring body 0 sub-length)))))
+		  (if (string= "\n" (substring body sub-length))
+		      (substring body 0 sub-length)
+		    body))))
 	 (preserve-indentation (or org-src-preserve-indentation
 				   (string-match "-i\\>" switches))))
     (list lang
@@ -1947,7 +1948,8 @@ block but are passed literally to the \"example-block\"."
 
 (defun org-babel-strip-protective-commas (body)
   "Strip protective commas from bodies of source blocks."
-  (replace-regexp-in-string "^,#" "#" body))
+  (when body
+    (replace-regexp-in-string "^,#" "#" body)))
 
 (defun org-babel-script-escape (str &optional force)
   "Safely convert tables into elisp lists."