summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Schulte <schulte.eric@gmail.com>2011-09-16 09:52:09 -0600
committerEric Schulte <schulte.eric@gmail.com>2011-09-16 09:52:34 -0600
commit647849dff9f3314bf0899aad68b275b7b88a59fa (patch)
treeff5daeddfdc155c691c9559dc0b18bdd794f27bf
parent15a9eac67e3fefe25e1df33598dc3de414d43b43 (diff)
downloadorg-mode-647849dff9f3314bf0899aad68b275b7b88a59fa.tar.gz
better delimiting of Org-mode text preceding a code block
Thanks to Christopher Genovese for this change * lisp/ob-tangle.el (org-babel-tangle-collect-blocks): Better delimiting of Org-mode text preceding a code block.
-rw-r--r--lisp/ob-tangle.el12
1 files changed, 7 insertions, 5 deletions
diff --git a/lisp/ob-tangle.el b/lisp/ob-tangle.el
index 10fc120..f5dbb30 100644
--- a/lisp/ob-tangle.el
+++ b/lisp/ob-tangle.el
@@ -358,12 +358,14 @@ code blocks by language."
(buffer-substring
(max (condition-case nil
(save-excursion
- (org-back-to-heading t) (point))
- (error 0))
+ (org-back-to-heading t) ; sets match data
+ (match-end 0))
+ (error (point-min)))
(save-excursion
- (re-search-backward
- org-babel-src-block-regexp nil t)
- (match-end 0)))
+ (if (re-search-backward
+ org-babel-src-block-regexp nil t)
+ (match-end 0)
+ (point-min))))
(point)))))
by-lang)
;; add the spec for this block to blocks under it's language