summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Guerry <bzg@altern.org>2011-07-16 18:40:36 +0200
committerBastien Guerry <bzg@altern.org>2011-07-16 18:40:36 +0200
commitb93da58e1f687fb4e274cdfd43e8b797ff9d4ebf (patch)
treeca22a124abfce0bec828afd68850bb2beaf9a2e5
parent4c714198b4140b62ca679b358824113f7311e3c9 (diff)
downloadorg-mode-b93da58e1f687fb4e274cdfd43e8b797ff9d4ebf.tar.gz
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.
-rw-r--r--lisp/ob.el8
1 files changed, 5 insertions, 3 deletions
diff --git a/lisp/ob.el b/lisp/ob.el
index 988ea99..c554fe1 100644
--- a/lisp/ob.el
+++ b/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."