Don't error on empty code block body.
authorEric Schulte <schulte.eric@gmail.com>
Tue, 13 Sep 2011 14:57:29 +0000 (08:57 -0600)
committerEric Schulte <schulte.eric@gmail.com>
Tue, 13 Sep 2011 14:57:29 +0000 (08:57 -0600)
* lisp/ob.el (org-babel-parse-src-block-match): Don't error on empty
  code block body.

lisp/ob.el

index 9f70c0b..7c00f64 100644 (file)
@@ -1021,7 +1021,8 @@ may be specified in the current buffer."
          (body (org-babel-clean-text-properties
                (let* ((body (match-string 5))
                       (sub-length (- (length body) 1)))
-                 (if (string= "\n" (substring body sub-length))
+                 (if (and (> sub-length 0)
+                          (string= "\n" (substring body sub-length)))
                      (substring body 0 sub-length)
                    body))))
         (preserve-indentation (or org-src-preserve-indentation