*** empty log message ***
[gnus] / lisp / gnus.el
index 0b97558..84f619a 100644 (file)
@@ -31,6 +31,7 @@
 (require 'mail-utils)
 (require 'timezone)
 (require 'nnheader)
+(require 'message)
 
 (eval-when-compile (require 'cl))
 
@@ -66,16 +67,6 @@ In any case, if the string (either in the variable, in the environment
 variable, or returned by the function) is a file name, the contents of
 this file will be used as the organization.")
 
-(defvar gnus-use-generic-from nil
-  "If nil, the full host name will be the system name prepended to the domain name.
-If this is a string, the full host name will be this string.
-If this is non-nil, non-string, the domain name will be used as the
-full host name.")
-
-(defvar gnus-use-generic-path nil
-  "If nil, use the NNTP server name in the Path header.
-If stringp, use this; if non-nil, use no host name (user name only).")
-
 ;; Customization variables
 
 ;; Don't touch this variable.
@@ -186,13 +177,14 @@ instead.")
 
 (defvar gnus-group-faq-directory
   '("/ftp@mirrors.aol.com:/pub/rtfm/usenet/"
+    "/ftp@sunsite.auc.dk:/pub/usenet/"
     "/ftp@src.doc.ic.ac.uk:/usenet/news-FAQS/"
     "/ftp@ftp.seas.gwu.edu:/pub/rtfm/"
-    "/ftp@rtfm.mit.edu:/pub/usenet/news.answers/"
+    "/ftp@rtfm.mit.edu:/pub/usenet/"
     "/ftp@ftp.uni-paderborn.de:/pub/FAQ/"
     "/ftp@ftp.sunet.se:/pub/usenet/"
     "/ftp@nctuccca.edu.tw:/USENET/FAQ/"
-    "/ftp@hwarang.postech.ac.kr:/pub/usenet/news.answers/"
+    "/ftp@hwarang.postech.ac.kr:/pub/usenet/"
     "/ftp@ftp.hk.super.net:/mirror/faqs/")
   "*Directory where the group FAQs are stored.
 This will most commonly be on a remote machine, and the file will be
@@ -210,12 +202,13 @@ If the default site is too slow, try one of these:
 
    North America: mirrors.aol.com               /pub/rtfm/usenet
                  ftp.seas.gwu.edu               /pub/rtfm
-                 rtfm.mit.edu                   /pub/usenet/news.answers
+                 rtfm.mit.edu                   /pub/usenet
    Europe:       ftp.uni-paderborn.de           /pub/FAQ
                   src.doc.ic.ac.uk               /usenet/news-FAQS
                  ftp.sunet.se                   /pub/usenet
+                 sunsite.auc.dk                 /pub/usenet
    Asia:         nctuccca.edu.tw                /USENET/FAQ
-                 hwarang.postech.ac.kr          /pub/usenet/news.answers
+                 hwarang.postech.ac.kr          /pub/usenet
                  ftp.hk.super.net               /mirror/faqs")
 
 (defvar gnus-group-archive-directory
@@ -869,19 +862,9 @@ beginning of a line.")
      (vertical 1.0
               (browse 1.0 point)
               (if gnus-carpal '(browse-carpal 2))))
-    (group-mail
-     (vertical 1.0
-              (mail 1.0 point)))
-    (group-post
-     (vertical 1.0
-              (post 1.0 point)))
-    (summary-mail
-     (vertical 1.0
-              (mail 1.0 point)))
-    (summary-reply
+    (message
      (vertical 1.0
-              (article-copy 0.5)
-              (mail 1.0 point)))
+              (message 1.0 point)))
     (pick
      (vertical 1.0
               (article 1.0 point)))
@@ -910,20 +893,17 @@ beginning of a line.")
     (reply
      (vertical 1.0
               (article-copy 0.5)
-              (mail 1.0 point)))
-    (mail-forward
-     (vertical 1.0
-              (mail 1.0 point)))
-    (post-forward
+              (message 1.0 point)))
+    (forward
      (vertical 1.0
-              (post 1.0 point)))
+              (message 1.0 point)))
     (reply-yank
      (vertical 1.0
-              (mail 1.0 point)))
+              (message 1.0 point)))
     (mail-bounce
      (vertical 1.0
               (article 0.5)
-              (mail 1.0 point)))
+              (message 1.0 point)))
     (draft
      (vertical 1.0
               (draft 1.0 point)))
@@ -932,13 +912,14 @@ beginning of a line.")
               (summary 0.25 point)
               (if gnus-carpal '(summary-carpal 4))
               ("*Shell Command Output*" 1.0)))
-    (followup
+    (bug
      (vertical 1.0
-              (article-copy 0.5)
-              (post 1.0 point)))
-    (followup-yank
+              ("*Gnus Help Bug*" 0.5)
+              ("*Gnus Bug*" 1.0 point)))
+    (compose-bounce
      (vertical 1.0
-              (post 1.0 point))))
+              (article 0.5)
+              (message 1.0 point))))
   "Window configuration for all possible Gnus buffers.
 This variable is a list of lists.  Each of these lists has a NAME and
 a RULE.         The NAMEs are commonsense names like `group', which names a
@@ -967,8 +948,9 @@ buffer configuration.")
     (server-carpal . gnus-carpal-server-buffer)
     (browse-carpal . gnus-carpal-browse-buffer)
     (edit-score . gnus-score-edit-buffer)
-    (mail . gnus-mail-buffer)
-    (post . gnus-post-news-buffer)
+    (message . gnus-message-buffer)
+    (mail . gnus-message-buffer)
+    (post-news . gnus-message-buffer)
     (faq . gnus-faq-buffer)
     (picons . "*Picons*")
     (tree . gnus-tree-buffer)
@@ -1169,7 +1151,7 @@ with some simple extensions.
 %z   Article zcore (character)
 %t   Number of articles under the current thread (number).
 %e   Whether the thread is empty or not (character).
-%l   GroupLens score (number)
+%l   GroupLens score (string).
 %u   User defined specifier.  The next character in the format string should
      be a letter.  Gnus will call the function gnus-user-format-function-X,
      where X is the letter following %u.  The function will be passed the
@@ -1486,6 +1468,7 @@ is not run if `gnus-visual' is nil.")
 
 (defvar gnus-parse-headers-hook nil
   "*A hook called before parsing the headers.")
+(add-hook 'gnus-parse-headers-hook 'gnus-headers-decode-quoted-printable)
 
 (defvar gnus-exit-group-hook nil
   "*A hook called when exiting (not quitting) summary mode.")
@@ -1542,13 +1525,28 @@ It is called with three parameters -- GROUP, LEVEL and OLDLEVEL.")
            (remove-hook 'gnus-summary-prepare-hook
                         'hilit-rehighlight-buffer-quietly)
            (remove-hook 'gnus-summary-prepare-hook 'hilit-install-line-hooks)
-           (setq gnus-mark-article-hook '(gnus-summary-mark-read-and-unread-as-read))
+           (setq gnus-mark-article-hook
+                 '(gnus-summary-mark-read-and-unread-as-read))
            (remove-hook 'gnus-article-prepare-hook
                         'hilit-rehighlight-buffer-quietly)))
 
 \f
 ;; Internal variables
 
+;; Dummy variable.
+(defvar gnus-use-generic-from nil)
+
+(defvar gnus-thread-indent-array nil)
+(defvar gnus-thread-indent-array-level gnus-thread-indent-level)
+
+(defvar gnus-newsrc-file-version nil)
+
+(defvar gnus-method-history nil)
+;; Variable holding the user answers to all method prompts.
+
+(defvar gnus-group-history nil)
+;; Variable holding the user answers to all group prompts.
+
 (defvar gnus-server-alist nil
   "List of available servers.")
 
@@ -1594,6 +1592,8 @@ It is called with three parameters -- GROUP, LEVEL and OLDLEVEL.")
 (defvar gnus-opened-servers nil)
 
 (defvar gnus-current-move-group nil)
+(defvar gnus-current-copy-group nil)
+(defvar gnus-current-crosspost-group nil)
 
 (defvar gnus-newsgroup-dependencies nil)
 (defvar gnus-newsgroup-async nil)
@@ -1715,13 +1715,13 @@ variable (string, integer, character, etc).")
   "gnus-bug@ifi.uio.no (The Gnus Bugfixing Girls + Boys)"
   "The mail address of the Gnus maintainers.")
 
-(defconst gnus-version "September Gnus v0.55"
+(defconst gnus-version "September Gnus v0.81"
   "Version number for this version of Gnus.")
 
 (defvar gnus-info-nodes
-  '((gnus-group-mode           "(gnus)The Group Buffer")
-    (gnus-summary-mode         "(gnus)The Summary Buffer")
-    (gnus-article-mode         "(gnus)The Article Buffer"))
+  '((gnus-group-mode "(gnus)The Group Buffer")
+    (gnus-summary-mode "(gnus)The Summary Buffer")
+    (gnus-article-mode "(gnus)The Article Buffer"))
   "Assoc list of major modes and related Info nodes.")
 
 (defvar gnus-group-buffer "*Group*")
@@ -1921,7 +1921,7 @@ gnus-newsrc-hashtb should be kept so that both hold the same information.")
     gnus-last-article gnus-article-internal-prepare-hook
     gnus-newsgroup-dependencies gnus-newsgroup-selected-overlay
     gnus-newsgroup-scored gnus-newsgroup-kill-headers
-    gnus-newsgroup-async 
+    gnus-newsgroup-async gnus-thread-expunge-below
     gnus-score-alist gnus-current-score-file gnus-summary-expunge-below
     gnus-summary-mark-below gnus-newsgroup-active gnus-scores-exclude-files
     gnus-newsgroup-history gnus-newsgroup-ancient
@@ -1993,6 +1993,7 @@ Thank you for your help in stamping out bugs.
       gnus-group-brew-soup gnus-brew-soup gnus-soup-add-article
       gnus-soup-send-replies gnus-soup-save-areas gnus-soup-pack-packet)
      ("nnsoup" nnsoup-pack-replies)
+     ("gnus-scomo" :interactive t gnus-score-mode)
      ("gnus-mh" gnus-mh-mail-setup gnus-summary-save-article-folder
       gnus-Folder-save-name gnus-folder-save-name)
      ("gnus-mh" :interactive t gnus-summary-save-in-folder)
@@ -2022,7 +2023,8 @@ Thank you for your help in stamping out bugs.
      ("gnus-srvr" gnus-browse-foreign-server)
      ("gnus-cite" :interactive t
       gnus-article-highlight-citation gnus-article-hide-citation-maybe
-      gnus-article-hide-citation gnus-article-fill-cited-article)
+      gnus-article-hide-citation gnus-article-fill-cited-article
+      gnus-article-hide-citation-in-followups)
      ("gnus-kill" gnus-kill gnus-apply-kill-file-internal
       gnus-kill-file-edit-file gnus-kill-file-raise-followups-to-author
       gnus-execute gnus-expunge)
@@ -2284,6 +2286,25 @@ Thank you for your help in stamping out bugs.
 (require 'gnus-cus)
 (require 'gnus-ems)
 
+\f
+;;;
+;;; Shutdown
+;;;
+
+(defvar gnus-shutdown-alist nil)
+
+(defun gnus-add-shutdown (function &rest symbols)
+  "Run FUNCTION whenever one of SYMBOLS is shut down."
+  (push (cons function symbols) gnus-shutdown-alist))
+
+(defun gnus-shutdown (symbol)
+  "Shut down everything that waits for SYMBOL."
+  (let ((alist gnus-shutdown-alist)
+       entry)
+    (while (setq entry (pop alist))
+      (when (memq symbol (cdr entry))
+       (funcall (car entry))))))
+
 \f
 
 ;; Format specs.  The chunks below are the machine-generated forms
@@ -2421,7 +2442,8 @@ Thank you for your help in stamping out bugs.
   "Return the value of the header FIELD of current article."
   (save-excursion
     (save-restriction
-      (let ((case-fold-search t))
+      (let ((case-fold-search t)
+           (inhibit-point-motion-hooks t))
        (nnheader-narrow-to-headers)
        (mail-fetch-field field)))))
 
@@ -2524,24 +2546,32 @@ Thank you for your help in stamping out bugs.
 (defun gnus-update-summary-mark-positions ()
   "Compute where the summary marks are to go."
   (save-excursion
+    (when (and gnus-summary-buffer
+              (get-buffer gnus-summary-buffer)
+              (buffer-name (get-buffer gnus-summary-buffer)))
+      (set-buffer gnus-summary-buffer))
     (let ((gnus-replied-mark 129)
          (gnus-score-below-mark 130)
          (gnus-score-over-mark 130)
          (thread nil)
          (gnus-visual nil)
+         (spec gnus-summary-line-format-spec)
          pos)
-      (gnus-set-work-buffer)
-      (gnus-summary-insert-line
-       [0 "" "" "" "" "" 0 0 ""]  0 nil 128 t nil "" nil 1)
-      (goto-char (point-min))
-      (setq pos (list (cons 'unread (and (search-forward "\200" nil t)
-                                        (- (point) 2)))))
-      (goto-char (point-min))
-      (push (cons 'replied (and (search-forward "\201" nil t) (- (point) 2)))
-           pos)
-      (goto-char (point-min))
-      (push (cons 'score (and (search-forward "\202" nil t) (- (point) 2)))
-           pos)
+      (save-excursion
+       (gnus-set-work-buffer)
+       (let ((gnus-summary-line-format-spec spec))
+         (gnus-summary-insert-line
+          [0 "" "" "" "" "" 0 0 ""]  0 nil 128 t nil "" nil 1)
+         (goto-char (point-min))
+         (setq pos (list (cons 'unread (and (search-forward "\200" nil t)
+                                            (- (point) 2)))))
+         (goto-char (point-min))
+         (push (cons 'replied (and (search-forward "\201" nil t) 
+                                   (- (point) 2)))
+               pos)
+         (goto-char (point-min))
+         (push (cons 'score (and (search-forward "\202" nil t) (- (point) 2)))
+               pos)))
       (setq gnus-summary-mark-positions pos))))
 
 (defun gnus-update-group-mark-positions ()
@@ -3573,6 +3603,12 @@ that that variable is buffer-local to the summary buffers."
   (memq 'virtual (assoc (symbol-name (car (gnus-find-method-for-group group)))
                        gnus-valid-select-methods)))
 
+(defun gnus-news-group-p (group &optional article)
+  "Return non-nil if GROUP (and ARTICLE) come from a news server."
+  (or (gnus-member-of-valid 'post group) ; Ordinary news group.
+      (and (gnus-member-of-valid 'post-mail group) ; Combined group.
+          (eq (gnus-request-type group article) 'news))))
+
 (defsubst gnus-simplify-subject-fully (subject)
   "Simplify a subject string according to the user's wishes."
   (cond
@@ -3606,6 +3642,16 @@ simple-first is t, first argument is already simplified."
        (push group groups)))
     (nreverse groups)))
 
+(defun gnus-completing-read (default prompt &rest args)
+  ;; Like `completing-read', except that DEFAULT is the default argument.
+  (let* ((prompt (if default 
+                    (concat prompt " (default " default ") ")
+                  (concat prompt " ")))
+        (answer (apply 'completing-read prompt args)))
+    (if (or (null answer) (zerop (length answer)))
+       default
+      answer)))
+
 ;; Two silly functions to ensure that all `y-or-n-p' questions clear
 ;; the echo area.
 (defun gnus-y-or-n-p (prompt)
@@ -3670,6 +3716,17 @@ simple-first is t, first argument is already simplified."
     ;; from `message'.
     (apply 'format args)))
 
+(defun gnus-error (level &rest args)
+  "Beep an error if `gnus-verbose' is on LEVEL or less."
+  (when (<= (floor level) gnus-verbose)
+    (apply 'message args)
+    (ding)
+    (let (duration)
+      (when (and (floatp level)
+                (not (zerop (setq duration (* 10 (- level (floor level)))))))
+       (sit-for duration))))
+  nil)
+
 ;; Generate a unique new group name.
 (defun gnus-generate-new-group-name (leaf)
   (let ((name leaf)
@@ -4175,9 +4232,9 @@ The following commands are available:
 (defun gnus-group-default-level (&optional level number-or-nil)
   (cond
    (gnus-group-use-permanent-levels
-    (setq gnus-group-default-list-level
-         (or level gnus-group-default-list-level))
-    (or gnus-group-default-list-level gnus-level-subscribed))
+;    (setq gnus-group-default-list-level
+;        (or level gnus-group-default-list-level))
+    (or level gnus-group-default-list-level gnus-level-subscribed))
    (number-or-nil
     level)
    (t
@@ -4539,8 +4596,13 @@ If REGEXP, only list groups matching REGEXP."
   ;; select method, and return a select method.
   (cond ((stringp method)
         (gnus-server-to-method method))
+       ((equal method gnus-select-method)
+        gnus-select-method)
        ((and (stringp (car method)) group)
         (gnus-server-extend-method group method))
+       ((and method (not group)
+             (equal (cadr method) ""))
+        method)
        (t
         (gnus-server-add-address method))))
 
@@ -4581,6 +4643,16 @@ If REGEXP, only list groups matching REGEXP."
                  (t m2))))
     (gnus-method-equal m1 m2)))
 
+(defun gnus-servers-using-backend (backend)
+  "Return a list of known servers using BACKEND."
+  (let ((opened gnus-opened-servers)
+       out)
+    (while opened
+      (when (eq backend (caaar opened))
+       (push (caar opened) out))
+      (pop opened))
+    out))
+
 (defun gnus-group-prefixed-name (group method)
   "Return the whole name from GROUP and METHOD."
   (and (stringp method) (setq method (gnus-server-to-method method)))
@@ -4687,7 +4759,8 @@ If SYMBOL, return the value of that symbol in the group parameters."
   "Add SCORE to the GROUP score.
 If SCORE is nil, add 1 to the score of GROUP."
   (let ((info (gnus-get-info group)))
-    (gnus-info-set-score info (+ (gnus-info-score info) (or score 1)))))
+    (when info
+      (gnus-info-set-score info (+ (gnus-info-score info) (or score 1))))))
 
 (defun gnus-summary-bubble-group ()
   "Increase the score of the current group.
@@ -4722,16 +4795,18 @@ increase the score of each group you read."
        (setq method (gnus-info-method info))
        (when (gnus-server-equal method "native")
          (setq method nil))
-       (if method
-           ;; It's a foreign group...
-           (gnus-group-make-group
-            (gnus-group-real-name (gnus-info-group info))
-            (if (stringp method) method
-              (prin1-to-string (car method)))
-            (and (consp method)
-                 (nth 1 (gnus-info-method info))))
-         ;; It's a native group.
-         (gnus-group-make-group (gnus-info-group info)))
+       (save-excursion
+         (set-buffer gnus-group-buffer)
+         (if method
+             ;; It's a foreign group...
+             (gnus-group-make-group
+              (gnus-group-real-name (gnus-info-group info))
+              (if (stringp method) method
+                (prin1-to-string (car method)))
+              (and (consp method)
+                   (nth 1 (gnus-info-method info))))
+           ;; It's a native group.
+           (gnus-group-make-group (gnus-info-group info))))
        (gnus-message 6 "Note: New group created")
        (setq entry
              (gnus-gethash (gnus-group-prefixed-name
@@ -4774,6 +4849,7 @@ increase the score of each group you read."
   "Insert GROUP on the current line."
   (let ((entry (gnus-gethash group gnus-newsrc-hashtb))
        active info)
+    (setq gnus-group-indentation (gnus-group-group-indentation))
     (if entry
        (progn
          ;; (Un)subscribed group.
@@ -4790,9 +4866,9 @@ increase the score of each group you read."
           (- (1+ (cdr active)) (car active)) 0)
        nil))))
 
-(defun gnus-group-insert-group-line
-  (gnus-tmp-group gnus-tmp-level gnus-tmp-marked number
-                 gnus-tmp-method)
+(defun gnus-group-insert-group-line (gnus-tmp-group gnus-tmp-level 
+                                                   gnus-tmp-marked number
+                                                   gnus-tmp-method)
   "Insert a group line in the group buffer."
   (let* ((gnus-tmp-active (gnus-active gnus-tmp-group))
         (gnus-tmp-number-total
@@ -4855,7 +4931,7 @@ increase the score of each group you read."
        gnus-marked ,gnus-tmp-marked-mark
        gnus-indentation ,gnus-group-indentation
        gnus-level ,gnus-tmp-level))
-    (when (gnus-visual-p 'group-highlight 'highlight)
+    (when (inline (gnus-visual-p 'group-highlight 'highlight))
       (forward-line -1)
       (run-hooks 'gnus-group-update-hook)
       (forward-line))
@@ -5091,9 +5167,7 @@ Return nil if the group isn't displayed."
                             (substitute-command-keys
                              "\\<gnus-group-mode-map>\\[gnus-group-universal-argument]")))))
            'undefined)
-       (progn
-         (message "Undefined key")
-         (ding))
+       (gnus-error 1 "Undefined key")
       (while groups
        (gnus-group-remove-mark (setq group (pop groups)))
        (command-execute func))))
@@ -5119,6 +5193,7 @@ Take into consideration N (the prefix) and the list of marked groups."
       (nreverse groups)))
    ((and (boundp 'transient-mark-mode)
         transient-mark-mode
+        (boundp 'mark-active)
         mark-active)
     ;; Work on the region between point and mark.
     (let ((max (max (point) (mark)))
@@ -5228,10 +5303,15 @@ Returns whether the fetching was successful or not."
   (interactive
    (list (completing-read
          "Group: " gnus-active-hashtb nil
-         (memq gnus-select-method gnus-have-read-active-file))))
+         (memq gnus-select-method gnus-have-read-active-file)
+         nil
+         'gnus-group-history)))
 
-  (if (equal group "")
-      (error "Empty group name"))
+  (when (equal group "")
+    (error "Empty group name"))
+
+  (when (string-match "[\000-\032]" group)
+    (error "Control characters in group: %s" group))
 
   (let ((b (text-property-any
            (point-min) (point-max)
@@ -5327,10 +5407,12 @@ If EXCLUDE-GROUP, do not go to that group."
   (goto-char (point-min))
   (let ((best 100000)
        unread best-point)
-    (while (setq unread (get-text-property (point) 'gnus-unread))
+    (while (not (eobp))
+      (setq unread (get-text-property (point) 'gnus-unread))
       (if (and (numberp unread) (> unread 0))
          (progn
-           (if (and (< (get-text-property (point) 'gnus-level) best)
+           (if (and (get-text-property (point) 'gnus-level)
+                    (< (get-text-property (point) 'gnus-level) best)
                     (or (not exclude-group)
                         (not (equal exclude-group (gnus-group-group-name)))))
                (progn
@@ -5372,42 +5454,52 @@ ADDRESS."
     (let ((method
           (completing-read
            "Method: " (append gnus-valid-select-methods gnus-server-alist)
-           nil t)))
-      (if (assoc method gnus-valid-select-methods)
-         (list method
-               (if (memq 'prompt-address
-                         (assoc method gnus-valid-select-methods))
-                   (read-string "Address: ")
-                 ""))
-       (list method "")))))
+           nil t nil 'gnus-method-history)))
+      (cond ((assoc method gnus-valid-select-methods)
+            (list method
+                  (if (memq 'prompt-address
+                            (assoc method gnus-valid-select-methods))
+                      (read-string "Address: ")
+                    "")))
+           ((assoc method gnus-server-alist)
+            (list method))
+           (t
+            (list method ""))))))
+
+  (let* ((meth (and method (if address (list (intern method) address)
+                            method)))
+        (nname (if method (gnus-group-prefixed-name name meth) name))
+        backend info)
+    (when (gnus-gethash nname gnus-newsrc-hashtb)
+      (error "Group %s already exists" nname))
+    ;; Subscribe to the new group.
+    (gnus-group-change-level
+     (setq info (list t nname gnus-level-default-subscribed nil nil meth))
+     gnus-level-default-subscribed gnus-level-killed
+     (and (gnus-group-group-name)
+         (gnus-gethash (gnus-group-group-name)
+                       gnus-newsrc-hashtb))
+     t)
+    ;; Make it active.
+    (gnus-set-active nname (cons 1 0))
+    (or (gnus-ephemeral-group-p name)
+       (gnus-dribble-enter
+        (concat "(gnus-group-set-info '" (prin1-to-string (cdr info)) ")")))
+    ;; Insert the line.
+    (gnus-group-insert-group-line-info nname)
+    (forward-line -1)
+    (gnus-group-position-point)
 
-  (save-excursion
-    (set-buffer gnus-group-buffer)
-    (let* ((meth (and method (if address (list (intern method) address)
-                              method)))
-          (nname (if method (gnus-group-prefixed-name name meth) name))
-          info)
-      (and (gnus-gethash nname gnus-newsrc-hashtb)
-          (error "Group %s already exists" nname))
-      (gnus-group-change-level
-       (setq info (list t nname gnus-level-default-subscribed nil nil meth))
-       gnus-level-default-subscribed gnus-level-killed
-       (and (gnus-group-group-name)
-           (gnus-gethash (gnus-group-group-name)
-                         gnus-newsrc-hashtb))
-       t)
-      (gnus-set-active nname (cons 1 0))
-      (or (gnus-ephemeral-group-p name)
-         (gnus-dribble-enter
-          (concat "(gnus-group-set-info '" (prin1-to-string (cdr info)) ")")))
-      (gnus-group-insert-group-line-info nname)
-
-      (when (assoc (symbol-name (car meth)) gnus-valid-select-methods)
-       (require (car meth)))
-      (gnus-check-server meth)
-      (and (gnus-check-backend-function 'request-create-group nname)
-          (gnus-request-create-group nname))
-      t)))
+    ;; Load the backend and try to make the backend create
+    ;; the group as well.
+    (when (assoc (symbol-name (setq backend (car (gnus-server-get-method
+                                                 nil meth))))
+                gnus-valid-select-methods)
+      (require backend))
+    (gnus-check-server meth)
+    (and (gnus-check-backend-function 'request-create-group nname)
+        (gnus-request-create-group nname))
+    t))
 
 (defun gnus-group-delete-group (group &optional force)
   "Delete the current group.
@@ -5428,9 +5520,7 @@ of the Earth\".    There is no undo."
          () ; Whew!
        (gnus-message 6 "Deleting group %s..." group)
        (if (not (gnus-request-delete-group group force))
-           (progn
-             (gnus-message 3 "Couldn't delete group %s" group)
-             (ding))
+           (gnus-error 3 "Couldn't delete group %s" group)
          (gnus-message 6 "Deleting group %s...done" group)
          (gnus-group-goto-group group)
          (gnus-group-kill-group 1 t)
@@ -5464,9 +5554,7 @@ of the Earth\".    There is no undo."
   (gnus-message 6 "Renaming group %s to %s..." group new-name)
   (prog1
       (if (not (gnus-request-rename-group group new-name))
-         (progn
-           (gnus-message 3 "Couldn't rename group %s to %s" group new-name)
-           (ding))
+         (gnus-error 3 "Couldn't rename group %s to %s" group new-name)
        ;; We rename the group internally by killing it...
        (gnus-group-goto-group group)
        (gnus-group-kill-group)
@@ -5591,10 +5679,10 @@ of the Earth\".  There is no undo."
                                    "etc/gnus-tut.txt"))))
        (setq path nil)))
     (if (not file)
-       (message "Couldn't find doc group")
+       (gnus-message 1 "Couldn't find doc group")
       (gnus-group-make-group
        (gnus-group-real-name name)
-       (list 'nndoc name
+       (list 'nndoc "gnus-help"
             (list 'nndoc-address file)
             (list 'nndoc-article-type 'mbox)))))
   (gnus-group-position-point))
@@ -5625,11 +5713,9 @@ of the Earth\".   There is no undo."
                 (file-name-nondirectory file) '(nndoc "")))))
     (gnus-group-make-group
      (gnus-group-real-name name)
-     (list 'nndoc name
+     (list 'nndoc (file-name-nondirectory file)
           (list 'nndoc-address file)
-          (list 'nndoc-article-type (or type 'guess))))
-    (forward-line -1)
-    (gnus-group-position-point)))
+          (list 'nndoc-article-type (or type 'guess))))))
 
 (defun gnus-group-make-archive-group (&optional all)
   "Create the (ding) Gnus archive group of the most recent articles.
@@ -5644,9 +5730,7 @@ Given a prefix, create a full group."
      (list 'nndir (if all "hpc" "edu")
           (list 'nndir-directory
                 (if all gnus-group-archive-directory
-                  gnus-group-recent-archive-directory)))))
-  (forward-line -1)
-  (gnus-group-position-point))
+                  gnus-group-recent-archive-directory))))))
 
 (defun gnus-group-make-directory-group (dir)
   "Create an nndir group.
@@ -5669,9 +5753,7 @@ mail messages or news articles in files that have numeric names."
       (setq ext (format "<%d>" (setq i (1+ i)))))
     (gnus-group-make-group
      (gnus-group-real-name group)
-     (list 'nndir group (list 'nndir-directory dir))))
-  (forward-line -1)
-  (gnus-group-position-point))
+     (list 'nndir group (list 'nndir-directory dir)))))
 
 (defun gnus-group-make-kiboze-group (group address scores)
   "Create an nnkiboze group.
@@ -5696,14 +5778,9 @@ score file entries for articles to include in the group."
        (setq scores (cons (cons header regexps) scores)))
       scores)))
   (gnus-group-make-group group "nnkiboze" address)
-  (save-excursion
-    (gnus-set-work-buffer)
+  (nnheader-temp-write (gnus-score-file-name (concat "nnkiboze:" group))
     (let (emacs-lisp-mode-hook)
-      (pp scores (current-buffer)))
-    (write-region (point-min) (point-max)
-                 (gnus-score-file-name (concat "nnkiboze:" group))))
-  (forward-line -1)
-  (gnus-group-position-point))
+      (pp scores (current-buffer)))))
 
 (defun gnus-group-add-to-virtual (n vgroup)
   "Add the current group to a virtual group."
@@ -5850,7 +5927,7 @@ If REVERSE, sort in reverse order."
        (level2 (gnus-info-level info2)))
     (or (< level1 level2)
        (and (= level1 level2)
-            (< (gnus-info-score info1) (gnus-info-score info2))))))
+            (> (gnus-info-score info1) (gnus-info-score info2))))))
 
 ;; Group catching up.
 
@@ -5893,11 +5970,13 @@ caught up is returned."
              (nnvirtual-catchup-group
               (gnus-group-real-name (car groups)) (nth 1 method) all)))
        (gnus-group-remove-mark (car groups))
-       (if (prog1
-               (gnus-group-goto-group (car groups))
-             (gnus-group-catchup (car groups) all))
-           (gnus-group-update-group-line)
-         (setq ret (1+ ret)))
+       (if (>= (gnus-group-group-level) gnus-level-zombie)
+           (gnus-message 2 "Dead groups can't be caught up")
+         (if (prog1
+                 (gnus-group-goto-group (car groups))
+               (gnus-group-catchup (car groups) all))
+             (gnus-group-update-group-line)
+           (setq ret (1+ ret))))
        (setq groups (cdr groups)))
       (gnus-group-next-unread-group 1)
       ret)))
@@ -6033,7 +6112,9 @@ group line."
   (interactive
    (list (completing-read
          "Group: " gnus-active-hashtb nil
-         (memq gnus-select-method gnus-have-read-active-file))))
+         (memq gnus-select-method gnus-have-read-active-file)
+         nil 
+         'gnus-group-history)))
   (let ((newsrc (gnus-gethash group gnus-newsrc-hashtb)))
     (cond
      ((string-match "^[ \t]$" group)
@@ -6279,8 +6360,7 @@ entail asking the server for the groups."
        (buffer-read-only nil))
     (erase-buffer)
     (while groups
-      (gnus-group-insert-group-line-info (car groups))
-      (setq groups (cdr groups)))
+      (gnus-group-insert-group-line-info (pop groups)))
     (goto-char (point-min))))
 
 (defun gnus-activate-all-groups (level)
@@ -6324,28 +6404,24 @@ If N is negative, this group and the N-1 previous groups will be checked."
   (interactive "P")
   (let* ((groups (gnus-group-process-prefix n))
         (ret (if (numberp n) (- n (length groups)) 0))
+        (beg (unless n (point)))
         group)
-    (while groups
-      (setq group (car groups)
-           groups (cdr groups))
+    (while (setq group (pop groups))
       (gnus-group-remove-mark group)
-      (unless (gnus-get-new-news-in-group group)
-       (ding)
-       (gnus-message 3 "%s error: %s" group (gnus-status-message group))))
+      (if (gnus-activate-group group 'scan)
+         (progn
+           (gnus-get-unread-articles-in-group
+            (gnus-get-info group) (gnus-active group) t)
+           (unless (gnus-virtual-group-p group)
+             (gnus-close-group group))
+           (gnus-group-update-group group))
+       (gnus-error 3 "%s error: %s" group (gnus-status-message group))))
+    (when beg (goto-char beg))
     (when gnus-goto-next-group-when-activating
       (gnus-group-next-unread-group 1 t))
     (gnus-summary-position-point)
     ret))
 
-(defun gnus-get-new-news-in-group (group)
-  (when (and group (gnus-activate-group group 'scan))
-    (gnus-get-unread-articles-in-group
-     (gnus-get-info group) (gnus-active group) t)
-    (gnus-close-group group)
-    (when (gnus-group-goto-group group)
-      (gnus-group-update-group-line))
-    t))
-
 (defun gnus-group-fetch-faq (group &optional faq-dir)
   "Fetch the FAQ for the current group."
   (interactive
@@ -6381,7 +6457,7 @@ If N is negative, this group and the N-1 previous groups will be checked."
                   gnus-description-hashtb))
             (setq desc (gnus-group-get-description group))
             (gnus-read-descriptions-file method))
-        (message
+        (gnus-message 1
          (or desc (gnus-gethash group gnus-description-hashtb)
              "No description available")))))
 
@@ -6653,7 +6729,7 @@ and the second element is the address."
    (list (let ((how (completing-read
                     "Which backend: "
                     (append gnus-valid-select-methods gnus-server-alist)
-                    nil t (cons "nntp" 0))))
+                    nil t (cons "nntp" 0) 'gnus-method-history)))
           ;; We either got a backend name or a virtual server name.
           ;; If the first, we also need an address.
           (if (assoc how gnus-valid-select-methods)
@@ -7009,6 +7085,9 @@ The following commands are available:
   (setq selective-display-ellipses t)  ;Display `...'
   (setq buffer-display-table gnus-summary-display-table)
   (setq gnus-newsgroup-name group)
+  (make-local-variable 'gnus-summary-line-format)
+  (make-local-variable 'gnus-summary-line-format-spec)
+  (make-local-variable 'gnus-summary-mark-positions)
   (run-hooks 'gnus-summary-mode-hook))
 
 (defun gnus-summary-make-display-table ()
@@ -7329,7 +7408,7 @@ This is all marks except unread, ticked, dormant, and expirable."
   "Return whether ARTICLE is the last article in the buffer."
   (if (not (setq article (or article (gnus-summary-article-number))))
       t ; All non-existant numbers are the last article. :-)
-    (cdr (gnus-data-find-list article))))
+    (not (cdr (gnus-data-find-list article)))))
 
 (defun gnus-summary-insert-dummy-line (gnus-tmp-subject gnus-tmp-number)
   "Insert a dummy root in the summary buffer."
@@ -7338,8 +7417,6 @@ This is all marks except unread, ticked, dormant, and expirable."
    (point) (progn (eval gnus-summary-dummy-line-format-spec) (point))
    (list 'gnus-number gnus-tmp-number 'gnus-intangible gnus-tmp-number)))
 
-(defvar gnus-thread-indent-array nil)
-(defvar gnus-thread-indent-array-level gnus-thread-indent-level)
 (defun gnus-make-thread-indent-array ()
   (let ((n 200))
     (unless (and gnus-thread-indent-array
@@ -7552,10 +7629,15 @@ If NO-DISPLAY, don't generate a summary buffer."
       (when gnus-build-sparse-threads
        (gnus-build-sparse-threads))
       ;; Find the initial limit.
-      (if show-all
-         (let ((gnus-newsgroup-dormant nil))
+      (if gnus-show-threads
+         (if show-all
+             (let ((gnus-newsgroup-dormant nil))
+               (gnus-summary-initial-limit show-all))
            (gnus-summary-initial-limit show-all))
-       (gnus-summary-initial-limit show-all))
+       (setq gnus-newsgroup-limit 
+             (mapcar 
+              (lambda (header) (mail-header-number header))
+              gnus-newsgroup-headers)))
       ;; Generate the summary buffer.
       (unless no-display
        (gnus-summary-prepare))
@@ -7595,9 +7677,10 @@ If NO-DISPLAY, don't generate a summary buffer."
                 (not no-display)
                 gnus-newsgroup-unreads
                 gnus-auto-select-first)
-           (if (eq gnus-auto-select-first 'best)
-               (gnus-summary-best-unread-article)
-             (gnus-summary-first-unread-article))
+           (unless (if (eq gnus-auto-select-first 'best)
+                       (gnus-summary-best-unread-article)
+                     (gnus-summary-first-unread-article))
+             (gnus-configure-windows 'summary))
          ;; Don't select any articles, just move point to the first
          ;; article in the group.
          (goto-char (point-min))
@@ -7922,7 +8005,7 @@ If NO-DISPLAY, don't generate a summary buffer."
     (let (threads)
       ;; We then insert this thread into the summary buffer.
       (let (gnus-newsgroup-data gnus-newsgroup-threads)
-       (gnus-summary-prepare-threads (list thread))
+       (gnus-summary-prepare-threads (gnus-cut-threads (list thread)))
        (setq data (nreverse gnus-newsgroup-data))
        (setq threads gnus-newsgroup-threads))
       ;; We splice the new data into the data structure.
@@ -8426,12 +8509,11 @@ or a straight list of headers."
   (let (header number mark)
 
     (while headers
-      (setq header (car headers)
-           headers (cdr headers)
-           number (mail-header-number header))
-
       ;; We may have to root out some bad articles...
-      (when (memq number gnus-newsgroup-limit)
+      (when (memq (setq number (mail-header-number
+                               (setq header (pop headers))))
+                 gnus-newsgroup-limit)
+       ;; Mark article as read when it has a low score.
        (when (and gnus-summary-mark-below
                   (< (or (cdr (assq number gnus-newsgroup-scored))
                          gnus-summary-default-score 0)
@@ -8799,7 +8881,7 @@ If WHERE is `summary', the summary mode line format will be used."
               gnus-tmp-header);; passed as argument to any user-format-funcs
          (setq mode-string (eval mformat))
          (setq max-len (max 4 (if gnus-mode-non-string-length
-                                  (- (frame-width)
+                                  (- (window-width)
                                      gnus-mode-non-string-length)
                                 (length mode-string))))
          ;; We might have to chop a bit of the string off...
@@ -8960,6 +9042,7 @@ The resulting hash table is returned, or nil if no Xrefs were found."
        headers id id-dep ref-dep end ref)
     (save-excursion
       (set-buffer nntp-server-buffer)
+      (run-hooks 'gnus-parse-headers-hook)
       (let ((case-fold-search t)
            in-reply-to header p lines)
        (goto-char (point-min))
@@ -9035,11 +9118,9 @@ The resulting hash table is returned, or nil if no Xrefs were found."
                (if (and (search-forward "\nin-reply-to: " nil t)
                         (setq in-reply-to (gnus-header-value))
                         (string-match "<[^>]+>" in-reply-to))
-                   (prog1
-                       (setq ref (substring in-reply-to (match-beginning 0)
-                                            (match-end 0)))
-                     (setq ref ref)))
-               (setq ref "")))
+                   (setq ref (substring in-reply-to (match-beginning 0)
+                                        (match-end 0)))
+                 (setq ref ""))))
            ;; Chars.
            0
            ;; Lines.
@@ -9104,21 +9185,20 @@ The resulting hash table is returned, or nil if no Xrefs were found."
   '(buffer-substring (point) (if (gnus-nov-skip-field) (1- (point)) eol)))
 
 ;; Goes through the xover lines and returns a list of vectors
-(defun gnus-get-newsgroup-headers-xover (sequence &optional force-new)
+(defun gnus-get-newsgroup-headers-xover (sequence &optional 
+                                                 force-new dependencies)
   "Parse the news overview data in the server buffer, and return a
 list of headers that match SEQUENCE (see `nntp-retrieve-headers')."
   ;; Get the Xref when the users reads the articles since most/some
   ;; NNTP servers do not include Xrefs when using XOVER.
   (setq gnus-article-internal-prepare-hook '(gnus-article-get-xrefs))
   (let ((cur nntp-server-buffer)
-       (dependencies gnus-newsgroup-dependencies)
+       (dependencies (or dependencies gnus-newsgroup-dependencies))
        number headers header)
     (save-excursion
       (set-buffer nntp-server-buffer)
       ;; Allow the user to mangle the headers before parsing them.
       (run-hooks 'gnus-parse-headers-hook)
-      ;; Allow the user to mangle the headers before parsing them.
-      (run-hooks 'gnus-parse-headers-hook)
       (goto-char (point-min))
       (while (and sequence (not (eobp)))
        (setq number (read cur))
@@ -9177,8 +9257,7 @@ list of headers that match SEQUENCE (see `nntp-retrieve-headers')."
                 (gnus-nov-field))      ; misc
               ))
       (error (progn
-              (ding)
-              (gnus-message 4 "Strange nov line")
+              (gnus-error 4 "Strange nov line")
               (setq header nil)
               (goto-char eol))))
 
@@ -9326,12 +9405,14 @@ If EXCLUDE-GROUP, do not go to this group."
 
 (defun gnus-summary-find-next (&optional unread article backward)
   (if backward (gnus-summary-find-prev)
-    (let* ((article (or article (gnus-summary-article-number)))
+    (let* ((dummy (gnus-summary-article-intangible-p))
+          (article (or article (gnus-summary-article-number)))
           (arts (gnus-data-find-list article))
           result)
-      (when (or (not gnus-summary-check-current)
-               (not unread)
-               (not (gnus-data-unread-p (car arts))))
+      (when (and (not dummy)
+                (or (not gnus-summary-check-current)
+                    (not unread)
+                    (not (gnus-data-unread-p (car arts)))))
        (setq arts (cdr arts)))
       (when (setq result
                  (if unread
@@ -9574,9 +9655,7 @@ displayed, no centering will be performed."
             "\\<gnus-summary-mode-map>\\[gnus-summary-universal-argument]"
             ))))
         'undefined)
-       (progn
-         (message "Undefined key")
-         (ding))
+       (gnus-error 1 "Undefined key")
       (save-excursion
        (while articles
          (gnus-summary-goto-subject (setq article (pop articles)))
@@ -10244,7 +10323,7 @@ article."
                 (gnus-message 3 "End of message"))
                ((null lines)
                 (if (and (eq gnus-summary-goto-unread 'never)
-                         (not (eq article gnus-newsgroup-end)))
+                         (not (gnus-summary-last-article-p article)))
                     (gnus-summary-next-article)
                   (gnus-summary-next-unread-article))))))
     (gnus-summary-recenter)
@@ -10338,10 +10417,11 @@ Return nil if there are no unread articles."
           (setq best score
                 article (gnus-data-number (car data))))
       (setq data (cdr data)))
-    (if article
-       (gnus-summary-goto-article article)
-      (error "No unread articles"))
-    (gnus-summary-position-point)))
+    (prog1
+       (if article
+           (gnus-summary-goto-article article)
+         (error "No unread articles"))
+      (gnus-summary-position-point))))
 
 (defun gnus-summary-last-subject ()
   "Go to the last displayed subject line in the group."
@@ -10816,7 +10896,9 @@ Return how many articles were fetched."
          ;; The article is present in the buffer, to we just go to it.
          (gnus-summary-goto-article (mail-header-number header) nil t)
        ;; We fetch the article
-       (let ((gnus-override-method gnus-refer-article-method)
+       (let ((gnus-override-method 
+              (and (gnus-news-group-p gnus-newsgroup-name)
+                   gnus-refer-article-method))
              number)
          ;; Start the special refer-article method, if necessary.
          (when gnus-refer-article-method
@@ -11043,6 +11125,7 @@ article massaging functions being run."
     (let ((gnus-have-all-headers t)
          gnus-article-display-hook
          gnus-article-prepare-hook
+         gnus-break-pages
          gnus-visual)
       (gnus-summary-select-article nil 'force)))
 ;  (gnus-configure-windows 'article)
@@ -11136,7 +11219,7 @@ If N is a negative number, move the N previous articles.
 If N is nil and any articles have been marked with the process mark,
 move those articles instead.
 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
-If SELECT-METHOD is symbol, do not move to a specific newsgroup, but
+If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
 re-spool using this method.
 
 For this function to work, both the current newsgroup and the
@@ -11156,9 +11239,9 @@ and `request-accept' functions."
         (error "The current group does not support article editing")))
   (let ((articles (gnus-summary-work-articles n))
        (prefix (gnus-group-real-prefix gnus-newsgroup-name))
-       (names '((move "move" "Moving")
-                (copy "copy" "Copying")
-                (crosspost "crosspost" "Crossposting")))
+       (names '((move "Move" "Moving")
+                (copy "Copy" "Copying")
+                (crosspost "Crosspost" "Crossposting")))
        (copy-buf (save-excursion
                    (nnheader-set-temp-buffer " *copy article*")))
        art-group to-method new-xref article to-groups)
@@ -11170,12 +11253,11 @@ and `request-accept' functions."
       (setq to-newsgroup
            (gnus-read-move-group-name
             (cadr (assq action names))
-            gnus-current-move-group articles prefix))
+            (symbol-value (intern (format "gnus-current-%s-group" action)))
+            articles prefix))
       (set (intern (format "gnus-current-%s-group" action)) to-newsgroup))
-    (setq to-method (if select-method (list select-method "")
-                     (gnus-find-method-for-group to-newsgroup)))
-    ;;(when (equal to-newsgroup gnus-newsgroup-name)
-    ;;(error "Can't %s to the same group you're already in" action))
+    (setq to-method (or select-method 
+                       (gnus-find-method-for-group to-newsgroup)))
     ;; Check the method we are to move this article to...
     (or (gnus-check-backend-function 'request-accept-article (car to-method))
        (error "%s does not support article copying" (car to-method)))
@@ -11183,7 +11265,7 @@ and `request-accept' functions."
        (error "Can't open server %s" (car to-method)))
     (gnus-message 6 "%s to %s: %s..."
                  (caddr (assq action names))
-                 (or select-method to-newsgroup) articles)
+                 (or (car select-method) to-newsgroup) articles)
     (while articles
       (setq article (pop articles))
       (setq
@@ -11197,9 +11279,7 @@ and `request-accept' functions."
          (nth 1 (gnus-find-method-for-group
                  gnus-newsgroup-name)) ; Server
          (list 'gnus-request-accept-article
-               (if select-method
-                   (list 'quote select-method)
-                 to-newsgroup)
+               to-newsgroup (list 'quote select-method)
                (not articles))         ; Accept form
          (not articles)))              ; Only save nov last time
        ;; Copy the article.
@@ -11208,8 +11288,7 @@ and `request-accept' functions."
           (set-buffer copy-buf)
           (gnus-request-article-this-buffer article gnus-newsgroup-name)
           (gnus-request-accept-article
-           (if select-method select-method to-newsgroup)
-           (not articles))))
+           to-newsgroup select-method (not articles))))
        ;; Crosspost the article.
        ((eq action 'crosspost)
         (let ((xref (mail-header-xref (gnus-summary-article-header article))))
@@ -11225,8 +11304,7 @@ and `request-accept' functions."
             (gnus-request-article-this-buffer article gnus-newsgroup-name)
             (nnheader-replace-header "xref" new-xref)
             (gnus-request-accept-article
-             (if select-method select-method to-newsgroup)
-             (not articles)))))))
+             to-newsgroup select-method (not articles)))))))
       (if (not art-group)
          (gnus-message 1 "Couldn't %s article %s"
                        (cadr (assq action names)) article)
@@ -11236,8 +11314,8 @@ and `request-accept' functions."
                 (gnus-gethash
                  (gnus-group-prefixed-name
                   (car art-group)
-                  (if select-method (list select-method "")
-                    (gnus-find-method-for-group to-newsgroup)))
+                  (or select-method 
+                      (gnus-find-method-for-group to-newsgroup)))
                  gnus-newsrc-hashtb)))
               (info (nth 2 entry))
               (to-group (gnus-info-group info)))
@@ -11313,7 +11391,7 @@ and `request-accept' functions."
 (defun gnus-summary-copy-article (&optional n to-newsgroup select-method)
   "Move the current article to a different newsgroup.
 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
-If SELECT-METHOD is symbol, do not move to a specific newsgroup, but
+If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
 re-spool using this method."
   (interactive "P")
   (gnus-summary-move-article n nil select-method 'copy))
@@ -11323,7 +11401,11 @@ re-spool using this method."
   (interactive "P")
   (gnus-summary-move-article n nil nil 'crosspost))
 
-(defun gnus-summary-respool-article (&optional n respool-method)
+(defvar gnus-summary-respool-default-method nil
+  "Default method for respooling an article.  
+If nil, use to the current newsgroup method.")
+
+(defun gnus-summary-respool-article (&optional n method)
   "Respool the current article.
 The article will be squeezed through the mail spooling process again,
 which means that it will be put in some mail newsgroup or other
@@ -11337,22 +11419,35 @@ Respooling can be done both from mail groups and \"real\" newsgroups.
 In the former case, the articles in question will be moved from the
 current group into whatever groups they are destined to.  In the
 latter case, they will be copied into the relevant groups."
-  (interactive "P")
+  (interactive 
+   (list current-prefix-arg
+        (let* ((methods (gnus-methods-using 'respool))
+               (methname
+                (symbol-name (or gnus-summary-respool-default-method
+                                 (car (gnus-find-method-for-group
+                                       gnus-newsgroup-name)))))
+               (method
+                (gnus-completing-read 
+                 methname "What backend do you want to use when? "
+                 methods nil t nil 'gnus-method-history))
+               ms)
+          (cond
+           ((zerop (length (setq ms (gnus-servers-using-backend method))))
+            (list (intern method) ""))
+           ((= 1 (length ms))
+            (car ms))
+           (t
+            (cdr (completing-read 
+                  "Server name: "
+                  (mapcar (lambda (m) (cons (cadr m) m)) ms) nil t)))))))
   (gnus-set-global-variables)
-  (let ((respool-methods (gnus-methods-using 'respool))
-       (methname
-        (symbol-name (car (gnus-find-method-for-group gnus-newsgroup-name)))))
-    (unless respool-method
-      (setq respool-method
-           (completing-read
-            "What method do you want to use when respooling? "
-            respool-methods nil t (cons methname 0))))
-    (unless (string= respool-method "")
-      (if (assoc (symbol-name
-                 (car (gnus-find-method-for-group gnus-newsgroup-name)))
-                respool-methods)
-         (gnus-summary-move-article n nil (intern respool-method))
-       (gnus-summary-copy-article n nil (intern respool-method))))))
+  (unless method
+    (error "No method given for respooling"))
+  (if (assoc (symbol-name
+             (car (gnus-find-method-for-group gnus-newsgroup-name)))
+            (gnus-methods-using 'respool))
+      (gnus-summary-move-article n nil method)
+    (gnus-summary-copy-article n nil method)))
 
 (defun gnus-summary-import-article (file)
   "Import a random file into a mail newsgroup."
@@ -11385,7 +11480,7 @@ latter case, they will be copied into the relevant groups."
                "Message-ID: " (gnus-inews-message-id) "\n"
                "Lines: " (int-to-string lines) "\n"
                "Chars: " (int-to-string (nth 7 atts)) "\n\n"))
-      (gnus-request-accept-article group t)
+      (gnus-request-accept-article group nil t)
       (kill-buffer (current-buffer)))))
 
 (defun gnus-summary-expire-articles ()
@@ -11510,9 +11605,8 @@ groups."
   (if (gnus-group-read-only-p)
       (progn
        (gnus-summary-edit-article-postpone)
-       (gnus-message
-        1 "The current newsgroup does not support article editing.")
-       (ding))
+       (gnus-error
+        1 "The current newsgroup does not support article editing."))
     (let ((buf (format "%s" (buffer-string))))
       (erase-buffer)
       (insert buf)
@@ -11529,6 +11623,12 @@ groups."
        (when gnus-use-cache
          (gnus-cache-update-article 
           (cdr gnus-article-current) (car gnus-article-current))))
+      (save-excursion
+       (when (get-buffer gnus-original-article-buffer)
+         (set-buffer gnus-original-article-buffer)
+         (setq gnus-original-article nil)))
+      (setq gnus-article-current nil
+           gnus-current-article nil)
       (run-hooks 'gnus-article-display-hook)
       (and (gnus-visual-p 'summary-highlight 'highlight)
           (run-hooks 'gnus-visual-mark-article-hook)))))
@@ -11591,7 +11691,7 @@ groups."
   "Return the score of the current article."
   (interactive)
   (gnus-set-global-variables)
-  (message "%s" (gnus-summary-article-score)))
+  (gnus-message 1 "%s" (gnus-summary-article-score)))
 
 ;; Summary marking commands.
 
@@ -11945,9 +12045,10 @@ marked."
   (beginning-of-line)
   (let ((forward (cdr (assq type gnus-summary-mark-positions)))
        (buffer-read-only nil))
-    (when forward
+    (when (and forward
+              (<= (+ forward (point)) (point-max)))
       ;; Go to the right position on the line.
-      (forward-char forward)
+      (goto-char (+ forward (point)))
       ;; Replace the old mark with the new mark.
       (subst-char-in-region (point) (1+ (point)) (following-char) mark)
       ;; Optionally update the marks by some user rule.
@@ -12261,26 +12362,27 @@ with that article."
                 (gnus-simplify-subject-fuzzy
                  (mail-header-subject (gnus-data-header (car data)))))
                (t nil)))
+        (end-point (save-excursion
+                     (if (gnus-summary-go-to-next-thread) 
+                         (point) (point-max))))
         articles)
-    (if (not data)
-       ()                              ; This article doesn't exist.
-      (while data
-       (and (or (not top-subject)
-                (string= top-subject
-                         (if (eq gnus-thread-operation-ignore-subject 'fuzzy)
-                             (gnus-simplify-subject-fuzzy
-                              (mail-header-subject
-                               (gnus-data-header (car data))))
-                           (gnus-simplify-subject-re
-                            (mail-header-subject
-                             (gnus-data-header (car data)))))))
-            (setq articles (cons (gnus-data-number (car data)) articles)))
-       (if (and (setq data (cdr data))
-                (> (gnus-data-level (car data)) top-level))
-           ()
-         (setq data nil)))
-      ;; Return the list of articles.
-      (nreverse articles))))
+    (while (and data
+               (< (gnus-data-pos (car data)) end-point))
+      (when (or (not top-subject)
+               (string= top-subject
+                        (if (eq gnus-thread-operation-ignore-subject 'fuzzy)
+                            (gnus-simplify-subject-fuzzy
+                             (mail-header-subject
+                              (gnus-data-header (car data))))
+                          (gnus-simplify-subject-re
+                           (mail-header-subject
+                            (gnus-data-header (car data)))))))
+       (push (gnus-data-number (car data)) articles))
+      (unless (and (setq data (cdr data))
+                  (> (gnus-data-level (car data)) top-level))
+       (setq data nil)))
+    ;; Return the list of articles.
+    (nreverse articles)))
 
 (defun gnus-summary-rethread-current ()
   "Rethread the thread the current article is part of."
@@ -12338,8 +12440,8 @@ is non-nil or the Subject: of both articles are the same."
        (set-buffer gnus-summary-buffer)
        (gnus-summary-unmark-all-processable)
        (gnus-summary-rethread-current)
-       (message "Article %d is now the child of article %d."
-                current-article parent-article)))))
+       (gnus-message 3 "Article %d is now the child of article %d."
+                     current-article parent-article)))))
 
 (defun gnus-summary-toggle-threads (&optional arg)
   "Toggle showing conversation threads.
@@ -12793,8 +12895,20 @@ save those articles instead."
 (defun gnus-read-move-group-name (prompt default articles prefix)
   "Read a group name."
   (let* ((split-name (gnus-get-split-value gnus-move-split-methods))
+        group-map
+        (dum (mapatoms
+              (lambda (g) 
+                (and (boundp g)
+                     (symbol-name g)
+                     (memq 'respool
+                           (assoc (symbol-name
+                                   (car (gnus-find-method-for-group
+                                         (symbol-name g))))
+                                  gnus-valid-select-methods))
+                     (push (list (symbol-name g)) group-map)))
+              gnus-active-hashtb))
         (prom
-         (format "Where do you want to %s %s? "
+         (format "%s %s to:"
                  prompt
                  (if (> (length articles) 1)
                      (format "these %d articles" (length articles))
@@ -12802,19 +12916,19 @@ save those articles instead."
         (to-newsgroup
          (cond
           ((null split-name)
-           (completing-read
-            (concat prom
-                    (if default
-                        (format "(default %s) " default)
-                      ""))
-            gnus-active-hashtb nil nil prefix))
+           (gnus-completing-read default prom
+                                 group-map nil nil prefix
+                                 'gnus-group-history))
           ((= 1 (length split-name))
-           (completing-read prom gnus-active-hashtb
-                            nil nil (cons (car split-name) 0)))
+           (gnus-completing-read (car split-name) prom group-map
+                                 nil nil nil
+                                 'gnus-group-history))
           (t
-           (completing-read
-            prom (mapcar (lambda (el) (list el)) (nreverse split-name)))))))
-
+           (gnus-completing-read nil prom 
+                                 (mapcar (lambda (el) (list el))
+                                         (nreverse split-name))
+                                 nil nil nil
+                                 'gnus-group-history)))))
     (when to-newsgroup
       (if (or (string= to-newsgroup "")
              (string= to-newsgroup prefix))
@@ -12844,14 +12958,15 @@ save those articles instead."
             (concat gnus-article-save-directory (car split-name))))
           ;; A list of splits was found.
           (t
-           (setq split-name (mapcar (lambda (el) (list el))
-                                    (nreverse split-name)))
-           (let ((result (completing-read
-                          (concat prompt " ") split-name nil nil)))
-             (concat gnus-article-save-directory
-                     (if (string= result "")
-                         (caar split-name)
-                       result)))))))
+           (setq split-name (nreverse split-name))
+           (let (result)
+             (let ((file-name-history (nconc split-name file-name-history)))
+               (setq result
+                     (read-file-name
+                      (concat prompt " (`M-p' for defaults) ")
+                      gnus-article-save-directory
+                      (car split-name))))
+             (car (push result file-name-history)))))))
     ;; If we have read a directory, we append the default file name.
     (when (file-directory-p file)
       (setq file (concat (file-name-as-directory file)
@@ -13046,7 +13161,7 @@ is initialized from the SAVEDIR environment variable."
          (gnus-summary-goto-subject after-article)
          (forward-line 1)
          (setq b (point))
-         (insert "          " (file-name-nondirectory
+         (insert "    " (file-name-nondirectory
                                (cdr (assq 'name (car pslist))))
                  ": " (or (cdr (assq 'execute (car pslist))) "") "\n")
          (setq e (point))
@@ -13327,6 +13442,7 @@ The following commands are available:
              (if (gnus-request-article article group (current-buffer))
                  (progn
                    (and gnus-keep-backlog
+                        (numberp article)
                         (gnus-backlog-enter-article
                          group article (current-buffer)))
                    'article))))
@@ -13346,10 +13462,10 @@ The following commands are available:
            (setq major-mode 'gnus-original-article-mode)
            (setq buffer-read-only t)
            (gnus-add-current-to-buffer-list))
-         (setq gnus-original-article (cons group article))
          (let (buffer-read-only)
            (erase-buffer)
-           (insert-buffer-substring gnus-article-buffer))))
+           (insert-buffer-substring gnus-article-buffer))
+         (setq gnus-original-article (cons group article))))
     
       ;; Update sparse articles.
       (when do-update-line
@@ -13363,6 +13479,9 @@ The following commands are available:
 (defun gnus-read-header (id &optional header)
   "Read the headers of article ID and enter them into the Gnus system."
   (let ((group gnus-newsgroup-name)
+       (gnus-override-method 
+        (and (gnus-news-group-p gnus-newsgroup-name)
+             gnus-refer-article-method))       
        where)
     ;; First we check to see whether the header in question is already
     ;; fetched.
@@ -13454,10 +13573,8 @@ If ALL-HEADERS is non-nil, no headers are hidden."
                (setq gnus-current-article article)
                (gnus-summary-mark-article article gnus-canceled-mark))
              (unless (memq article gnus-newsgroup-sparse)
-               (gnus-message
-                1 "No such article (may have expired or been canceled)")
-               (ding)
-               nil))
+               (gnus-error
+                1 "No such article (may have expired or been canceled)")))
          (if (or (eq result 'pseudo) (eq result 'nneething))
              (progn
                (save-excursion
@@ -13547,6 +13664,17 @@ Provided for backwards compatibility."
       gnus-inhibit-hiding
       (gnus-article-hide-headers)))
 
+(defsubst gnus-article-header-rank ()
+  "Give the rank of the string HEADER as given by `gnus-sorted-header-list'."
+  (let ((list gnus-sorted-header-list)
+       (i 0))
+    (while list
+      (when (looking-at (car list))
+       (setq list nil))
+      (setq list (cdr list))
+      (incf i))
+    i))
+
 (defun gnus-article-hide-headers (&optional arg delete)
   "Toggle whether to hide unwanted headers and possibly sort them as well.
 If given a negative prefix, always show; if given a positive prefix,
@@ -13561,6 +13689,7 @@ always hide."
          (let ((buffer-read-only nil)
                (props (nconc (list 'gnus-type 'headers)
                              gnus-hidden-properties))
+               (max (1+ (length gnus-sorted-header-list)))
                (ignored (when (not (stringp gnus-visible-headers))
                           (cond ((stringp gnus-ignored-headers)
                                  gnus-ignored-headers)
@@ -13595,46 +13724,22 @@ always hide."
              (beginning-of-line)
              ;; We add the headers we want to keep to a list and delete
              ;; them from the buffer.
-             (if (or (and visible (looking-at visible))
-                     (and ignored (not (looking-at ignored))))
-                 (progn
-                   (push (buffer-substring
-                          (setq beg (point))
-                          (progn
-                            (forward-line 1)
-                            ;; Be sure to get multi-line headers...
-                            (re-search-forward "^[^ \t]*:" nil t)
-                            (beginning-of-line)
-                            (point)))
-                         want-list)
-                   (delete-region beg (point)))
-               (forward-line 1)))
-           ;; Sort the headers that we want to display.
-           (setq want-list (sort want-list 'gnus-article-header-less))
-           (goto-char (point-min))
-           (while want-list
-             (insert (pop want-list)))
-           ;; We make the unwanted headers invisible.
-           (if delete
-               (delete-region (point-min) (point-max))
-             ;; Suggested by Sudish Joseph <joseph@cis.ohio-state.edu>.
-             (gnus-hide-text-type (point) (point-max) 'headers))))))))
-
-(defsubst gnus-article-header-rank (header)
-  "Give the rank of the string HEADER as given by `gnus-sorted-header-list'."
-  (let ((list gnus-sorted-header-list)
-       (i 0))
-    (while list
-      (when (string-match (car list) header)
-       (setq list nil))
-      (setq list (cdr list))
-      (incf i))
-    i))
-
-(defun gnus-article-header-less (h1 h2)
-  "Say whether string H1 is \"less\" than string H2."
-  (< (gnus-article-header-rank h1)
-     (gnus-article-header-rank h2)))
+             (put-text-property 
+              (point) (1+ (point)) 'message-rank
+              (if (or (and visible (looking-at visible))
+                      (and ignored
+                           (not (looking-at ignored))))
+                  (gnus-article-header-rank) 
+                (+ 2 max)))
+             (forward-line 1))
+           (message-sort-headers-1)
+           (when (setq beg (text-property-any 
+                            (point-min) (point-max) 'message-rank (+ 2 max)))
+             ;; We make the unwanted headers invisible.
+             (if delete
+                 (delete-region beg (point-max))
+               ;; Suggested by Sudish Joseph <joseph@cis.ohio-state.edu>.
+               (gnus-hide-text-type beg (point-max) 'headers)))))))))
 
 (defun gnus-article-hide-boring-headers (&optional arg)
   "Toggle hiding of headers that aren't very interesting.
@@ -13681,8 +13786,9 @@ always hide."
                (when (and
                       from reply-to
                       (equal 
-                       (nth 1 (mail-extract-address-components from))
-                       (nth 1 (mail-extract-address-components reply-to))))
+                       (nth 1 (funcall gnus-extract-address-components from))
+                       (nth 1 (funcall gnus-extract-address-components
+                                       reply-to))))
                  (gnus-article-hide-header "reply-to"))))
             ((eq elem 'date)
              (let ((date (mail-fetch-field "date")))
@@ -13841,15 +13947,16 @@ or not."
     (let ((case-fold-search t)
          (buffer-read-only nil)
          (type (gnus-fetch-field "content-transfer-encoding")))
+      (gnus-headers-decode-quoted-printable)
       (when (or force
-               (and type (string-match "quoted-printable" type)))
-       (gnus-headers-decode-quoted-printable)
+               (and type (string-match "quoted-printable" (downcase type))))
        (goto-char (point-min))
        (search-forward "\n\n" nil 'move)
        (gnus-mime-decode-quoted-printable (point) (point-max))))))
 
 (defun gnus-mime-decode-quoted-printable (from to)
   "Decode Quoted-Printable in the region between FROM and TO."
+  (interactive "r")
   (goto-char from)
   (while (search-forward "=" to t)
     (cond ((eq (following-char) ?\n)
@@ -14007,7 +14114,8 @@ how much time has lapsed since DATE."
         (date (and (vectorp header) (mail-header-date header)))
         (date-regexp "^Date: \\|^X-Sent: ")
         (now (current-time))
-        (inhibit-point-motion-hooks t))
+        (inhibit-point-motion-hooks t)
+        bface eface)
     (when (and date (not (string= date "")))
       (save-excursion
        (set-buffer gnus-article-buffer)
@@ -14015,8 +14123,12 @@ how much time has lapsed since DATE."
          (nnheader-narrow-to-headers)
          (let ((buffer-read-only nil))
            ;; Delete any old Date headers.
-           (if (zerop (nnheader-remove-header date-regexp t))
-               (beginning-of-line)
+           (if (re-search-forward date-regexp nil t)
+               (progn
+                 (setq bface (get-text-property (gnus-point-at-bol) 'face)
+                       eface (get-text-property (gnus-point-at-eol) 'face))
+                 (message-remove-header date-regexp t)
+                 (beginning-of-line))
              (goto-char (point-max)))
            (insert
             (cond
@@ -14090,8 +14202,13 @@ how much time has lapsed since DATE."
              (t
               (error "Unknown conversion type: %s" type)))))
          ;; Do highlighting.
-         (when (and highlight (gnus-visual-p 'article-highlight 'highlight))
-           (gnus-article-highlight-headers)))))))
+         (beginning-of-line)
+         (when (and highlight (gnus-visual-p 'article-highlight 'highlight)
+                    (looking-at "\\([^:]\\): *\\(.*\\)$"))
+           (put-text-property (match-beginning 1) (match-end 1)
+                              'face bface)
+           (put-text-property (match-beginning 2) (match-end 2)
+                              'face eface)))))))
 
 (defun gnus-article-date-local (&optional highlight)
   "Convert the current article date to the local timezone."
@@ -14238,12 +14355,12 @@ If given a numerical ARG, move forward ARG pages."
   "Show the next page of the article."
   (interactive)
   (when (gnus-article-next-page)
-    (gnus-article-read-summary-keys nil ?n)))
+    (gnus-article-read-summary-keys nil (gnus-character-to-event ?n))))
 
 (defun gnus-article-goto-prev-page ()
   "Show the next page of the article."
   (interactive)
-  (if (bobp) (gnus-article-read-summary-keys nil ?n)
+  (if (bobp) (gnus-article-read-summary-keys nil (gnus-character-to-event ?n))
     (gnus-article-prev-page nil)))
 
 (defun gnus-article-next-page (&optional lines)
@@ -14627,11 +14744,8 @@ If CONFIRM is non-nil, the user will be asked for an NNTP server."
         "%s (%s) open error: '%s'.     Continue? "
         (car gnus-select-method) (cadr gnus-select-method)
         (gnus-status-message gnus-select-method)))
-       (progn
-        (gnus-message 1 "Couldn't open server on %s"
-                      (nth 1 gnus-select-method))
-        (ding)
-        nil)))))
+       (gnus-error 1 "Couldn't open server on %s"
+                  (nth 1 gnus-select-method))))))
 
 (defun gnus-check-group (group)
   "Try to make sure that the server where GROUP exists is alive."
@@ -14869,17 +14983,20 @@ If GROUP is nil, all groups on METHOD are scanned."
             article (gnus-group-real-name group)
             (nth 1 method) accept-function last)))
 
-(defun gnus-request-accept-article (group &optional last method)
+(defun gnus-request-accept-article (group method &optional last)
   ;; Make sure there's a newline at the end of the article.
   (when (stringp method)
     (setq method (gnus-server-to-method method)))
+  (when (and (not method)
+            (stringp group))
+    (setq method (gnus-find-method-for-group group)))
   (goto-char (point-max))
   (unless (bolp)
     (insert "\n"))
-  (let ((func (if (symbolp group) group
-               (car (or method (gnus-find-method-for-group group))))))
+  (let ((func (car (or method (gnus-find-method-for-group group)))))
     (funcall (intern (format "%s-request-accept-article" func))
             (if (stringp group) (gnus-group-real-name group) group)
+            (cadr method)
             last)))
 
 (defun gnus-request-replace-article (article group buffer)
@@ -14959,9 +15076,12 @@ If GROUP is nil, all groups on METHOD are scanned."
                       (gnus-server-extend-method group method))
                      (t
                       method)))
-         (if (equal (cadr method) "")
-             method
-           (gnus-server-add-address method))))))
+         (cond ((equal (cadr method) "")
+                method)
+               ((null (cadr method))
+                (list (car method) ""))
+               (t
+                (gnus-server-add-address method)))))))
 
 (defun gnus-check-backend-function (func group)
   "Check whether GROUP supports function FUNC."
@@ -15041,7 +15161,9 @@ If LEVEL is non-nil, the news will be set up at level LEVEL."
        (gnus-find-new-newsgroups))
 
     ;; We might read in new NoCeM messages here.
-    (when gnus-use-nocem 
+    (when (and gnus-use-nocem 
+              (not level)
+              (not dont-connect))
       (gnus-nocem-scan-groups))
 
     ;; Find the number of unread articles in each non-dead group.
@@ -15164,36 +15286,37 @@ the server for new groups."
          (setq hashtb (gnus-make-hashtable 100))
          (set-buffer nntp-server-buffer)
          ;; Enter all the new groups into a hashtable.
-         (gnus-active-to-gnus-format method hashtb 'ignore)))
-      ;; Now all new groups from `method' are in `hashtb'.
-      (mapatoms
-       (lambda (group-sym)
-        (if (or (null (setq group (symbol-name group-sym)))
-                (null (symbol-value group-sym))
-                (gnus-gethash group gnus-newsrc-hashtb)
-                (member group gnus-zombie-list)
-                (member group gnus-killed-list))
-            ;; The group is already known.
-            ()
-          ;; Make this group active.
-          (when (symbol-value group-sym)
-            (gnus-set-active group (symbol-value group-sym)))
-          ;; Check whether we want it or not.
-          (let ((do-sub (gnus-matches-options-n group)))
-            (cond
-             ((eq do-sub 'subscribe)
-              (incf groups)
-              (gnus-sethash group group gnus-killed-hashtb)
-              (funcall gnus-subscribe-options-newsgroup-method group))
-             ((eq do-sub 'ignore)
-              nil)
-             (t
-              (incf groups)
-              (gnus-sethash group group gnus-killed-hashtb)
-              (if gnus-subscribe-hierarchical-interactive
-                  (push group new-newsgroups)
-                (funcall gnus-subscribe-newsgroup-method group)))))))
-       hashtb)
+         (gnus-active-to-gnus-format method hashtb 'ignore))
+       ;; Now all new groups from `method' are in `hashtb'.
+       (mapatoms
+        (lambda (group-sym)
+          (if (or (null (setq group (symbol-name group-sym)))
+                  (not (boundp group-sym))
+                  (null (symbol-value group-sym))
+                  (gnus-gethash group gnus-newsrc-hashtb)
+                  (member group gnus-zombie-list)
+                  (member group gnus-killed-list))
+              ;; The group is already known.
+              ()
+            ;; Make this group active.
+            (when (symbol-value group-sym)
+              (gnus-set-active group (symbol-value group-sym)))
+            ;; Check whether we want it or not.
+            (let ((do-sub (gnus-matches-options-n group)))
+              (cond
+               ((eq do-sub 'subscribe)
+                (incf groups)
+                (gnus-sethash group group gnus-killed-hashtb)
+                (funcall gnus-subscribe-options-newsgroup-method group))
+               ((eq do-sub 'ignore)
+                nil)
+               (t
+                (incf groups)
+                (gnus-sethash group group gnus-killed-hashtb)
+                (if gnus-subscribe-hierarchical-interactive
+                    (push group new-newsgroups)
+                  (funcall gnus-subscribe-newsgroup-method group)))))))
+        hashtb))
       (when new-newsgroups
        (gnus-subscribe-hierarchical-interactive new-newsgroups)))
     ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
@@ -15427,89 +15550,10 @@ newsgroup."
       (setcdr killed (delete (car killed) (cdr killed)))
       (setq killed (cdr killed)))))
 
-;; Go though `gnus-newsrc-alist' and compare with `gnus-active-hashtb'
-;; and compute how many unread articles there are in each group.
-(defun gnus-get-unread-articles (&optional level)
-  (let* ((newsrc (cdr gnus-newsrc-alist))
-        (level (or level gnus-activate-level (1+ gnus-level-subscribed)))
-        (foreign-level
-         (min
-          (cond ((and gnus-activate-foreign-newsgroups
-                      (not (numberp gnus-activate-foreign-newsgroups)))
-                 (1+ gnus-level-subscribed))
-                ((numberp gnus-activate-foreign-newsgroups)
-                 gnus-activate-foreign-newsgroups)
-                (t 0))
-          level))
-        info group active method)
-    (gnus-message 5 "Checking new news...")
-
-    (while newsrc
-      (setq active (gnus-active (setq group (gnus-info-group
-                                            (setq info (pop newsrc))))))
-
-      ;; Check newsgroups.  If the user doesn't want to check them, or
-      ;; they can't be checked (for instance, if the news server can't
-      ;; be reached) we just set the number of unread articles in this
-      ;; newsgroup to t.  This means that Gnus thinks that there are
-      ;; unread articles, but it has no idea how many.
-      (if (and (setq method (gnus-info-method info))
-              (not (gnus-server-equal
-                    gnus-select-method
-                    (gnus-server-get-method nil method)))
-              (not (gnus-secondary-method-p method)))
-         ;; These groups are foreign.  Check the level.
-         (when (<= (gnus-info-level info) foreign-level)
-           (setq active (gnus-activate-group group 'scan))
-           (gnus-close-group group))
-
-       ;; These groups are native or secondary.
-       (when (and (<= (gnus-info-level info) level)
-                  (not gnus-read-active-file))
-         (setq active (gnus-activate-group group 'scan))
-         (gnus-close-group group)))
-
-      (if active
-         (gnus-get-unread-articles-in-group info active t)
-       ;; The group couldn't be reached, so we nix out the number of
-       ;; unread articles and stuff.
-       (gnus-set-active group nil)
-       (setcar (gnus-gethash group gnus-newsrc-hashtb) t)))
-
-    (gnus-message 5 "Checking new news...done")))
-
-;; Create a hash table out of the newsrc alist.  The `car's of the
-;; alist elements are used as keys.
-(defun gnus-make-hashtable-from-newsrc-alist ()
-  (let ((alist gnus-newsrc-alist)
-       (ohashtb gnus-newsrc-hashtb)
-       prev)
-    (setq gnus-newsrc-hashtb (gnus-make-hashtable (length alist)))
-    (setq alist
-         (setq prev (setq gnus-newsrc-alist
-                          (if (equal (caar gnus-newsrc-alist)
-                                     "dummy.group")
-                              gnus-newsrc-alist
-                            (cons (list "dummy.group" 0 nil) alist)))))
-    (while alist
-      (gnus-sethash
-       (caar alist)
-       (cons (and ohashtb (car (gnus-gethash (caar alist) ohashtb)))
-            prev)
-       gnus-newsrc-hashtb)
-      (setq prev alist
-           alist (cdr alist)))))
-
-(defun gnus-make-hashtable-from-killed ()
-  "Create a hash table from the killed and zombie lists."
-  (let ((lists '(gnus-killed-list gnus-zombie-list))
-       list)
-    (setq gnus-killed-hashtb
-         (gnus-make-hashtable
-          (+ (length gnus-killed-list) (length gnus-zombie-list))))
-    (while (setq list (symbol-value (pop lists)))
-      (while list
-       (gnus-sethash (car list) (pop list) gnus-killed-hashtb)))))
+;; We want to inline a function from gnus-cache, so we cheat here:
+(eval-when-compile
+  (provide 'gnus)
+  (require 'gnus-cache))
 
 (defun gnus-get-unread-articles-in-group (info active &optional update)
   (when active
@@ -15517,12 +15561,13 @@ newsgroup."
     (when (and update 
               (gnus-request-update-info
                info (gnus-find-method-for-group (gnus-info-group info))))
-      (gnus-activate-group (gnus-info-group info)))
+      (gnus-activate-group (gnus-info-group info) nil t))
     (let* ((range (gnus-info-read info))
           (num 0))
       ;; If a cache is present, we may have to alter the active info.
       (when (and gnus-use-cache info)
-       (gnus-cache-possibly-alter-active (gnus-info-group info) active))
+       (inline (gnus-cache-possibly-alter-active 
+                (gnus-info-group info) active)))
       ;; Modify the list of read articles according to what articles
       ;; are available; then tally the unread articles and add the
       ;; number to the group hash table entry.
@@ -15592,7 +15637,97 @@ newsgroup."
        (setcar (gnus-gethash (gnus-info-group info) gnus-newsrc-hashtb) num))
       num)))
 
-(defun gnus-activate-group (group &optional scan)
+;; Go though `gnus-newsrc-alist' and compare with `gnus-active-hashtb'
+;; and compute how many unread articles there are in each group.
+(defun gnus-get-unread-articles (&optional level)
+  (let* ((newsrc (cdr gnus-newsrc-alist))
+        (level (or level gnus-activate-level (1+ gnus-level-subscribed)))
+        (foreign-level
+         (min
+          (cond ((and gnus-activate-foreign-newsgroups
+                      (not (numberp gnus-activate-foreign-newsgroups)))
+                 (1+ gnus-level-subscribed))
+                ((numberp gnus-activate-foreign-newsgroups)
+                 gnus-activate-foreign-newsgroups)
+                (t 0))
+          level))
+        info group active method)
+    (gnus-message 5 "Checking new news...")
+
+    (while newsrc
+      (setq active (gnus-active (setq group (gnus-info-group
+                                            (setq info (pop newsrc))))))
+
+      ;; Check newsgroups.  If the user doesn't want to check them, or
+      ;; they can't be checked (for instance, if the news server can't
+      ;; be reached) we just set the number of unread articles in this
+      ;; newsgroup to t.  This means that Gnus thinks that there are
+      ;; unread articles, but it has no idea how many.
+      (if (and (setq method (gnus-info-method info))
+              (not (gnus-server-equal
+                    gnus-select-method
+                    (setq method (gnus-server-get-method nil method))))
+              (not (gnus-secondary-method-p method)))
+         ;; These groups are foreign.  Check the level.
+         (when (<= (gnus-info-level info) foreign-level)
+           (setq active (gnus-activate-group group 'scan))
+           (unless (inline (gnus-virtual-group-p group))
+             (inline (gnus-close-group group))))
+
+       ;; These groups are native or secondary.
+       (when (and (<= (gnus-info-level info) level)
+                  (not gnus-read-active-file))
+         (setq active (gnus-activate-group group 'scan))
+         (inline (gnus-close-group group))))
+
+      (if active
+         (inline (gnus-get-unread-articles-in-group 
+                  info active
+                  (and method
+                       (fboundp (intern (concat (symbol-name (car method))
+                                                "-request-update-info"))))))
+       ;; The group couldn't be reached, so we nix out the number of
+       ;; unread articles and stuff.
+       (gnus-set-active group nil)
+       (setcar (gnus-gethash group gnus-newsrc-hashtb) t)))
+
+    (gnus-message 5 "Checking new news...done")))
+
+;; Create a hash table out of the newsrc alist.  The `car's of the
+;; alist elements are used as keys.
+(defun gnus-make-hashtable-from-newsrc-alist ()
+  (let ((alist gnus-newsrc-alist)
+       (ohashtb gnus-newsrc-hashtb)
+       prev)
+    (setq gnus-newsrc-hashtb (gnus-make-hashtable (length alist)))
+    (setq alist
+         (setq prev (setq gnus-newsrc-alist
+                          (if (equal (caar gnus-newsrc-alist)
+                                     "dummy.group")
+                              gnus-newsrc-alist
+                            (cons (list "dummy.group" 0 nil) alist)))))
+    (while alist
+      (gnus-sethash
+       (caar alist)
+       (cons (and ohashtb (car (gnus-gethash (caar alist) ohashtb)))
+            prev)
+       gnus-newsrc-hashtb)
+      (setq prev alist
+           alist (cdr alist)))))
+
+(defun gnus-make-hashtable-from-killed ()
+  "Create a hash table from the killed and zombie lists."
+  (let ((lists '(gnus-killed-list gnus-zombie-list))
+       list)
+    (setq gnus-killed-hashtb
+         (gnus-make-hashtable
+          (+ (length gnus-killed-list) (length gnus-zombie-list))))
+    (while (setq list (pop lists))
+      (setq list (symbol-value list))
+      (while list
+       (gnus-sethash (car list) (pop list) gnus-killed-hashtb)))))
+
+(defun gnus-activate-group (group &optional scan dont-check)
   ;; Check whether a group has been activated or not.
   ;; If SCAN, request a scan of that group as well.
   (let ((method (gnus-find-method-for-group group))
@@ -15607,7 +15742,7 @@ newsgroup."
                (gnus-request-scan group method))
           t)
         (condition-case ()
-            (gnus-request-group group)
+            (gnus-request-group group dont-check)
        ;   (error nil)
           (quit nil))
         (save-excursion
@@ -15728,9 +15863,7 @@ Returns whether the updating was successful."
             ((and (eq gnus-read-active-file 'some)
                   (gnus-check-backend-function 'retrieve-groups (car method)))
              (let ((newsrc (cdr gnus-newsrc-alist))
-                   (gmethod (if (stringp method)
-                                (gnus-server-get-method nil method)
-                              method))
+                   (gmethod (gnus-server-get-method nil method))
                    groups info)
                (while (setq info (pop newsrc))
                  (when (gnus-server-equal
@@ -15744,23 +15877,19 @@ Returns whether the updating was successful."
                  (setq list-type (gnus-retrieve-groups groups method))
                  (cond
                   ((not list-type)
-                   (gnus-message
-                    1 "Cannot read partial active file from %s server."
-                    (car method))
-                   (ding)
-                   (sit-for 2))
+                   (gnus-error
+                    1.2 "Cannot read partial active file from %s server."
+                    (car method)))
                   ((eq list-type 'active)
                    (gnus-active-to-gnus-format method gnus-active-hashtb))
                   (t
                    (gnus-groups-to-gnus-format method gnus-active-hashtb))))))
             (t
              (if (not (gnus-request-list method))
-                 (progn
-                   (unless (equal method gnus-message-archive-method)
-                     (gnus-message 1 "Cannot read active file from %s server."
-                                   (car method))
-                     (ding)))
-               (gnus-active-to-gnus-format method)
+                 (unless (equal method gnus-message-archive-method)
+                   (gnus-error 1 "Cannot read active file from %s server."
+                               (car method)))
+               (gnus-active-to-gnus-format method gnus-active-hashtb)
                ;; We mark this active file as read.
                (push method gnus-have-read-active-file)
                (gnus-message 5 "%sdone" mesg))))))
@@ -15956,8 +16085,59 @@ If FORCE is non-nil, the .newsrc file is read."
            (gnus-message 5 "Reading %s...done" newsrc-file)))
 
       ;; Read any slave files.
-      (or gnus-slave
-         (gnus-master-read-slave-newsrc)))))
+      (unless gnus-slave
+       (gnus-master-read-slave-newsrc))
+      
+      ;; Convert old to new.
+      (gnus-convert-old-newsrc))))
+
+(defun gnus-continuum-version (version)
+  "Return VERSION as a floating point number."
+  (when (string-match "^\\([^ ]+\\)? ?Gnus v?\\([0-9.]+\\)$" version)
+    (let* ((alpha (and (match-beginning 1) (match-string 1 version)))
+          (number (match-string 2 version))
+          major minor least)
+      (string-match "\\([0-9]\\)\\.\\([0-9]+\\)\\.?\\([0-9]+\\)?" number)
+      (setq major (string-to-number (match-string 1 number)))
+      (setq minor (string-to-number (match-string 2 number)))
+      (setq least (if (match-beginning 3)
+                     (string-to-number (match-string 3 number))
+                   0))
+      (string-to-number
+       (if (zerop major)
+          (format "%s00%02d%02d"
+                  (cond 
+                   ((string= alpha "(ding)") "4.99")
+                   ((string= alpha "September") "5.01")
+                   ((string= alpha "Red") "5.03"))
+                  minor least)
+        (format "%d.%02d%20d" major minor least))))))
+
+(defun gnus-convert-old-newsrc ()
+  "Convert old newsrc into the new format, if needed."
+  (let ((fcv (and gnus-newsrc-file-version
+                 (gnus-continuum-version gnus-newsrc-file-version))))
+    (cond
+     ;; No .newsrc.eld file was loaded.
+     ((null fcv) nil)
+     ;; Gnus 5 .newsrc.eld was loaded.
+     ((< fcv (gnus-continuum-version "September Gnus v0.1"))
+      (gnus-convert-old-ticks)))))
+
+(defun gnus-convert-old-ticks ()
+  (let ((newsrc (cdr gnus-newsrc-alist))
+       marks info dormant ticked)
+    (while (setq info (pop newsrc))
+      (when (setq marks (gnus-info-marks info))
+       (setq dormant (cdr (assq 'dormant marks))
+             ticked (cdr (assq 'tick marks)))
+       (when (or dormant ticked)
+         (gnus-info-set-read
+          info
+          (gnus-add-to-range
+           (gnus-info-read info)
+           (nconc (gnus-uncompress-range dormant)
+                  (gnus-uncompress-range ticked)))))))))
 
 (defun gnus-read-newsrc-el-file (file)
   (let ((ding-file (concat file "d")))
@@ -15967,8 +16147,7 @@ If FORCE is non-nil, the .newsrc file is read."
       (condition-case nil
          (load ding-file t t t)
        (error
-        (gnus-message 1 "Error in %s" ding-file)
-        (ding)))
+        (gnus-error 1 "Error in %s" ding-file)))
       (when gnus-newsrc-assoc
        (setq gnus-newsrc-alist gnus-newsrc-assoc)))
     (gnus-make-hashtable-from-newsrc-alist)
@@ -16157,11 +16336,9 @@ If FORCE is non-nil, the .newsrc file is read."
                  (progn
                    ;; The line was buggy.
                    (setq group nil)
-                   (gnus-message 3 "Mangled line: %s"
-                                 (buffer-substring (gnus-point-at-bol)
-                                                   (gnus-point-at-eol)))
-                   (ding)
-                   (sit-for 1)))
+                   (gnus-error 3.1 "Mangled line: %s"
+                               (buffer-substring (gnus-point-at-bol)
+                                                 (gnus-point-at-eol)))))
              nil))
          ;; Skip past ", ".  Spaces are illegal in these ranges, but
          ;; we allow them, because it's a common mistake to put a
@@ -16452,9 +16629,7 @@ If FORCE is non-nil, the .newsrc file is read."
                    (eval-buffer (current-buffer))
                    t)
                (error
-                (gnus-message 3 "Possible error in %s" file)
-                (ding)
-                (sit-for 2)
+                (gnus-error 3.2 "Possible error in %s" file)
                 nil))
              (or gnus-slave ; Slaves shouldn't delete these files.
                  (condition-case ()
@@ -16540,25 +16715,6 @@ If FORCE is non-nil, the .newsrc file is read."
       (when (looking-at "[^ \t]+[ \t]+\\(.*\\)")
        (match-string 1)))))
 
-\f
-;;;
-;;; Shutdown
-;;;
-
-(defvar gnus-shutdown-alist nil)
-
-(defun gnus-add-shutdown (function &rest symbols)
-  "Run FUNCTION whenever one of SYMBOLS is shut down."
-  (push (cons function symbols) gnus-shutdown-alist))
-
-(defun gnus-shutdown (symbol)
-  "Shut down everything that waits for SYMBOL."
-  (let ((alist gnus-shutdown-alist)
-       entry)
-    (while (setq entry (pop alist))
-      (when (memq symbol (cdr entry))
-       (funcall (car entry))))))
-
 \f
 ;;;
 ;;; Buffering of read articles.