Synch with Gnus.
[elisp/gnus.git-] / lisp / gnus-util.el
index 5b70701..e566243 100644 (file)
 
 (static-cond
  ((fboundp 'point-at-bol)
-  (fset 'gnus-point-at-bol 'point-at-bol))
+  (defalias 'gnus-point-at-bol 'point-at-bol))
  ((fboundp 'line-beginning-position)
-  (fset 'gnus-point-at-bol 'line-beginning-position))
+  (defalias 'gnus-point-at-bol 'line-beginning-position))
  (t
   (defun gnus-point-at-bol ()
     "Return point at the beginning of the line."
   ))
 (static-cond
  ((fboundp 'point-at-eol)
-  (fset 'gnus-point-at-eol 'point-at-eol))
+  (defalias 'gnus-point-at-eol 'point-at-eol))
  ((fboundp 'line-end-position)
-  (fset 'gnus-point-at-eol 'line-end-position))
+  (defalias 'gnus-point-at-eol 'line-end-position))
  (t
   (defun gnus-point-at-eol ()
     "Return point at the end of the line."
@@ -343,11 +343,11 @@ Cache the result as a text property stored in DATE."
             time)))))
 
 (defsubst gnus-time-iso8601 (time)
-  "Return a string of TIME in YYMMDDTHHMMSS format."
+  "Return a string of TIME in YYYYMMDDTHHMMSS format."
   (format-time-string "%Y%m%dT%H%M%S" time))
 
 (defun gnus-date-iso8601 (date)
-  "Convert the DATE to YYMMDDTHHMMSS."
+  "Convert the DATE to YYYYMMDDTHHMMSS."
   (condition-case ()
       (gnus-time-iso8601 (gnus-date-get-time date))
     (error "")))
@@ -483,14 +483,6 @@ If N, return the Nth ancestor instead."
                     (file-name-nondirectory file))))
   (copy-file file to))
 
-(defun gnus-kill-all-overlays ()
-  "Delete all overlays in the current buffer."
-  (let* ((overlayss (overlay-lists))
-        (buffer-read-only nil)
-        (overlays (delq nil (nconc (car overlayss) (cdr overlayss)))))
-    (while overlays
-      (delete-overlay (pop overlays)))))
-
 (defvar gnus-work-buffer " *gnus work*")
 
 (defun gnus-set-work-buffer ()
@@ -1011,11 +1003,9 @@ Entries without port tokens default to DEFAULTPORT."
        (throw 'found nil)))
     t))
 
-(defun gnus-write-active-file-as-coding-system (coding-system file hashtb
-                                                             &optional
-                                                             full-names)
-  (let ((output-coding-system coding-system)
-       (coding-system-for-write coding-system))
+(defun gnus-write-active-file (file hashtb &optional full-names)
+  (let ((output-coding-system nnmail-active-file-coding-system)
+       (coding-system-for-write nnmail-active-file-coding-system))
     (with-temp-file file
       (mapatoms
        (lambda (sym)
@@ -1034,6 +1024,22 @@ Entries without port tokens default to DEFAULTPORT."
       (while (search-backward "\\." nil t)
        (delete-char 1)))))
 
+(if (fboundp 'union)
+    (defalias 'gnus-union 'union)
+  (defun gnus-union (l1 l2)
+    "Set union of lists L1 and L2."
+    (cond ((null l1) l2)
+         ((null l2) l1)
+         ((equal l1 l2) l1)
+         (t
+          (or (>= (length l1) (length l2))
+              (setq l1 (prog1 l2 (setq l2 l1))))
+          (while l2
+            (or (member (car l2) l1)
+                (push (car l2) l1))
+            (pop l2))
+          l1))))
+
 (provide 'gnus-util)
 
 ;;; gnus-util.el ends here