Browse Source

Compatibility: define sha1-string for Emacs 22.

Carsten Dominik 16 năm trước cách đây
mục cha
commit
e083a14086
2 tập tin đã thay đổi với 9 bổ sung3 xóa
  1. 6 1
      lisp/org-compat.el
  2. 3 2
      lisp/org-feed.el

+ 6 - 1
lisp/org-compat.el

@@ -319,7 +319,12 @@ that can be added."
 	(setq n (1- n)))
     n))
 
-
+(defun org-sha1-string (s &optional binary)
+  (if (fboundp 'sha1-string)
+      (sha1-string s binary)
+    (with-temp-buffer
+      (insert s)
+      (sha1-region (point-min) (point-max) binary))))
 
 (provide 'org-compat)
 

+ 3 - 2
lisp/org-feed.el

@@ -306,7 +306,8 @@ it can be a list structured like an entry in `org-feed-alist'."
 		(push e new)
 	      (setq olds (nth 2 (assoc (plist-get e :guid) old-status)))
 	      (if (and olds
-		       (not (string= (sha1-string (plist-get e :item-full-text))
+		       (not (string= (org-sha1-string
+				      (plist-get e :item-full-text))
 				     olds)))
 		  (push e changed))))
 
@@ -339,7 +340,7 @@ it can be a list structured like an entry in `org-feed-alist'."
 			 ;; or if they were handled previously
 			 (if (assoc guid guid-alist) t (plist-get e :handled))
 			 ;; A hash, to detect changes
-			 (sha1-string (plist-get e :item-full-text))))
+			 (org-sha1-string (plist-get e :item-full-text))))
 		 entries))
 
 	  ;; Handle new items in the feed