summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Schulte <schulte.eric@gmail.com>2010-01-18 13:03:36 -0700
committerEric Schulte <schulte.eric@gmail.com>2010-01-18 13:36:27 -0700
commitd154f2794741275a41d4631892335d581d7da27a (patch)
treed1676ec61a7a34e7b2ee3e22ff60b0b6d187c58c
parent53868111d000302b50706769526f15164600d739 (diff)
downloadorg-mode-d154f2794741275a41d4631892335d581d7da27a.tar.gz
babel: no longer overwriting non-babel src blocks org-exp-blocks: adding progress-marker local variable
the progress-marker local variable set inside of a let in org-exp-blocks is used to constrain searches in org-babel-exp to ensure that a babel block doesn't overwrite non-babel src blocks
-rw-r--r--contrib/babel/lisp/org-babel-exp.el13
-rw-r--r--lisp/org-exp-blocks.el2
2 files changed, 12 insertions, 3 deletions
diff --git a/contrib/babel/lisp/org-babel-exp.el b/contrib/babel/lisp/org-babel-exp.el
index 9e790fa..70dcc7b 100644
--- a/contrib/babel/lisp/org-babel-exp.el
+++ b/contrib/babel/lisp/org-babel-exp.el
@@ -56,6 +56,8 @@ will be indented by this many characters. See
`org-babel-function-def-export-name' for the definition of a
source block function.")
+(defvar obe-marker nil)
+
(defun org-babel-exp-src-blocks (body &rest headers)
"Process src block for export. Depending on the 'export'
headers argument in replace the source code block with...
@@ -71,9 +73,16 @@ results - just like none only the block is run on export ensuring
none ----- do not display either code or results upon export"
(interactive)
(message "org-babel-exp processing...")
- (or (and (re-search-backward org-babel-src-block-regexp nil t)
+ (or (and (re-search-backward org-babel-src-block-regexp progress-marker t)
+ (setq progress-marker (match-end 0))
(org-babel-exp-do-export (org-babel-get-src-block-info) 'block))
- (and (re-search-backward org-block-regexp nil t)
+ (save-excursion
+ (forward-line 0)
+ (and (org-babel-where-is-src-block-head)
+ (goto-char (org-babel-where-is-src-block-head))
+ (org-babel-exp-do-export (org-babel-get-src-block-info) 'block)))
+ (and (re-search-backward org-block-regexp progress-marker t)
+ (setq progress-marker (match-end 0))
(match-string 0))
(error "Unmatched block [bug in `org-babel-exp-src-blocks'].")))
diff --git a/lisp/org-exp-blocks.el b/lisp/org-exp-blocks.el
index 72fe6c4..1d43d3a 100644
--- a/lisp/org-exp-blocks.el
+++ b/lisp/org-exp-blocks.el
@@ -166,7 +166,7 @@ specified in BLOCKS which default to the value of
(save-window-excursion
(let ((case-fold-search t)
(types '())
- indentation type func start body headers preserve-indent)
+ indentation type func start body headers preserve-indent progress-marker)
(flet ((interblock (start end)
(mapcar (lambda (pair) (funcall (second pair) start end))
org-export-interblocks)))