diff options
author | Bastien Guerry <bzg@altern.org> | 2013-02-13 15:15:42 +0100 |
---|---|---|
committer | Bastien Guerry <bzg@altern.org> | 2013-02-13 15:15:42 +0100 |
commit | fa3385e68bc8f306b5105d99950ba002a571befc (patch) | |
tree | da041eb58a7583e78542e385a14f8f8fb35558a6 | |
parent | 718b210009e69bb92dcd1730065b9b848a2b0aa9 (diff) | |
download | org-mode-fa3385e68bc8f306b5105d99950ba002a571befc.tar.gz |
ob-tangle.el (org-babel-tangle-collect-blocks): Bugfix: remove code references from blocks
* ob-tangle.el (org-babel-tangle-collect-blocks): Bugfix:
remove code references from blocks.
Thanks a lot to Michael Alan Dorman for reporting this.
-rw-r--r-- | lisp/ob-tangle.el | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lisp/ob-tangle.el b/lisp/ob-tangle.el index 89457f1..c3b6a48 100644 --- a/lisp/ob-tangle.el +++ b/lisp/ob-tangle.el @@ -371,6 +371,10 @@ code blocks by language." (unless (and language (not (string= language src-lang))) (let* ((info (org-babel-get-src-block-info)) (params (nth 2 info)) + (extra (nth 3 info)) + (cref-fmt (or (and (string-match "-l \"\\(.+\\)\"" extra) + (match-string 1 extra)) + org-coderef-label-format)) (link ((lambda (link) (and (string-match org-bracket-link-regexp link) (match-string 1 link))) @@ -388,6 +392,11 @@ code blocks by language." ((lambda (body) ;; run the tangle-body-hook (with-temp-buffer (insert body) + (when (string-match "-r" extra) + (goto-char (point-min)) + (while (re-search-forward + (replace-regexp-in-string "%s" ".+" cref-fmt) nil t) + (replace-match ""))) (run-hooks 'org-babel-tangle-body-hook) (buffer-string))) ((lambda (body) ;; expand the body in language specific manner |