From e6a6fed9348ff81ebcd9c1d96fc476310eca7a30 Mon Sep 17 00:00:00 2001 From: Eric Schulte Date: Tue, 10 Dec 2013 00:16:26 -0700 Subject: [PATCH] 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. --- lisp/ob-core.el | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/lisp/ob-core.el b/lisp/ob-core.el index 97a203f75..3b962db54 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))))