diff options
author | Eric Schulte <schulte.eric@gmail.com> | 2010-02-09 09:50:38 -0700 |
---|---|---|
committer | Eric Schulte <schulte.eric@gmail.com> | 2010-02-09 19:09:19 -0700 |
commit | db1fe2a619ebdf39d9ee66bac1750868742aef85 (patch) | |
tree | d6b5f4e7624c12bf3ac030785d7d08fcfe4710f4 | |
parent | 7c686465b527fa88e79609a00fcad409686c46ef (diff) | |
download | org-mode-db1fe2a619ebdf39d9ee66bac1750868742aef85.tar.gz |
babel: greatly simplified block exportation
-rw-r--r-- | contrib/babel/lisp/org-babel-exp.el | 18 | ||||
-rw-r--r-- | lisp/org-exp-blocks.el | 12 |
2 files changed, 11 insertions, 19 deletions
diff --git a/contrib/babel/lisp/org-babel-exp.el b/contrib/babel/lisp/org-babel-exp.el index 8ce52b6..b299d57 100644 --- a/contrib/babel/lisp/org-babel-exp.el +++ b/contrib/babel/lisp/org-babel-exp.el @@ -73,20 +73,10 @@ 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...") - (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'].")))) + (when (member (first headers) org-babel-interpreters) + (save-excursion + (goto-char (match-beginning 0)) + (org-babel-exp-do-export (org-babel-get-src-block-info) 'block)))) (defun org-babel-exp-inline-src-blocks (start end) "Process inline src blocks between START and END for export. diff --git a/lisp/org-exp-blocks.el b/lisp/org-exp-blocks.el index 1d43d3a..af53b60 100644 --- a/lisp/org-exp-blocks.el +++ b/lisp/org-exp-blocks.el @@ -183,13 +183,15 @@ specified in BLOCKS which default to the value of (setq body (save-match-data (org-remove-indentation body)))) (unless (memq type types) (setq types (cons type types))) (save-match-data (interblock start (match-beginning 0))) - (if (setq func (cadr (assoc type org-export-blocks))) - (progn - (replace-match (save-match-data + (when (setq func (cadr (assoc type org-export-blocks))) + (let ((replacement (save-match-data (if (memq type org-export-blocks-witheld) "" - (apply func body headers))) t t) + (apply func body headers))))) + (when replacement + (replace-match replacement t t) (unless preserve-indent - (indent-code-rigidly (match-beginning 0) (match-end 0) indentation)))) + (indent-code-rigidly + (match-beginning 0) (match-end 0) indentation))))) (setq start (match-end 0))) (interblock start (point-max)))))) |