(pop gnus-agent-group-alist))))
 
 (defun gnus-agent-fetch-headers (group &optional force)
-  (gnus-agent-load-alist group)
-  ;; Find out what headers we need to retrieve.
-  (when articles
-    (while (and articles
-               (assq (car articles) gnus-agent-article-alist))
-      (pop articles))
-    (let ((arts articles))
-      (while (cdr arts)
-       (if (assq (cadr arts) gnus-agent-article-alist)
-           (setcdr arts (cddr arts))
-         (setq arts (cdr arts)))))
+  (let ((articles (if (gnus-agent-load-alist group)   
+                     (gnus-sorted-intersection
+                      (gnus-list-of-unread-articles group)
+                      (gnus-uncompress-range
+                       (cons (1+ (caar (last gnus-agent-article-alist)))
+                             (cdr (gnus-active group)))))
+                   (gnus-list-of-unread-articles group))))
     ;; Fetch them.
     (when articles
       (gnus-message 7 "Fetching headers for %s..." group)
                                (file-name-directory file)))
          (write-region (point-min) (point-max) file nil 'silent)
          (gnus-agent-save-alist group articles nil)
-         (gnus-agent-enter-history "last-header-fetched-for-session"
-                                   (list (cons group (nth (- (length  articles) 1) articles)))
-                                   (gnus-time-to-day (current-time)))
-       t)))))
-
+         (gnus-agent-enter-history
+          "last-header-fetched-for-session"
+          (list (cons group (nth (- (length  articles) 1) articles)))
+          (gnus-time-to-day (current-time)))
+         articles)))))
 
 (defsubst gnus-agent-copy-nov-line (article)
   (let (b e)
                   (sort gnus-agent-article-alist 'car-less-than-car))
             (let* ((alist gnus-agent-article-alist)
                    (prev (cons nil alist))
-                   (first prev))
+                   (first prev)
+                   expired)
               (while (and alist
                           (<= (caar alist) article))
                 (if (or (not (cdar alist))
                                (number-to-string
                                 (caar alist))
                                group))))
-                    (setcdr prev (setq alist (cdr alist)))
+                    (progn
+                      (push (caar alist) expired)
+                      (setcdr prev (setq alist (cdr alist))))
                   (setq prev alist
                         alist (cdr alist))))
               (setq gnus-agent-article-alist (cdr first))
                         (gnus-range-add
                          (nth 2 info)
                          (cons 1 (- (caar gnus-agent-article-alist) 1)))))
+              ;; Maybe everything has been expired from `gnus-article-alist'
+              ;; and so the above marking as read could not be conducted,
+              ;; or there are expired article within the range of the alist.
+              (when (or (not (caar gnus-agent-article-alist))
+                        (> (car expired) (caar gnus-agent-article-alist)))  
+              (setcar (nthcdr 2 info)
+                      (gnus-add-to-range
+                       (nth 2 info)
+                       (nreverse expired))))
               (gnus-dribble-enter
                (concat "(gnus-group-set-info '"
                        (gnus-prin1-to-string info)
-                       ")"))
-              (gnus-agent-save-alist group)))
+                       ")"))))
           expiry-hashtb)
          (set-buffer history)
          (setq histories (nreverse (sort histories '<)))
 
   ;; Stripping headers should be specified with mail-yank-ignored-headers.
   (when yank
     (gnus-summary-goto-subject (car yank)))
-  (let ((gnus-article-reply t)
-       (gnus-inhibit-posting-styles t))
+  (let ((gnus-article-reply t))
     (gnus-setup-message (if yank 'reply-yank 'reply)
       (gnus-summary-select-article)
       (set-buffer (gnus-copy-article-buffer))
 
            (?l "lines" nil nil number)
            (?d "date" nil nil date)
            (?f "followup" nil nil string)
-           (?t "thread" nil nil string)))
+           (?t "thread" "message-id" nil string)))
         (char-to-type
          '((?s s "substring" string)
            (?e e "exact string" string)
            ;; It was a majuscule, so we end reading and use the default.
            (if mimic (message "%c %c %c" prefix hchar tchar)
              (message ""))
-           (setq pchar (or pchar ?p)))
+           (setq pchar (or pchar ?t)))
 
          ;; We continue reading.
          (while (not pchar)
 
          (while (re-search-forward
                  "\\(^[^ \t]+\\)[ \t]+[0-9]+[ \t]+[0-9]+" nil t)
            (goto-char (match-end 1))
-           (push (cons (match-string 1)
-                       (max 0 (- (1+ (read cur)) (read cur))))
-                 groups))))
+           (condition-case ()
+               (push (cons (match-string 1)
+                           (max 0 (- (1+ (read cur)) (read cur))))
+                     groups)
+             (error nil)))))
       (setq groups (sort groups
                         (lambda (l1 l2)
                           (string< (car l1) (car l2)))))
 
   (let ((data gnus-newsgroup-data))
     (save-excursion
       (gnus-save-hidden-threads
+       (gnus-summary-show-all-threads)
        (goto-char (point-min))
        (while data
          (while (get-text-property (point) 'gnus-intangible)
                  (while thread
                    (gnus-remove-thread-1 (car thread))
                    (setq thread (cdr thread))))
+             (gnus-summary-show-all-threads)
              (gnus-remove-thread-1 thread))))))))
 
 (defun gnus-remove-thread-1 (thread)
                   (= mark gnus-read-mark) (= mark gnus-souped-mark)
                   (= mark gnus-duplicate-mark)))
       (setq mark gnus-expirable-mark)
+      ;; Let the backend know about the mark change.
+      (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
       (push article gnus-newsgroup-expirable))
     ;; Set the mark in the buffer.
     (gnus-summary-update-mark mark 'unread)
   "Mark the current article quickly as unread with MARK."
   (let* ((article (gnus-summary-article-number))
         (old-mark (gnus-summary-article-mark article)))
+      ;; Let the backend know about the mark change.
+      (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
     (if (eq mark old-mark)
        t
       (if (<= article 0)
   (let* ((mark (or mark gnus-del-mark))
         (article (or article (gnus-summary-article-number)))
         (old-mark (gnus-summary-article-mark article)))
+      ;; Let the backend know about the mark change.
+      (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
     (if (eq mark old-mark)
        t
       (unless article
 
       gnus-post-news gnus-summary-reply gnus-summary-reply-with-original
       gnus-summary-mail-forward gnus-summary-mail-other-window
       gnus-summary-resend-message gnus-summary-resend-bounced-mail
-      gnus-summary-wide-reply
-      gnus-bug)
+      gnus-summary-wide-reply gnus-summary-followup-to-mail
+      gnus-summary-followup-to-mail-with-original gnus-bug)
      ("gnus-picon" :interactive t gnus-article-display-picons
       gnus-group-display-picons gnus-picons-article-display-x-face
       gnus-picons-display-x-face)
 
     (unless (gnus-buffer-live-p nntp-server-buffer)
       (setq nntp-server-buffer (get-buffer-create " *nntpd*")))
     (set-buffer nntp-server-buffer)
-    (buffer-disable-undo (current-buffer))
     (erase-buffer)
     (kill-all-local-variables)
     (setq case-fold-search t)          ;Should ignore case.
 
                        (aref t1 2) (aref t1 1) (aref t1 0)
                        (aref d1 2) (aref d1 1) (aref d1 0)
                        (number-to-string
-                        (* 60 (timezone-zone-to-minute (aref d1 4))))))))
+                        (* 60 (timezone-zone-to-minute
+                                (or (aref d1 4) (current-time-zone)))))))))
     ;; If we get an error, then we just return a 0 time.
     (error (list 0 0))))
 
 
 @lisp
 (setq gnus-home-score-file
       ;; All groups that match the regexp "\\.emacs"
-      '("\\.emacs" "emacs.SCORE")
-      ;; All the comp groups in one score file
-       ("^comp" "comp.SCORE"))
+      '(("\\.emacs" "emacs.SCORE")
+        ;; All the comp groups in one score file
+        ("^comp" "comp.SCORE")))
 @end lisp
 
 @vindex gnus-home-adapt-file