浏览代码

babel: bug fix related to "no longer overwriting non-babel src blocks" commit

  this fixes a bug introduced in commit
  d154f2794741275a41d4631892335d581d7da27a
Eric Schulte 15 年之前
父节点
当前提交
b59a57e890
共有 1 个文件被更改,包括 14 次插入12 次删除
  1. 14 12
      contrib/babel/lisp/org-babel-exp.el

+ 14 - 12
contrib/babel/lisp/org-babel-exp.el

@@ -73,18 +73,20 @@ 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 progress-marker t)
-           (setq progress-marker (match-end 0))
-           (org-babel-exp-do-export (org-babel-get-src-block-info) 'block))
-      (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'].")))
+  (flet ((cond-progress-marker () (when (and progress-marker (< progress-marker (point)))
+                                   progress-marker)))
+    (or (and (re-search-backward org-babel-src-block-regexp (cond-progress-marker) t)
+             (setq progress-marker (match-end 0))
+             (org-babel-exp-do-export (org-babel-get-src-block-info) 'block))
+        (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 (cond-progress-marker) t)
+             (setq progress-marker (match-end 0))
+             (match-string 0))
+        (error "Unmatched block [bug in `org-babel-exp-src-blocks']."))))
 
 (defun org-babel-exp-inline-src-blocks (start end)
   "Process inline src blocks between START and END for export.