Synch with Gnus.
[elisp/gnus.git-] / lisp / gnus-agent.el
index b301e76..2fefb48 100644 (file)
@@ -204,7 +204,7 @@ If this is `ask' the hook will query the user."
 (defmacro gnus-agent-with-fetch (&rest forms)
   "Do FORMS safely."
   `(unwind-protect
-       (progn
+       (let ((gnus-agent-fetching t))
         (gnus-agent-start-fetch)
         ,@forms)
      (gnus-agent-stop-fetch)))
@@ -946,20 +946,6 @@ the actual number of articles toggled is returned."
        (insert "\n"))
       (pop gnus-agent-group-alist))))
 
-(defun gnus-agent-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 (memq (car l2) l1)
-              (push (car l2) l1))
-          (pop l2))
-        l1)))
-
 (defun gnus-agent-fetch-headers (group &optional force)
   (let* ((articles (gnus-list-of-unread-articles group))
         (len (length articles))
@@ -973,8 +959,8 @@ the actual number of articles toggled is returned."
           (setq articles (nthcdr i articles))))
     ;; add article with marks to list of article headers we want to fetch.
     (dolist (arts (gnus-info-marks (gnus-get-info group)))
-      (setq articles (gnus-agent-union (gnus-uncompress-sequence (cdr arts))
-                                      articles)))
+      (setq articles (gnus-union (gnus-uncompress-sequence (cdr arts))
+                                articles)))
     (setq articles (sort articles '<))
     ;; Remove known articles.
     (when (gnus-agent-load-alist group)
@@ -1114,7 +1100,11 @@ the actual number of articles toggled is returned."
          (error
           (unless (funcall gnus-agent-confirmation-function
                            (format "Error (%s).  Continue? " err))
-            (error "Cannot fetch articles into the Gnus agent."))))
+            (error "Cannot fetch articles into the Gnus agent.")))
+         (quit 
+          (unless (funcall gnus-agent-confirmation-function
+                           (format "Quit (%s).  Continue? " err))
+            (signal 'quit "Cannot fetch articles into the Gnus agent."))))
        (pop methods))
       (gnus-message 6 "Finished fetching articles into the Gnus agent"))))