diff options
author | Eric Schulte <schulte.eric@gmail.com> | 2013-12-10 00:16:26 -0700 |
---|---|---|
committer | Eric Schulte <schulte.eric@gmail.com> | 2013-12-10 00:36:16 -0700 |
commit | e6a6fed9348ff81ebcd9c1d96fc476310eca7a30 (patch) | |
tree | db4b0829af0e0cd62114f9143b678d2cad264264 | |
parent | 5edf6e103b961a708ea396eebab9d0ddbd674d33 (diff) | |
download | org-mode-e6a6fed9348ff81ebcd9c1d96fc476310eca7a30.tar.gz |
expanded noweb references when calculating hashes
The bulk of the new code in org-babel-sha1-hash is borrowed from
org-babel-expand-src-block.
* lisp/ob-core.el (org-babel-sha1-hash): Expanded noweb references
when calculating hashes.
-rw-r--r-- | lisp/ob-core.el | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/lisp/ob-core.el b/lisp/ob-core.el index 97a203f..3b962db 100644 --- a/lisp/ob-core.el +++ b/lisp/ob-core.el @@ -1219,7 +1219,24 @@ the current subtree." (member (car arg) '(:results :exports))) (mapconcat #'identity (sort (funcall rm (split-string v)) #'string<) " ")) - (t v))))))) + (t v)))))) + ;; expanded body + (lang (nth 0 info)) + (params (setf (nth 2 info) + (sort (org-babel-merge-params (nth 2 info) params) + (lambda (el1 el2) (string< (symbol-name (car el1)) + (symbol-name (car el2))))))) + (body (setf (nth 1 info) + (if (org-babel-noweb-p params :eval) + (org-babel-expand-noweb-references info) (nth 1 info)))) + (expand-cmd (intern (concat "org-babel-expand-body:" lang))) + (assignments-cmd (intern (concat "org-babel-variable-assignments:" + lang))) + (expanded + (if (fboundp expand-cmd) (funcall expand-cmd body params) + (org-babel-expand-body:generic + body params (and (fboundp assignments-cmd) + (funcall assignments-cmd params)))))) (let* ((it (format "%s-%s" (mapconcat #'identity @@ -1228,7 +1245,7 @@ the current subtree." (when normalized (format "%S" normalized)))) (nth 2 info))) ":") - (nth 1 info))) + expanded)) (hash (sha1 it))) (when (org-called-interactively-p 'interactive) (message hash)) hash)))) |