diff --git a/contrib/babel/lisp/org-babel-exp.el b/contrib/babel/lisp/org-babel-exp.el index 70dcc7b40..8ce52b672 100644 --- a/contrib/babel/lisp/org-babel-exp.el +++ b/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.