diff options
author | Eric Schulte <schulte.eric@gmail.com> | 2010-10-16 13:55:54 -0600 |
---|---|---|
committer | Dan Davison <davison@stats.ox.ac.uk> | 2010-10-21 13:06:55 +0100 |
commit | e905dbe0f60e2326061c63621e603f5b396373a1 (patch) | |
tree | 8a4c8a556bb5b02f667a37be595cbe2b405f5584 | |
parent | cea9fd742129f74b9ea38d7d9d74ca751271fce2 (diff) | |
download | org-mode-e905dbe0f60e2326061c63621e603f5b396373a1.tar.gz |
babel hashing now handles more complex types in params
* lisp/ob.el (org-babel-sha1-hash): now handles more complex types in
params
* testing/examples/babel.org: whitespace
* testing/lisp/test-ob.el (test-org-babel/sha1-hash): new test for
babel hashing
-rw-r--r-- | lisp/ob.el | 23 | ||||
-rw-r--r-- | testing/examples/babel.org | 2 | ||||
-rw-r--r-- | testing/lisp/test-ob.el | 6 |
3 files changed, 23 insertions, 8 deletions
@@ -609,17 +609,24 @@ the current subtree." (defun org-babel-sha1-hash (&optional info) "Generate an sha1 hash based on the value of info." (interactive) - (let* ((info (or info (org-babel-get-src-block-info))) + (let* ((print-level nil) + (info (or info (org-babel-get-src-block-info))) (hash (sha1 (format "%s-%s" (mapconcat - (lambda (arg) - (if (stringp (cdr arg)) - (mapconcat - #'identity - (sort (split-string (cdr arg)) #'string<) " ") - (cdr arg))) - (nth 2 info) ":") + #'identity + (delq nil + (mapcar + (lambda (arg) + (let ((v (cdr arg))) + (when (and v (not (and (sequencep v) + (> (length v) 0)))) + (if (stringp v) + (mapconcat #'identity + (sort (split-string v) + #'string<) " ") + (format "%S" v))))) + (nth 2 info))) ":") (nth 1 info))))) (when (interactive-p) (message hash)) hash)) diff --git a/testing/examples/babel.org b/testing/examples/babel.org index f42c3b2..e367aea 100644 --- a/testing/examples/babel.org +++ b/testing/examples/babel.org @@ -129,6 +129,7 @@ (pascals-triangle n) #+end_src + * calling code blocks from inside table :PROPERTIES: :ID: 6d2ff4ce-4489-4e2a-9c65-e3f71f77d975 @@ -138,6 +139,7 @@ #+begin_src emacs-lisp :var n=9 (sqrt n) #+end_src + * executing an lob call line :PROPERTIES: :results: silent diff --git a/testing/lisp/test-ob.el b/testing/lisp/test-ob.el index 2ee44c8..b6e48d9 100644 --- a/testing/lisp/test-ob.el +++ b/testing/lisp/test-ob.el @@ -64,6 +64,12 @@ (should (equal 'a (cadr (assoc 1 results)))) (should (equal 'd (cadr (assoc 4 results))))))) +(ert-deftest test-org-babel/sha1-hash () + (org-test-at-id "f68821bc-7f49-4389-85b5-914791ee3718" + (org-babel-next-src-block 2) + (should (string= "615946d1cd30c88c17ae6bf1d56a3f90232ddf78" + (org-babel-sha1-hash))))) + (provide 'test-ob) ;;; test-ob ends here
\ No newline at end of file |