summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Schulte <schulte.eric@gmail.com>2011-07-01 12:56:22 -0700
committerEric Schulte <schulte.eric@gmail.com>2011-07-01 12:56:22 -0700
commit6ddad0a91a8c8eb6e2731a3fb8fec16c20e64a68 (patch)
tree9c86ef24eede52780532fa273faf6b1c82036e31
parentdacf18e80a906166a601e13d8e33c2ef0365c7b9 (diff)
downloadorg-mode-6ddad0a91a8c8eb6e2731a3fb8fec16c20e64a68.tar.gz
ob: not including export-variable headers in cache sha1
* lisp/ob.el (org-babel-sha1-hash): Improving code layout and removing export-variable headers in cache sha1.
-rw-r--r--lisp/ob.el57
1 files changed, 32 insertions, 25 deletions
diff --git a/lisp/ob.el b/lisp/ob.el
index cdbce12..56f6b5b 100644
--- a/lisp/ob.el
+++ b/lisp/ob.el
@@ -749,31 +749,38 @@ the current subtree."
(setf (nth 2 info)
(sort (copy-sequence (nth 2 info))
(lambda (a b) (string< (car a) (car b)))))
- ((lambda (hash)
- (when (org-called-interactively-p 'interactive) (message hash))
- 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))))
- ((lambda (el) (format "%S" el))
- (cond
- ((and (listp v) ; lists are sorted
- (member (car arg) '(:result-params)))
- (sort (copy-sequence v) #'string<))
- ((and (stringp v) ; strings are sorted
- (member (car arg) '(:results :exports)))
- (mapconcat #'identity (sort (split-string v)
- #'string<) " "))
- (t v)))))) ; atomic are left untouched
- (nth 2 info))) ":")
- (nth 1 info))))))
+ (labels ((rm (lst)
+ (dolist (p '("replace" "silent" "append" "prepend"))
+ (setq lst (remove p lst)))
+ lst)
+ (norm (arg)
+ (let ((v (if (listp (cdr arg))
+ (copy-seq (cdr arg))
+ (cdr arg))))
+ (when (and v (not (and (sequencep v)
+ (not (consp v))
+ (= (length v) 0))))
+ (cond
+ ((and (listp v) ; lists are sorted
+ (member (car arg) '(:result-params)))
+ (sort (rm v) #'string<))
+ ((and (stringp v) ; strings are sorted
+ (member (car arg) '(:results :exports)))
+ (mapconcat #'identity (sort (rm (split-string v))
+ #'string<) " "))
+ (t v))))))
+ ((lambda (hash)
+ (when (org-called-interactively-p 'interactive) (message hash)) hash)
+ (let ((it (format "%s-%s"
+ (mapconcat
+ #'identity
+ (delq nil (mapcar (lambda (arg)
+ (let ((normalized (norm arg)))
+ (when normalized
+ (format "%S" normalized))))
+ (nth 2 info))) ":")
+ (nth 1 info))))
+ (sha1 it))))))
(defun org-babel-result-hash (&optional info)
"Return the in-buffer hash associated with INFO."