summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Schulte <schulte.eric@gmail.com>2010-10-21 07:04:20 -0600
committerEric Schulte <schulte.eric@gmail.com>2010-10-21 07:11:13 -0600
commitb664510ec4811491e4611791c24591153abdf5f3 (patch)
tree0511c931495f18bd7b93b29a604052ffcd41ce7a
parent7c44c8ca7d22707e3d6f9aff035fe1d344713609 (diff)
downloadorg-mode-b664510ec4811491e4611791c24591153abdf5f3.tar.gz
babel: ensure that info is sorted at the header argument level
* lisp/ob.el (org-babel-sha1-hash): ensure that info is sorted at the header argument level
-rw-r--r--lisp/ob.el39
1 files changed, 21 insertions, 18 deletions
diff --git a/lisp/ob.el b/lisp/ob.el
index 3c3b2b7..65ed2e6 100644
--- a/lisp/ob.el
+++ b/lisp/ob.el
@@ -609,24 +609,27 @@ the current subtree."
(defun org-babel-sha1-hash (&optional info)
"Generate an sha1 hash based on the value of info."
(interactive)
- (let* ((print-level nil)
- (info (or info (org-babel-get-src-block-info)))
- (hash (sha1
- (format "%s-%s"
- (mapconcat
- #'identity
- (delq nil
- (mapcar
- (lambda (arg)
- (let ((v (cdr arg)))
- (when (and v (not (and (sequencep v)
- (not (consp v))
- (= (length v) 0))))
- (format "%S" v))))
- (nth 2 info))) ":")
- (nth 1 info)))))
- (when (interactive-p) (message hash))
- hash))
+ (let ((print-level nil)
+ (info (or info (org-babel-get-src-block-info))))
+ (setf (nth 2 info)
+ (sort (nth 2 info)
+ (lambda (a b) (string< (car a) (car b)))))
+ (let ((hash (sha1
+ (format "%s-%s"
+ (mapconcat
+ #'identity
+ (delq nil
+ (mapcar
+ (lambda (arg)
+ (let ((v (cdr arg)))
+ (when (and v (not (and (sequencep v)
+ (not (consp v))
+ (= (length v) 0))))
+ (format "%S" v))))
+ (nth 2 info))) ":")
+ (nth 1 info)))))
+ (when (interactive-p) (message hash))
+ hash)))
(defun org-babel-result-hash (&optional info)
"Return the in-buffer hash associated with INFO."