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.
This commit is contained in:
Eric Schulte 2013-12-10 00:16:26 -07:00
parent 5edf6e103b
commit e6a6fed934
1 changed files with 19 additions and 2 deletions

View File

@ -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))))