Browse Source

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.
Eric Schulte 14 years ago
parent
commit
6ddad0a91a
1 changed files with 32 additions and 25 deletions
  1. 32 25
      lisp/ob.el

+ 32 - 25
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."