diff options
author | Bastien Guerry <bzg@gnu.org> | 2013-02-28 01:31:26 +0100 |
---|---|---|
committer | Bastien Guerry <bzg@gnu.org> | 2013-02-28 01:31:26 +0100 |
commit | 8a28a5b8d8acb314d8850b85fe5cd956a86e8ff9 (patch) | |
tree | ee0f45fd9b4d38b26c79e40cb27852e80e16c935 /lisp/org/ob-tangle.el | |
parent | 5b8ccc5e3ba2c9f46e52f7aa1b149475ebf24861 (diff) | |
download | emacs-8a28a5b8d8acb314d8850b85fe5cd956a86e8ff9.tar.gz |
Merge latest Org fixes (commit 7524ef2).
Diffstat (limited to 'lisp/org/ob-tangle.el')
-rw-r--r-- | lisp/org/ob-tangle.el | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lisp/org/ob-tangle.el b/lisp/org/ob-tangle.el index 89457f19141..c3b6a483ee6 100644 --- a/lisp/org/ob-tangle.el +++ b/lisp/org/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 |