*** empty log message ***
authorLars Magne Ingebrigtsen <larsi@gnus.org>
Tue, 4 Mar 1997 04:42:11 +0000 (04:42 +0000)
committerLars Magne Ingebrigtsen <larsi@gnus.org>
Tue, 4 Mar 1997 04:42:11 +0000 (04:42 +0000)
24 files changed:
lisp/ChangeLog
lisp/gnus-cache.el
lisp/gnus-ems.el
lisp/gnus-kill.el
lisp/gnus-mh.el
lisp/gnus-msg.el
lisp/gnus-score.el
lisp/gnus-soup.el
lisp/gnus-srvr.el [new file with mode: 0644]
lisp/gnus-topic.el
lisp/gnus-uu.el
lisp/gnus-vis.el
lisp/gnus-vm.el
lisp/gnus-xmas.el
lisp/gnus.el
lisp/nndoc.el
lisp/nnheader.el
lisp/nnmail.el
lisp/nnmh.el
lisp/nnml.el
lisp/nnsoup.el
lisp/nnspool.el
texi/ChangeLog
texi/gnus.texi

index d875291..9553784 100644 (file)
@@ -1,3 +1,292 @@
+Wed Nov 15 06:13:48 1995  Lars Ingebrigtsen  <lars@eyesore.no>
+
+       * gnus-score.el (gnus-score-get): Turned into a defsubst.
+       (gnus-score-find-bnews): Slightly less funcalling.
+
+       * gnus.el (gnus-group-real-name): Turned into a macro.
+       (gnus-server-equal): Ditto.
+       (gnus-server-add-address): Turned into defsubst.
+       (gnus-server-get-method): Ditto.
+       (gnus-secondary-method-p): Ditto.
+
+Mon Nov 13 22:13:10 1995  Lars Ingebrigtsen  <lars@eyesore.no>
+
+       * gnus.el (gnus-group-mode-map): Moved fetch-faq.
+
+       * gnus-vis.el (gnus-button-alist): Be a bit more restrictive.
+
+       * gnus-msg.el (gnus-inews-insert-headers): Would choke on empty
+       headers.
+
+       * nnml.el (nnml-make-nov-line): Include the Xref: in the nov line.
+
+Mon Nov 13 21:54:36 1995    <morioka@jaist.ac.jp>
+
+       * gnus.el (gnus-summary-save-in-rmail): Save original article
+       buffer.
+
+Mon Nov 13 15:10:28 1995  Lars Ingebrigtsen  <lars@eyesore.no>
+
+       * nnsoup.el (nnsoup-open-server): Don't force using nnsoup as a
+       posting agent.
+
+       * gnus.el (gnus-info-group, gnus-info-level, gnus-info-read,
+       gnus-info-method, gnus-info-options): New macros.  Massive changes
+       throughout the file.
+       (gnus-get-info): New macro.
+       (gnus-group-add-score): New function.
+       (gnus-summary-bubble-group): New function.
+       (gnus-group-mode-map): New group sort submap.
+       (gnus-group-sort-groups-by-alphabet,
+       gnus-group-sort-groups-by-unread, gnus-group-sort-groups-by-level,
+       gnus-group-sort-groups-by-score, gnus-group-sort-groups-by-rank,
+       gnus-group-sort-groups-by-method): New commands and keystrokes.
+
+       * nnsoup.el (nnsoup-set-variables): Autoload; doc fix.
+
+       * gnus-score.el (gnus-score-headers): Score "header" names are now
+       case-insensitive.
+
+       * gnus.el (gnus-rebuild-thread): Didn't work when using a
+       non-threaded display.
+
+Sun Nov 12 00:11:34 1995  Lars Ingebrigtsen  <lars@eyesore.no>
+
+       * nnmail.el (nnmail-use-long-file-names): New variable.
+       (nnmail-group-pathname): Use it.
+
+       * gnus.el (gnus-auto-select-first): Allow `best' as a value.
+
+       * gnus-uu.el (gnus-uu-save-article): Quote lines that start with
+       dashes. 
+
+       * gnus-mh.el (gnus-mh-mail-setup): Don't use a (None) subject. 
+
+       * gnus-msg.el (gnus-inews-insert-bfcc): New function.
+       (gnus-new-news): Use it.
+
+       * gnus.el (gnus-summary-generate-hook): New variable.
+       (gnus-summary-prepare): Use it.
+
+       * nnsoup.el (nnsoup-index-buffer): Disable undo.
+
+       * gnus.el (gnus-select-newsgroup): Fetch old headers before
+       scoring. 
+       (gnus-dribble-read-file): Force setting the dribble buffer file
+       name. 
+       (gnus-summary-catchup-to-here): Treat `all' right, and catchup to
+       the right article.
+       (gnus-summary-catchup): Update mode line.
+       (gnus-summary-refer-references): Didn't really work.
+       (gnus-summary-toggle-header): Would barf if point weren't at
+       point-min.
+
+Sat Nov 11 11:21:58 1995  Lars Ingebrigtsen  <lars@eyesore.no>
+
+       * nnmail.el (nnmail-move-inbox): Bind default directory before
+       calling movemail.
+
+       * nndoc.el (nndoc-type-to-regexp): Changed babyl body-begin regexp.
+
+       * nnml.el (nnml-generate-nov-databases): Don't choke on files that
+       start with empty lines.
+
+       * gnus.el (gnus-souped-mark): New variable.
+       (gnus-summary-mark-article-as-read): Use it.
+       (gnus-set-mode-line): Would compute incorrect mode lines. 
+
+       * gnus.el: Changes throughout making ticked and dormant articles
+       subsets of the read articles instead of the unread articles. 
+
+       * gnus-soup.el (gnus-soup-add-article): Use it.
+
+       * gnus-msg.el (gnus-post-news): Respect to `to-group' group
+       parameter. 
+
+       * gnus.el (gnus-sublist-p): New function.
+       (gnus-group-prepare-flat-list-dead): Faster implementation.
+
+Fri Nov 10 03:17:03 1995  Lars Ingebrigtsen  <lars@eyesore.no>
+
+       * gnus.el (gnus-newsgroup-threads): Double defvar.
+       (gnus-newsgroup-prepared): New variable.
+       (gnus-summary-setup-buffer): Use it.
+       (gnus-summary-prepare-threads): Don't destroy threads while
+       generating. 
+       (gnus-remove-thread): Didn't remove gathered threads.
+       (gnus-rebuild-thread): Didn't generate anything properly.
+       (gnus-summary-refer-parent-article): Didn't find parent.
+
+       * gnus-msg.el (gnus-mail-send-method): Removed variable.
+       (gnus-auto-mail-to-author): Doc fix.
+
+       * nnheader.el (nnheader-remove-header): Return the number of
+       headers removed.
+
+       * gnus.el (gnus-headers-de-quoted-unreadable): New function.
+       (gnus-headers-decode-quoted-readable): New function.
+       (gnus-article-de-quoted-unreadable): Use it.
+
+Fri Nov 10 00:00:47 1995  Steven L. Baur <steve@miranova.com>
+
+       * gnus-vis.el (gnus-header-button-alist): Recognize X-Url
+       headers. 
+
+Fri Nov 10 00:00:47 1995  Lars Ingebrigtsen  <lars@eyesore.no>
+
+       * gnus-msg.el (gnus-delete-supersedes-headers): Also remove Xref
+       and Lines.
+       (gnus-summary-supersede-article): Delete multi-line headers.
+       (gnus-news-followup): Insert a few empty lines in new articles.
+       (gnus-mail-reply): Put point the right place when replying.
+       (gnus-inews-organization): Don't interpret signatures that begin
+       with ~ as strings.
+       (gnus-news-followup): Respect the Newsgroup header.
+
+       * nnsoup.el (nnsoup-write-buffers): New function.
+       (nnsoup-request-close): Use it.
+       (nnsoup-pack-replies): Ditto.
+
+       * gnus-soup.el (gnus-soup-parse-replies): Didn't kill buffer.
+       (gnus-soup-write-prefixes): Would change current buffer.
+
+Thu Nov  9 20:54:35 1995  Lars Ingebrigtsen  <lars@eyesore.no>
+
+       * gnus.el (gnus-mouse-face-function): More efficient implementation.
+       (gnus-max-width-function): Ditto.
+
+       * gnus-msg.el (gnus-inews-news): Get the error message from the
+       right backend.
+
+       * gnus.el (gnus-summary-limit-to-score): Don't infloop.
+       (gnus-request-post-buffer): Removed function.
+       (gnus-method-option-p): New function.
+       (gnus-post-method): New function.
+       (gnus-request-post): Use it.
+
+       * nnsoup.el (nnsoup-write-active-file): Would possibly kill the
+       active file.
+
+Mon Nov  6 13:16:33 1995  Lars Ingebrigtsen  <lars@eyesore.no>
+
+       * gnus-msg.el (gnus-new-news): Removed prompting for group name.
+       (gnus-group-post-news): Prompt for group name.
+       (gnus-inews-do-fcc): Rewrite.
+
+       * gnus.el (gnus-group-get-parameter): New function.
+
+Sat Nov  4 19:24:57 1995  sudish joseph  <joseph@cis.ohio-state.edu>
+
+       * gnus-msg.el (gnus-group-post-news): Use the group under point as
+         the default when composing the post buffer.  (This means that
+         `a' over a mail group will get you a *mail* buffer.)  Using a
+         prefix ARG will force a fresh post buffer (i.e., no default
+         group is used).
+
+Mon Nov  6 12:54:40 1995  steve@miranova.com (Steven L. Baur)
+
+       * gnus-topic.el (gnus-topic-toggle-topic): New command and
+       keystroke. 
+
+Sat Nov  4 19:07:31 1995  Per Abrahamsen  <abraham@dina.kvl.dk>
+
+       * gnus-vis.el (gnus-group-make-menu-bar): Add key description for
+       the "See old articles" entry and made it run
+       gnus-group-select-group with an argument. 
+       * gnus.el (gnus-group-select-group-all): Deleted.
+
+Mon Nov  6 12:22:20 1995  Lars Ingebrigtsen  <lars@eyesore.no>
+
+       * gnus.el (gnus-save-newsrc-file): Set local `version-control' to
+       `never'. 
+       (gnus-gnus-to-newsrc-format): Ditto.
+
+       * gnus-msg.el (gnus-new-news): Move point to the right place.
+       (gnus-sendmail-mail-setup): Ditto.
+
+Sun Nov  5 10:05:47 1995  Lars Ingebrigtsen  <lars@eyesore.no>
+
+       * gnus-msg.el (gnus-configure-posting-styles): Make sure that
+       `gnus-newsgroup-name' is set.
+
+       * gnus-topic.el (gnus-group-add-to-topic): Remove process marks. 
+
+       * nnml.el (nnml-request-move-article): The article has to be
+       deletable to be moved.
+       * nnmh.el (nnmh-request-move-article): Ditto.
+
+       * nnmh.el (nnmh-deletable-article-p): New function.
+
+       * nnml.el (nnml-deletable-article-p): New function.
+
+       * gnus.el (gnus-data-compute-positions): Doc fix.
+       (gnus-summary-sort): Make sure positions were updated.
+       (gnus-request-article-this-buffer): Set original article buffer to
+       be read-only.
+
+Fri Nov  3 03:01:09 1995  Lars Magne Ingebrigtsen  <larsi@narfi.ifi.uio.no>
+
+       * gnus.el (gnus-request-article-this-buffer): Make sure all
+       overlays are dead.
+
+Fri Nov  3 00:41:22 1995  Lars Ingebrigtsen  <lars@eyesore.no>
+
+       * gnus-xmas.el: Removed mouse tracker.
+
+       * gnus.el (gnus-mouse-face-function): Redefined so that it also
+       works under XEmacs.
+
+Thu Nov  2 03:40:22 1995  Lars Ingebrigtsen  <lars@eyesore.no>
+
+       * gnus.el (gnus-batch-score): Don't generate threads and stuff.
+       (gnus-sort-threads): Better message.
+
+Tue Oct 31 21:26:35 1995  Lars Ingebrigtsen  <lars@eyesore.no>
+
+       * gnus-topic.el (gnus-topic-remove-topic): Would eat groups under
+       emtpy topics.
+
+       * gnus.el (gnus-simplify-buffer-fuzzy): Would strip trailing
+       newlines. 
+       (gnus-group-list-groups): Update format specs.
+       (gnus-summary-limit-children): Didn't mark as read.
+
+Mon Oct 30 00:09:42 1995  Lars Ingebrigtsen  <lars@eyesore.no>
+
+       * gnus.el (gnus-summary-find-matching): Wouldn't do `backward' ok.
+       (gnus-summary-limit-to-subject): Don't just limit to articles
+       after point.
+       (gnus-articles-to-read): Respond properly to numerical prefixes.
+
+       * gnus-msg.el (gnus-inews-article): Do the To/X-To shuffle dance.
+
+       * gnus.el (gnus-summary-expire-articles): Be less complaining when
+       doing total-expiry.
+
+       * gnus-msg.el (gnus-mail-send): Remove empty headers before
+       sending. 
+       (gnus-inews-remove-empty-headers): New function.
+
+       * gnus.el (gnus-summary-find-next): Respect
+       `gnus-summary-check-current'. 
+       (gnus-summary-find-prev): Ditto.
+       (gnus-summary-mode-map): Limit map had disappeared.
+       (gnus-summary-limit-children): Wouldn't limit properly with
+       gnus-fetch-old-headers 'some.
+
+Sun Oct 29 23:37:17 1995  Lars Ingebrigtsen  <lars@eyesore.no>
+
+       * nnmh.el: Use nnmail's new definition.
+       * nnml.el: Ditto.
+
+       * nnmail.el (nnmail-group-pathname): Use nnmh's definition.
+
+       * gnus.el (gnus-group-startup-message): Change.
+
+Sun Oct 29 19:57:57 1995  Lars Magne Ingebrigtsen  <larsi@menja.ifi.uio.no>
+
+       * gnus.el: 0.12 is released.
+
 Tue Oct 24 22:11:44 1995  Peter Arius  <arius@informatik.uni-erlangen.de>
 
        * gnus.el (gnus-summary-skip-intangible): Quotes missing in macro 
@@ -61,6 +350,8 @@ Mon Oct 16 11:57:14 1995  Lars Ingebrigtsen  <lars@eyesore.no>
 
        * gnus-mh.el (gnus-mh-mail-setup): Bugged out.
 
+       * gnus.el: 0.11 is released.
+
 Wed Oct  4 23:08:30 1995  Sudish Joseph <joseph@cis.ohio-state.edu>
  
        * gnus.el (gnus-server-yank-server): Couldn't add new servers coz
index 3697d4b..d23a781 100644 (file)
@@ -227,6 +227,14 @@ variable to \"^nnml\".")
     (if (not (file-exists-p file))
        ()
       (erase-buffer)
+      ;; There may be some overlays that we have to kill...
+      (insert "i")
+      (let ((overlays (and (fboundp 'overlays-at)
+                          (overlays-at (point-min)))))
+       (while overlays
+         (delete-overlay (car overlays))
+         (setq overlays (cdr overlays))))
+      (erase-buffer)     
       (insert-file-contents file)
       t)))
 
index 85c23e0..975ddf7 100644 (file)
@@ -34,6 +34,9 @@
   (autoload 'gnus-xmas-define "gnus-xmas")
   (autoload 'gnus-xmas-redefine "gnus-xmas"))
 
+(or (fboundp 'mail-file-babyl-p)
+    (fset 'mail-file-babyl-p 'rmail-file-p))
+
 ;;; Mule functions.
 
 (defun gnus-mule-truncate-string (str width)
index 7d1c7a7..59f9ce5 100644 (file)
@@ -387,6 +387,8 @@ Returns the number of articles marked as read."
              (message "Processing kill file %s...done" (car kill-files)))
            (setq kill-files (cdr kill-files)))))
 
+      (gnus-set-mode-line 'summary)
+
       (if beg
          (let ((nunreads (- unreads (length gnus-newsgroup-unreads))))
            (or (eq nunreads 0)
index ad7fa40..6cb7671 100644 (file)
@@ -64,7 +64,7 @@ Optional argument FOLDER specifies folder name."
                   t))))
        (errbuf (get-buffer-create " *Gnus rcvstore*")))
     (gnus-eval-in-buffer-window 
-     gnus-article-buffer
+     gnus-original-article-buffer
      (save-restriction
        (widen)
        (unwind-protect
@@ -82,7 +82,7 @@ Optional argument FOLDER specifies folder name."
   (let ((config (current-window-configuration))) 
     (setq mh-show-buffer gnus-article-copy)
     (mh-find-path)
-    (mh-send-sub (or to "") (or cc "") (or subject "(None)") config)
+    (mh-send-sub (or to "") (or cc "") (or subject "") config)
     (goto-char (point-min))
     (and in-reply-to (insert "In-Reply-To: " in-reply-to "\n"))
     (setq mh-sent-from-folder gnus-article-copy)
index 841bc7e..8d08c9c 100644 (file)
@@ -206,7 +206,7 @@ If this variable is t, Gnus will check everything it can.  If it is a
 list, then those elements in that list will be checked.")
 
 (defvar gnus-delete-supersedes-headers
-  "^Path:\\|^Date\\|^NNTP-Posting-Host:\\|^Supersedes:"
+  "^Path:\\|^Date\\|^NNTP-Posting-Host:\\|^Supersedes:\\|^Xref:\\|^Lines:"
   "*Header lines matching this regexp will be deleted before posting.
 It's best to delete old Path and Date headers before posting to avoid
 any confusion.")
@@ -215,10 +215,7 @@ any confusion.")
   "*If non-nil, mail the authors of articles a copy of your follow-ups.
 If this variable is `ask', the user will be prompted for whether to
 mail a copy.  The string given by `gnus-mail-courtesy-message' will be
-inserted at the beginning of the mail copy.
-
-Mail is sent using the function specified by the
-`gnus-mail-send-method' variable.")
+inserted at the beginning of the mail copy.")
 
 ;; Added by Ethan Bradford <ethanb@ptolemy.astro.washington.edu>.
 (defvar gnus-mail-courtesy-message
@@ -242,11 +239,6 @@ Three pre-made functions are `gnus-mail-other-window-using-mail'
 (sendmail); `gnus-mail-other-window-using-mhe' (MH-E); and
 `gnus-mail-other-window-using-vm'.")
 
-(defvar gnus-mail-send-method send-mail-function
-  "*Function to mail a message which is also being posted as an article.
-The message must have To or Cc header.  The default is copied from
-the variable `send-mail-function'.")
-
 (defvar gnus-inews-article-function 'gnus-inews-article
   "*Function to post an article.")
 
@@ -324,13 +316,31 @@ headers.")
 (defun gnus-group-mail ()
   "Start composing a mail."
   (interactive)
-  (gnus-new-mail))
-
-(defun gnus-group-post-news ()
-  "Post an article."
-  (interactive)
-  (let ((gnus-newsgroup-name nil))
-    (gnus-post-news 'post nil nil gnus-article-buffer)))
+  (gnus-new-mail
+   ;; We might want to prompt here.
+   (when (and gnus-interactive-post
+             (not gnus-expert-user))
+     (read-string "To: "))))
+
+(defun gnus-group-post-news (&optional arg)
+  "Post an article.
+The newsgroup under the cursor is used as the group to post to.
+
+If you wish to get an empty post buffer, use a prefix ARG.  You can
+also do this by calling this function from the bottom of the Group
+buffer."
+  (interactive "P")
+  (let ((gnus-newsgroup-name nil)
+       (group (unless arg (gnus-group-group-name)))
+       subject)
+    ;; We might want to prompt here.
+    (when (and gnus-interactive-post
+              (not gnus-expert-user))
+      (setq gnus-newsgroup-name
+           (setq group 
+                 (completing-read "Group: " gnus-active-hashtb nil nil
+                                  (cons group 0)))))
+    (gnus-post-news 'post group nil gnus-article-buffer)))
 
 (defun gnus-summary-post-news ()
   "Post an article."
@@ -400,38 +410,28 @@ header line with the old Message-ID."
   (interactive)
   (gnus-set-global-variables)
   (gnus-summary-select-article t)
-  (if (not
-       (string-equal
-       (downcase (mail-strip-quoted-names 
-                  (mail-header-from gnus-current-headers)))
-       (downcase (mail-strip-quoted-names (gnus-inews-user-name)))))
-      (error "This article is not yours."))
-  (save-excursion
-    (set-buffer gnus-article-buffer)
-    (let ((buffer-read-only nil))
-      (goto-char (point-min))
-      (search-forward "\n\n" nil t)
-      (if (not (re-search-backward "^Message-ID: " nil t))
-         (error "No Message-ID in this article"))))
-  (if (gnus-post-news 'post gnus-newsgroup-name)
-      (progn
-       (erase-buffer)
-       (insert-buffer-substring gnus-article-buffer)
-       (if (search-forward "\n\n" nil t)
-           (forward-char -1)
-         (goto-char (point-max)))
-       (narrow-to-region (point-min) (point))
-       (goto-char (point-min))
-       (and gnus-delete-supersedes-headers
-            (delete-matching-lines gnus-delete-supersedes-headers))
-       (goto-char (point-min))
-       (if (not (re-search-forward "^Message-ID: " nil t))
-           (error "No Message-ID in this article")
-         (replace-match "Supersedes: " t t))
-       (goto-char (point-max))
-       (insert mail-header-separator)
-       (widen)
-       (forward-line 1))))
+  ;; Check whether the user owns the article that is to be superseded. 
+  (unless (string-equal
+          (downcase (mail-strip-quoted-names 
+                     (mail-header-from gnus-current-headers)))
+          (downcase (mail-strip-quoted-names (gnus-inews-user-name))))
+    (error "This article is not yours."))
+  ;; Get a normal *post-news* buffer.
+  (gnus-new-news gnus-newsgroup-name t)
+  (erase-buffer)
+  (insert-buffer-substring gnus-original-article-buffer)
+  (gnus-narrow-to-headers)
+  ;; Remove unwanted headers.
+  (when gnus-delete-supersedes-headers
+    (nnheader-remove-header gnus-delete-supersedes-headers t))
+  (goto-char (point-min))
+  (if (not (re-search-forward "^Message-ID: " nil t))
+      (error "No Message-ID in this article")
+    (replace-match "Supersedes: " t t))
+  (goto-char (point-max))
+  (insert mail-header-separator)
+  (widen)
+  (forward-line 1))
 
 \f
 ;;;###autoload
@@ -465,21 +465,24 @@ Type \\[describe-mode] in the buffer to get a list of commands."
   (interactive (list t))
   (let* ((group (or group gnus-newsgroup-name))
         (to-address 
-         (and group
-              (cdr (assq 
-                    'to-address 
-                    (nth 5 (nth 2 (gnus-gethash 
-                                   group gnus-newsrc-hashtb)))))))
+         (when group
+           (gnus-group-get-parameter group 'to-address)))
+        (to-group
+         (when group
+           (gnus-group-get-parameter group 'to-group)))
         (mailing-list
          (and group gnus-mailing-list-groups
               (string-match gnus-mailing-list-groups group))))
-    (if (and (gnus-member-of-valid 'post (or group gnus-newsgroup-name))
-            (not mailing-list)
-            (not to-address))
+    (when group
+      (setq group (gnus-group-real-name group)))
+    (if (or to-group
+           (and (gnus-member-of-valid 'post (or group gnus-newsgroup-name))
+                (not mailing-list)
+                (not to-address)))
        ;; This is news.
        (if post
-           (gnus-new-news group)
-         (gnus-news-followup yank group))
+           (gnus-new-news (or to-group group))
+         (gnus-news-followup yank (or to-group group)))
       ;; The is mail.
       (if post
          (progn
@@ -500,7 +503,6 @@ will attempt to use the foreign server to post the article."
   (or gnus-current-select-method
       (setq gnus-current-select-method gnus-select-method))
   (let* ((case-fold-search nil)
-        (server-running (gnus-server-opened gnus-current-select-method))
         (reply gnus-article-reply)
         error post-result)
     (save-excursion
@@ -528,15 +530,16 @@ will attempt to use the foreign server to post the article."
             ;; We cannot signal an error.
             (setq error t)
             (ding)
-            (gnus-message 1 "Article rejected: %s" 
-                          (gnus-status-message gnus-select-method)))))
+            (gnus-message 
+             1 "Article rejected: %s" 
+             (gnus-status-message
+              (gnus-post-method gnus-newsgroup-name use-group-method))))))
 
     (let ((conf gnus-prev-winconf))
-      (if (not error)
-         (progn
-           (bury-buffer)
-           ;; Restore last window configuration.
-           (and conf (set-window-configuration conf)))))))
+      (unless error
+       (bury-buffer)
+       ;; Restore last window configuration.
+       (and conf (set-window-configuration conf))))))
 
 (defun gnus-inews-narrow-to-headers ()
   (widen)
@@ -609,8 +612,38 @@ will attempt to use the foreign server to post the article."
 (defun gnus-inews-remove-headers-after-mail ()
   (save-excursion
     (save-restriction
-      (gnus-inews-narrow-to-headers)
-      (nnheader-remove-header "bcc"))))
+      (let ((case-fold-search t))
+       (gnus-inews-narrow-to-headers)
+       ;; Remove Bcc completely.
+       (nnheader-remove-header "bcc")
+       ;; We transform To and Cc headers to avoid re-mailing if the user
+       ;; accidentally (or purposefully) leans on the `C-c C-c' keys
+       ;; and the news server rejects the posting.
+       (while (re-search-forward "^\\(to\\|[bcf]cc\\|cc\\):" nil t)
+         (beginning-of-line)
+         (insert "X-"))
+       (widen)))))
+
+(defun gnus-inews-dex-headers ()
+  "Remove \"X-\" prefixes from To and Cc headers."
+  (save-excursion
+    (save-restriction
+      (let ((case-fold-search t))
+       (gnus-narrow-to-headers)
+       (while (re-search-forward "^X-\\(to\\|[bcf]cc\\|cc\\):" nil t)
+         (beginning-of-line)
+         (delete-char 2))
+       (widen)))))
+
+(defun gnus-inews-remove-empty-headers ()
+  "Remove empty headers from news and mail.
+The buffer should be narrowed to the headers before this function is
+called."
+  (save-excursion
+    (goto-char (point-min))
+    (while (re-search-forward "^[^ \t:]+:\\([ \t]*\n\\)+[^ \t]" nil t)
+      (delete-region (match-beginning 0) (1- (match-end 0)))
+      (beginning-of-line))))
 
 (defun gnus-inews-check-post ()
   "Check whether the post looks ok."
@@ -756,7 +789,7 @@ will attempt to use the foreign server to post the article."
          (goto-char (point-max))
          (if (not (re-search-backward gnus-signature-separator nil t))
              t
-           (if (> (count-lines (point) (point-max)) 4)
+           (if (> (count-lines (point) (point-max)) 5)
                (gnus-y-or-n-p
                 (format
                  "Your .sig is %d lines; it should be max 4.  Really post? "
@@ -911,22 +944,15 @@ will attempt to use the foreign server to post the article."
        ;; The article must be saved before being posted because
        ;; `gnus-request-post' modifies the buffer.
        (run-hooks 'gnus-inews-article-hook)
+       ;; Remove X- prefixes to headers.
+       (gnus-inews-dex-headers)
        ;; Copy the article over to some group, possibly.
        (and gcc (gnus-inews-do-gcc gcc))
        ;; Post the article.
-       (setq result
-             (gnus-request-post 
-              (if use-group-method
-                  (gnus-find-method-for-group gnus-newsgroup-name)
-                gnus-select-method) use-group-method))
+       (let ((method (gnus-post-method gnus-newsgroup-name use-group-method)))
+         (setq result (gnus-request-post method)))
        (kill-buffer (current-buffer)))
       (run-hooks 'gnus-message-sent-hook)
-      ;; We remove To and Cc headers to avoid re-mailing if the user
-      ;; accidentally (or purposefully) leans on the `C-c C-c' keys
-      ;; and the news server rejects the posting.
-      (gnus-inews-narrow-to-headers)
-      (nnheader-remove-header "^\\(to\\|[bcf]cc\\|cc\\):" t)
-      (widen)
       ;; If the posting was unsuccessful (that it, it was rejected) we
       ;; put it into the draft group.
       (or result (gnus-put-in-draft-group))
@@ -1057,62 +1083,64 @@ Headers in `gnus-required-headers' will be generated."
     ;; Distribution. 
     (while headers
       (goto-char (point-min))
-      (setq elem (car headers))
+      (setq elem (pop headers))
       (if (consp elem)
          (setq header (car elem))
        (setq header elem))
-      (if (or (not (re-search-forward 
-                   (concat "^" (downcase (symbol-name header)) ":") nil t))
-             (progn
-               ;; The header was found. We insert a space after the
-               ;; colon, if there is none.
-               (if (/= (following-char) ? ) (insert " "))
-               ;; Find out whether the header is empty...
-               (looking-at "[ \t]*$")))
-         ;; So we find out what value we should insert.
-         (progn
-           (setq value
-                 (cond 
-                  ((and (consp elem) (eq (car elem) 'optional))
-                   ;; This is an optional header.  If the cdr of this
-                   ;; is something that is nil, then we do not insert
-                   ;; this header.
-                   (setq header (cdr elem))
-                   (or (and (fboundp (cdr elem)) (funcall (cdr elem)))
-                       (and (boundp (cdr elem)) (symbol-value (cdr elem)))))
-                  ((consp elem)
-                   ;; The element is a cons.  Either the cdr is a
-                   ;; string to be inserted verbatim, or it is a
-                   ;; function, and we insert the value returned from
-                   ;; this function.
-                   (or (and (stringp (cdr elem)) (cdr elem))
-                       (and (fboundp (cdr elem)) (funcall (cdr elem)))))
-                  ((and (boundp header) (symbol-value header))
-                   ;; The element is a symbol.  We insert the value
-                   ;; of this symbol, if any.
-                   (symbol-value header))
-                  (t
-                   ;; We couldn't generate a value for this header,
-                   ;; so we just ask the user.
-                   (read-from-minibuffer
-                    (format "Empty header for %s; enter value: " header)))))
-           ;; Finally insert the header.
-           (if (not value)
-               ()
-             (save-excursion
-               (if (bolp)
-                   (progn
-                     (goto-char (point-max))
-                     (insert (symbol-name header) ": " value "\n")
-                     (forward-line -1))
-                 (replace-match value t t))
-               ;; Add the deletable property to the headers that require it.
-               (and (memq header gnus-deletable-headers)
-                    (progn (beginning-of-line) (looking-at "[^:]+: "))
-                    (add-text-properties 
-                     (point) (match-end 0)
-                     '(gnus-deletable t face italic) (current-buffer)))))))
-      (setq headers (cdr headers)))
+      (when (or (not (re-search-forward 
+                     (concat "^" (downcase (symbol-name header)) ":") nil t))
+               (progn
+                 ;; The header was found. We insert a space after the
+                 ;; colon, if there is none.
+                 (if (/= (following-char) ? ) (insert " "))
+                 ;; Find out whether the header is empty...
+                 (looking-at "[ \t]*$")))
+       ;; So we find out what value we should insert.
+       (setq value
+             (cond 
+              ((and (consp elem) (eq (car elem) 'optional))
+               ;; This is an optional header.  If the cdr of this
+               ;; is something that is nil, then we do not insert
+               ;; this header.
+               (setq header (cdr elem))
+               (or (and (fboundp (cdr elem)) (funcall (cdr elem)))
+                   (and (boundp (cdr elem)) (symbol-value (cdr elem)))))
+              ((consp elem)
+               ;; The element is a cons.  Either the cdr is a
+               ;; string to be inserted verbatim, or it is a
+               ;; function, and we insert the value returned from
+               ;; this function.
+               (or (and (stringp (cdr elem)) (cdr elem))
+                   (and (fboundp (cdr elem)) (funcall (cdr elem)))))
+              ((and (boundp header) (symbol-value header))
+               ;; The element is a symbol.  We insert the value
+               ;; of this symbol, if any.
+               (symbol-value header))
+              (t
+               ;; We couldn't generate a value for this header,
+               ;; so we just ask the user.
+               (read-from-minibuffer
+                (format "Empty header for %s; enter value: " header)))))
+       ;; Finally insert the header.
+       (when (and value 
+                  (not (equal value "")))
+         (save-excursion
+           (if (bolp)
+               (progn
+                 ;; This header didn't exist, so we insert it.
+                 (goto-char (point-max))
+                 (insert (symbol-name header) ": " value "\n")
+                 (forward-line -1))
+             ;; The value of this header was empty, so we clear
+             ;; totally and insert the new value.
+             (delete-region (point) (gnus-point-at-bol))
+             (insert value))
+           ;; Add the deletable property to the headers that require it.
+           (and (memq header gnus-deletable-headers)
+                (progn (beginning-of-line) (looking-at "[^:]+: "))
+                (add-text-properties 
+                 (point) (match-end 0)
+                 '(gnus-deletable t face italic) (current-buffer)))))))
     ;; Insert new Sender if the From is strange. 
     (let ((from (mail-fetch-field "from"))
          (sender (mail-fetch-field "sender")))
@@ -1197,56 +1225,39 @@ nil."
                     (insert "7bit")))))))
 
 (defun gnus-inews-do-fcc ()
-  "Process FCC: fields in current article buffer.
+  "Process Fcc headers in the current buffer.
 Unless the first character of the field is `|', the article is saved
 to the specified file using the function specified by the variable
 gnus-author-copy-saver.  The default function rmail-output saves in
 Unix mailbox format.
-If the first character is `|', the contents of the article is send to
+
+If the first character is `|', the contents of the article is sent to
 a program specified by the rest of the value."
-  (let ((fcc-list nil)
-       (fcc-file nil)
-       (case-fold-search t))           ;Should ignore case.
+  (let ((case-fold-search t)           ;Should ignore case.
+       list file)
     (save-excursion
       (save-restriction
-       (goto-char (point-min))
-       (search-forward "\n\n")
-       (narrow-to-region (point-min) (point))
-       (goto-char (point-min))
-       (while (re-search-forward "^FCC:[ \t]*" nil t)
-         (setq fcc-list
-               (cons (buffer-substring
-                      (point)
-                      (progn
-                        (end-of-line)
-                        (skip-chars-backward " \t")
-                        (point)))
-                     fcc-list))
-         (delete-region (match-beginning 0)
-                        (progn (forward-line 1) (point))))
+       (gnus-narrow-to-headers)
+       (while (setq file (mail-fetch-field "fcc"))
+         (push file list)
+         (nnheader-remove-header "fcc" nil t))
        ;; Process FCC operations.
        (widen)
-       (while fcc-list
-         (setq fcc-file (car fcc-list))
-         (setq fcc-list (cdr fcc-list))
-         (cond ((string-match "^[ \t]*|[ \t]*\\(.*\\)[ \t]*$" fcc-file)
-                (let ((program (substring fcc-file
-                                          (match-beginning 1) (match-end 1))))
-                  ;; Suggested by yuki@flab.fujitsu.junet.
-                  ;; Send article to named program.
-                  (call-process-region (point-min) (point-max) shell-file-name
-                                       nil nil nil "-c" program)))
-               (t
-                (setq fcc-file (expand-file-name fcc-file))
-                ;; Suggested by hyoko@flab.fujitsu.junet.
-                ;; Save article in Unix mail format by default.
-                (gnus-make-directory (file-name-directory fcc-file))
-                (if (and gnus-author-copy-saver
-                         (not (eq gnus-author-copy-saver 'rmail-output)))
-                    (funcall gnus-author-copy-saver fcc-file)
-                  (if (and (file-readable-p fcc-file) (rmail-file-p fcc-file))
-                      (gnus-output-to-rmail fcc-file)
-                    (rmail-output fcc-file 1 t t))))))))))
+       (while list
+         (setq file (pop list))
+         (if (string-match "^[ \t]*|[ \t]*\\(.*\\)[ \t]*$" file)
+             ;; Pipe the article to the program in question.
+             (call-process-region (point-min) (point-max) shell-file-name
+                                  nil nil nil "-c" (match-string 1 file))
+           ;; Save the article.
+           (setq file (expand-file-name file))
+           (gnus-make-directory (file-name-directory file))
+           (if (and gnus-author-copy-saver
+                    (not (eq gnus-author-copy-saver 'rmail-output)))
+               (funcall gnus-author-copy-saver file)
+             (if (and (file-readable-p file) (mail-file-babyl-p file))
+                 (gnus-output-to-rmail file)
+               (rmail-output file 1 t t)))))))))
 
 (defun gnus-inews-path ()
   "Return uucp path."
@@ -1396,7 +1407,7 @@ organization."
         (> (length organization) 0)
         (or (file-exists-p organization)
             (string-match " " organization)
-            (not (string-match "^/usr/lib/" organization)))
+            (not (string-match "^/usr/lib/\\|^~/" organization)))
         (save-excursion
           (gnus-set-work-buffer)
           (if (file-exists-p organization)
@@ -1490,10 +1501,14 @@ mailer."
   (gnus-new-mail))
 
 (defun gnus-new-mail (&optional to)
-  (pop-to-buffer gnus-mail-buffer)
-  (erase-buffer)
-  (gnus-mail-setup 'new to)
-  (run-hooks 'gnus-mail-hook))
+  (let (subject)
+    (when (and gnus-interactive-post
+              (not gnus-expert-user))
+      (setq subject (read-string "Subject: ")))
+    (pop-to-buffer gnus-mail-buffer)
+    (erase-buffer)
+    (gnus-mail-setup 'new to subject)
+    (run-hooks 'gnus-mail-hook)))
 
 (defun gnus-mail-reply (&optional yank to-address followup)
   (save-excursion
@@ -1628,31 +1643,43 @@ mailer."
                (goto-char end)
                (setq yank (cdr yank))))
            (goto-char last))
+         (forward-line 2)
          (gnus-configure-windows 'reply-yank 'force))
        (run-hooks 'gnus-mail-hook)))))
 
-(defun gnus-new-news (&optional group)
+(defun gnus-new-news (&optional group inhibit-prompt)
+  "Set up a *post-news* buffer that points to GROUP.
+If INHIBIT-PROMPT, never prompt for a Subject."
   (let ((winconf (current-window-configuration))
        subject)
-    (and gnus-interactive-post
-        (not gnus-expert-user)
-        (not group)
-        (progn
-          (setq gnus-newsgroup-name
-                (setq group 
-                      (completing-read "Group: " gnus-active-hashtb)))
-          (setq subject (read-string "Subject: "))))
+    (when (and gnus-interactive-post
+              (not inhibit-prompt)
+              (not gnus-expert-user))
+      (setq subject (read-string "Subject: ")))
     (pop-to-buffer gnus-post-news-buffer)  
     (erase-buffer)
     (news-reply-mode)
     ;; Let posting styles be configured.
     (gnus-configure-posting-styles)
     (news-setup nil subject nil (and group (gnus-group-real-name group)) nil)
+    (goto-char (point-min))
+
+    (unless (re-search-forward 
+            (concat "^" (regexp-quote mail-header-separator) "$") nil t)
+      (goto-char (point-max)))
+    (insert "\n\n")
+
+    (gnus-inews-insert-bfcc)
     (gnus-inews-insert-signature)
     (and gnus-post-prepare-function
         (symbolp gnus-post-prepare-function)
         (fboundp gnus-post-prepare-function)
         (funcall gnus-post-prepare-function group))
+    (goto-char (point-min))
+    (if (re-search-forward 
+        (concat "^" (regexp-quote mail-header-separator) "$") nil t)
+       (forward-line 1)
+      (goto-char (point-max)))
     (run-hooks 'gnus-post-prepare-hook)
     (make-local-variable 'gnus-prev-winconf)
     (setq gnus-prev-winconf winconf)
@@ -1672,7 +1699,7 @@ mailer."
            (winconf (current-window-configuration))
            from subject date reply-to message-of
            references message-id sender follow-to sendto elt 
-           followup-to distribution)
+           followup-to distribution newsgroups)
        (set-buffer (get-buffer-create gnus-post-news-buffer))
        (news-reply-mode)
        (if (and (buffer-modified-p)
@@ -1704,6 +1731,7 @@ mailer."
              (setq references (mail-fetch-field "references"))
              (setq message-id (mail-fetch-field "message-id"))
              (setq followup-to (mail-fetch-field "followup-to"))
+             (setq newsgroups (mail-fetch-field "newsgroups"))
              (setq distribution (mail-fetch-field "distribution"))
              ;; Remove bogus distribution.
              (and (stringp distribution)
@@ -1726,14 +1754,15 @@ mailer."
          (gnus-configure-posting-styles)
 
          (news-setup nil subject nil 
-                     (or group sendto 
-                         (and follow-to
+                     (or sendto 
+                         (and followup-to
                               gnus-use-followup-to
                               (or (not (eq gnus-use-followup-to 'ask))
                                   (gnus-y-or-n-p 
                                    (format
-                                    "Use Followup-To %s? " follow-to))))
-                         group "")
+                                    "Use Followup-To %s? " followup-to)))
+                              followup-to)
+                         newsgroups group "")
                      gnus-article-copy)
 
          (make-local-variable 'gnus-article-reply)
@@ -1804,27 +1833,18 @@ mailer."
                  (mail-position-on-field "To")
                  (insert to))))
 
-         ;; Handle author copy using BCC field.
-         (if (and gnus-mail-self-blind
-                  (not (mail-fetch-field "bcc")))
-             (progn
-               (mail-position-on-field "Bcc")
-               (insert (if (stringp gnus-mail-self-blind)
-                           gnus-mail-self-blind
-                         (user-login-name)))))
-         ;; Handle author copy using FCC field.
-         (if gnus-author-copy
-             (progn
-               (mail-position-on-field "Fcc")
-               (insert gnus-author-copy)))
-       
+         (gnus-inews-insert-bfcc)
+
          ;; Now the headers should be ok, so we do the yanking.
          (goto-char (point-min))
          (re-search-forward
           (concat "^" (regexp-quote mail-header-separator) "$"))
          (forward-line 1)
          (if (not yank)
-             (gnus-configure-windows 'followup 'force)
+             (progn
+               (gnus-configure-windows 'followup 'force)
+               (insert "\n\n")
+               (forward-line -2))
            (let ((last (point))
                  end)
              (if (not (listp yank))
@@ -2169,7 +2189,8 @@ Headers will be generated before sending."
     (save-restriction
       (widen)
       (gnus-inews-narrow-to-headers)
-      (gnus-inews-insert-headers gnus-required-mail-headers)))
+      (gnus-inews-insert-headers gnus-required-mail-headers)
+      (gnus-inews-remove-empty-headers)))
   (widen)
   ;; Remove the header separator.
   (goto-char (point-min))
@@ -2225,6 +2246,12 @@ Headers will be generated before sending."
 (defun gnus-sendmail-mail-setup (to subject in-reply-to cc replybuffer actions)
   (mail-mode)
   (mail-setup to subject nil cc replybuffer actions)
+  (goto-char (point-min))
+  (if (re-search-forward 
+       (concat "^" (regexp-quote mail-header-separator) "$") nil t)
+      (forward-line 1)
+    (goto-char (point-max)))
+;  (insert "\n\n")
   (gnus-inews-modify-mail-mode-map))
   
 ;;; Gcc handling.
@@ -2249,6 +2276,25 @@ Headers will be generated before sending."
              (error nil))
            (setq gcc (substring gcc end))))))))
 
+(defun gnus-inews-insert-bfcc ()
+  "Insert Bcc and Fcc headers."
+  (save-excursion
+    (save-restriction
+      (gnus-inews-narrow-to-headers)
+      ;; Handle author copy using BCC field.
+      (if (and gnus-mail-self-blind
+              (not (mail-fetch-field "bcc")))
+         (progn
+           (mail-position-on-field "Bcc")
+           (insert (if (stringp gnus-mail-self-blind)
+                       gnus-mail-self-blind
+                     (user-login-name)))))
+      ;; Handle author copy using FCC field.
+      (if gnus-author-copy
+         (progn
+           (mail-position-on-field "Fcc")
+           (insert gnus-author-copy))))))
+
 (defun gnus-inews-insert-gcc ()
   (let* ((group gnus-outgoing-message-group)
         (gcc (cond 
@@ -2256,8 +2302,7 @@ Headers will be generated before sending."
                (funcall group))
               ((or (stringp group) (list group))
                group))))
-    (if (not gcc)
-       () ; Insert no Gcc.
+    (when gcc
       (insert "Gcc: "
              (if (stringp group) group
                (mapconcat 'identity group " "))
@@ -2380,6 +2425,7 @@ Headers will be generated before sending."
 (defun gnus-configure-posting-styles ()
   "Configure posting styles according to `gnus-posting-styles'."
   (let ((styles gnus-posting-styles)
+       (gnus-newsgroup-name (or gnus-newsgroup-name ""))
        style match variable attribute value value-value)
     ;; Go through all styles and look for matches.
     (while styles
index 5501c72..7db1b52 100644 (file)
 ;;; Code:
 
 (require 'gnus)
+(eval-when-compile (require 'cl))
+
+(defvar gnus-global-score-files nil
+  "*List of global score files and directories.
+Set this variable if you want to use people's score files.  One entry
+for each score file or each score file directory.  Gnus will decide
+by itself what score files are applicable to which group.
+
+Say you want to use the single score file
+\"/ftp.ifi.uio.no@ftp:/pub/larsi/ding/score/soc.motss.SCORE\" and all
+score files in the \"/ftp.some-where:/pub/score\" directory.
+
+ (setq gnus-global-score-files
+       '(\"/ftp.ifi.uio.no:/pub/larsi/ding/score/soc.motss.SCORE\"
+         \"/ftp.some-where:/pub/score\"))")
+
+(defvar gnus-score-file-single-match-alist nil
+  "*Alist mapping regexps to lists of score files.
+Each element of this alist should be of the form
+       (\"REGEXP\" [ \"SCORE-FILE-1\" ] [ \"SCORE-FILE-2\" ] ... )
+
+If the name of a group is matched by REGEXP, the corresponding scorefiles
+will be used for that group.
+The first match found is used, subsequent matching entries are ignored (to
+use multiple matches, see gnus-score-file-multiple-match-alist).
+
+These score files are loaded in addition to any files returned by
+gnus-score-find-score-files-function (which see).")
+
+(defvar gnus-score-file-multiple-match-alist nil
+  "*Alist mapping regexps to lists of score files.
+Each element of this alist should be of the form
+       (\"REGEXP\" [ \"SCORE-FILE-1\" ] [ \"SCORE-FILE-2\" ] ... )
+
+If the name of a group is matched by REGEXP, the corresponding scorefiles
+will be used for that group.
+If multiple REGEXPs match a group, the score files corresponding to each
+match will be used (for only one match to be used, see
+gnus-score-file-single-match-alist).
+
+These score files are loaded in addition to any files returned by
+gnus-score-find-score-files-function (which see).")
+
+(defvar gnus-score-file-suffix "SCORE"
+  "*Suffix of the score files.")
+
+(defvar gnus-adaptive-file-suffix "ADAPT"
+  "*Suffix of the adaptive score files.")
+
+(defvar gnus-score-find-score-files-function 'gnus-score-find-bnews
+  "*Function used to find score files.
+The function will be called with the group name as the argument, and
+should return a list of score files to apply to that group.  The score
+files do not actually have to exist.
+
+Predefined values are:
+
+gnus-score-find-single: Only apply the group's own score file.
+gnus-score-find-hierarchical: Also apply score files from parent groups.
+gnus-score-find-bnews: Apply score files whose names matches.
+
+See the documentation to these functions for more information.
+
+This variable can also be a list of functions to be called.  Each
+function should either return a list of score files, or a list of
+score alists.")
+
+(defvar gnus-score-interactive-default-score 1000
+  "*Scoring commands will raise/lower the score with this number as the default.")
 
 (defvar gnus-score-expiry-days 7
   "*Number of days before unused score file entries are expired.")
@@ -61,6 +130,9 @@ If this variable is nil, exact matching will always be used.")
 
 ;; Internal variables.
 
+(defvar gnus-internal-global-score-files nil)
+(defvar gnus-score-file-list nil)
+
 (defvar gnus-score-help-winconf nil)
 (defvar gnus-adaptive-score-alist gnus-default-adaptive-score-alist)
 (defvar gnus-score-trace nil)
@@ -335,6 +407,16 @@ used as score."
          (error "No article on current line")
        nil))))
 
+(defsubst gnus-score-get (symbol &optional alist)
+  ;; Get SYMBOL's definition in ALIST.
+  (cdr (assoc symbol 
+             (or alist 
+                 gnus-score-alist
+                 (progn
+                   (gnus-score-load 
+                    (gnus-score-file-name gnus-newsgroup-name))
+                   gnus-score-alist)))))
+
 (defun gnus-summary-score-entry 
   (header match type score date &optional prompt silent)
   "Enter score file entry.
@@ -518,16 +600,6 @@ SCORE is the score to add."
           (setcdr alist
                   (cons (cons symbol value) (cdr alist)))))))
 
-(defun gnus-score-get (symbol &optional alist)
-  ;; Get SYMBOL's definition in ALIST.
-  (cdr (assoc symbol 
-             (or alist 
-                 gnus-score-alist
-                 (progn
-                   (gnus-score-load 
-                    (gnus-score-file-name gnus-newsgroup-name))
-                   gnus-score-alist)))))
-
 (defun gnus-score-change-score-file (file)
   "Change current score alist."
   (interactive 
@@ -614,8 +686,13 @@ SCORE is the score to add."
                                        (gnus-score-load-file file)) 
                                      files))))
       (and eval (not global) (eval eval))
+      ;; We then expand any exclude-file directives.
       (setq gnus-scores-exclude-files 
-           (append exclude-files gnus-scores-exclude-files))
+           (nconc 
+            (mapcar 
+             (lambda (sfile) 
+               (expand-file-name sfile (file-name-directory file)))
+             exclude-files) gnus-scores-exclude-files))
       (if (not local)
          ()
        (save-excursion
@@ -802,8 +879,7 @@ SCORE is the score to add."
        (setq scores (nconc (car score-files) scores)))
       (setq score-files (cdr score-files)))
     ;; Prune the score files that are to be excluded, if any.
-    (if (not gnus-scores-exclude-files)
-       ()
+    (when gnus-scores-exclude-files
       (let ((s scores)
            c)
        (while s
@@ -811,11 +887,11 @@ SCORE is the score to add."
               (member (car c) gnus-scores-exclude-files)
               (setq scores (delq (car s) scores)))
          (setq s (cdr s)))))
-    (if (not (and gnus-summary-default-score
-                 scores
-                 (> (length gnus-newsgroup-headers)
-                    (length gnus-newsgroup-scored))))
-       ()
+    ;; Do the scoring.
+    (when (and gnus-summary-default-score
+              scores
+              (> (length gnus-newsgroup-headers)
+                 (length gnus-newsgroup-scored)))
       (let* ((entries gnus-header-index)
             (now (gnus-day-number (current-time-string)))
             (expire (- now gnus-score-expiry-days))
@@ -850,13 +926,14 @@ SCORE is the score to add."
          ;; Run each header through the score process.
          (while entries
            (setq entry (car entries)
-                 header (nth 0 entry)
+                 header (downcase (nth 0 entry))
                  entries (cdr entries))
            (setq gnus-score-index (nth 1 (assoc header gnus-header-index)))
            (if (< 0 (apply 'max (mapcar
                                  (lambda (score)
                                    (length (gnus-score-get header score)))
                                  scores)))
+               ;; Call the scoring function for this type of "header".
                (funcall (nth 2 entry) scores header now expire trace)))
          ;; Remove the buffer.
          (kill-buffer (current-buffer)))
@@ -1144,8 +1221,6 @@ SCORE is the score to add."
                  (setq entries rest)))))
          (setq articles (cdr articles)))))))
 
-
-
 (defun gnus-score-followup (scores header now expire &optional trace)
   ;; Insert the unique article headers in the buffer.
   (let ((gnus-score-index (nth 1 (assoc header gnus-header-index)))
@@ -1368,19 +1443,14 @@ SCORE is the score to add."
                ;; Found a match, update scores.
                (if trace
                    (while arts
-                     (setq art (car arts)
-                           arts (cdr arts))
+                     (setq art (pop arts))
                      (setcdr art (+ score (cdr art)))
-                     (setq gnus-score-trace
-                           (cons
-                            (cons
-                             (car-safe
-                              (rassq alist gnus-score-cache))
+                     (push (cons
+                             (car-safe (rassq alist gnus-score-cache))
                              kill)
-                            gnus-score-trace)))
+                           gnus-score-trace))
                  (while arts
-                   (setq art (car arts)
-                         arts (cdr arts))
+                   (setq art (pop arts))
                    (setcdr art (+ score (cdr art)))))
                (forward-line 1)))
            ;; Update expire date
@@ -1393,71 +1463,61 @@ SCORE is the score to add."
                   (setcdr entries (cdr rest))
                   (setq rest entries))))
          (setq entries rest))))
-  
+
     ;; Find fuzzy matches.
-    (setq scores (and fuzzy score-list))
-    (if fuzzy (gnus-simplify-buffer-fuzzy))
-    (while scores
-      (setq alist (car scores)
-           scores (cdr scores)
-           entries (assoc header alist))
-      (while (cdr entries)             ;First entry is the header index.
-       (let* ((rest (cdr entries))             
-              (kill (car rest))
-              (match (nth 0 kill))
-              (type (or (nth 3 kill) 's))
-              (score (or (nth 1 kill) gnus-score-interactive-default-score))
-              (date (nth 2 kill))
-              (found nil)
-              (mt (aref (symbol-name type) 0))
-              (case-fold-search 
-               (not (or (= mt ?R) (= mt ?S) (= mt ?E) (= mt ?F))))
-              (dmt (downcase mt))
-              (search-func 
-               (cond ((= dmt ?r) 're-search-forward)
-                     ((or (= dmt ?e) (= dmt ?s) (= dmt ?f)) 'search-forward)
-                     (t (error "Illegal match type: %s" type))))
-              arts art)
-         (if (/= dmt ?f)
-             ()
-           (goto-char (point-min))
-           (while (and (not (eobp)) 
-                       (funcall search-func match nil t))
-             (and (= (progn (beginning-of-line) (point))
-                     (match-beginning 0))
-                  (= (progn (end-of-line) (point))
-                     (match-end 0))
-                  (progn
-                    (setq found (setq arts (get-text-property 
-                                            (point) 'articles)))
-                    ;; Found a match, update scores.
-                    (if trace
-                        (while arts
-                          (setq art (car arts)
-                                arts (cdr arts))
-                          (setcdr art (+ score (cdr art)))
-                          (setq gnus-score-trace
-                                (cons
-                                 (cons
-                                  (car-safe
-                                   (rassq alist gnus-score-cache))
-                                  kill)
-                                 gnus-score-trace)))
-                      (while arts
-                        (setq art (car arts)
-                              arts (cdr arts))
-                        (setcdr art (+ score (cdr art)))))))
-             (forward-line 1))
-           ;; Update expire date
-           (cond ((null date))         ;Permanent entry.
-                 (found                ;Match, update date.
-                  (gnus-score-set 'touched '(t) alist)
-                  (setcar (nthcdr 2 kill) now))
-                 ((< date expire)      ;Old entry, remove.
-                  (gnus-score-set 'touched '(t) alist)
-                  (setcdr entries (cdr rest))
-                  (setq rest entries))))
-         (setq entries rest))))))
+    (when fuzzy
+      (setq scores score-list)
+      (gnus-simplify-buffer-fuzzy)
+      (while scores
+       (setq alist (car scores)
+             scores (cdr scores)
+             entries (assoc header alist))
+       (while (cdr entries)            ;First entry is the header index.
+         (let* ((rest (cdr entries))           
+                (kill (car rest))
+                (match (nth 0 kill))
+                (type (or (nth 3 kill) 's))
+                (score (or (nth 1 kill) gnus-score-interactive-default-score))
+                (date (nth 2 kill))
+                (found nil)
+                (mt (aref (symbol-name type) 0))
+                (case-fold-search (not (= mt ?F)))
+                (dmt (downcase mt))
+                arts art)
+           (when (= dmt ?f)
+             (goto-char (point-min))
+             (while (and (not (eobp)) 
+                         (search-forward match nil t))
+               (when (and (= (progn (beginning-of-line) (point))
+                             (match-beginning 0))
+                          (= (progn (end-of-line) (point))
+                             (match-end 0)))
+                 (setq found (setq arts (get-text-property 
+                                         (point) 'articles)))
+                 ;; Found a match, update scores.
+                 (if trace
+                     (while arts
+                       (setq art (pop arts))
+                       (setcdr art (+ score (cdr art)))
+                       (push (cons
+                              (car-safe (rassq alist gnus-score-cache))
+                              kill)
+                             gnus-score-trace))
+                   (while arts
+                     (setq art (pop arts))
+                     (setcdr art (+ score (cdr art))))))
+               (forward-line 1))
+             ;; Update expire date
+             (unless trace
+               (cond ((null date))             ;Permanent entry.
+                     (found            ;Match, update date.
+                      (gnus-score-set 'touched '(t) alist)
+                      (setcar (nthcdr 2 kill) now))
+                     ((< date expire)  ;Old entry, remove.
+                      (gnus-score-set 'touched '(t) alist)
+                      (setcdr entries (cdr rest))
+                      (setq rest entries)))))
+           (setq entries rest)))))))
 
 (defun gnus-score-string< (a1 a2)
   ;; Compare headers in articles A2 and A2.
@@ -1627,6 +1687,295 @@ This mode is an extended emacs-lisp mode.
   (setq gnus-score-cache nil
        gnus-internal-global-score-files nil))
 
+;; Summary score marking commands.
+
+(defun gnus-summary-raise-same-subject-and-select (score)
+  "Raise articles which has the same subject with SCORE and select the next."
+  (interactive "p")
+  (let ((subject (gnus-summary-article-subject)))
+    (gnus-summary-raise-score score)
+    (while (gnus-summary-find-subject subject)
+      (gnus-summary-raise-score score))
+    (gnus-summary-next-article t)))
+
+(defun gnus-summary-raise-same-subject (score)
+  "Raise articles which has the same subject with SCORE."
+  (interactive "p")
+  (let ((subject (gnus-summary-article-subject)))
+    (gnus-summary-raise-score score)
+    (while (gnus-summary-find-subject subject)
+      (gnus-summary-raise-score score))
+    (gnus-summary-next-subject 1 t)))
+
+(defun gnus-score-default (level)
+  (if level (prefix-numeric-value level) 
+    gnus-score-interactive-default-score))
+
+(defun gnus-summary-raise-thread (&optional score)
+  "Raise the score of the articles in the current thread with SCORE."
+  (interactive "P")
+  (setq score (gnus-score-default score))
+  (let (e)
+    (save-excursion
+      (let ((articles (gnus-summary-articles-in-thread)))
+       (while articles
+         (gnus-summary-goto-subject (car articles))
+         (gnus-summary-raise-score score)
+         (setq articles (cdr articles))))
+      (setq e (point)))
+    (let ((gnus-summary-check-current t))
+      (or (zerop (gnus-summary-next-subject 1 t))
+         (goto-char e))))
+  (gnus-summary-recenter)
+  (gnus-summary-position-point)
+  (gnus-set-mode-line 'summary))
+
+(defun gnus-summary-lower-same-subject-and-select (score)
+  "Raise articles which has the same subject with SCORE and select the next."
+  (interactive "p")
+  (gnus-summary-raise-same-subject-and-select (- score)))
+
+(defun gnus-summary-lower-same-subject (score)
+  "Raise articles which has the same subject with SCORE."
+  (interactive "p")
+  (gnus-summary-raise-same-subject (- score)))
+
+(defun gnus-summary-lower-thread (&optional score)
+  "Lower score of articles in the current thread with SCORE."
+  (interactive "P")
+  (gnus-summary-raise-thread (- (1- (gnus-score-default score)))))
+
+;;; Finding score files. 
+
+(defun gnus-score-score-files (group)
+  "Return a list of all possible score files."
+  ;; Search and set any global score files.
+  (and gnus-global-score-files 
+       (or gnus-internal-global-score-files
+          (gnus-score-search-global-directories gnus-global-score-files)))
+  ;; Fix the kill-file dir variable.
+  (setq gnus-kill-files-directory 
+       (file-name-as-directory
+        (or gnus-kill-files-directory "~/News/")))
+  ;; If we can't read it, there are no score files.
+  (if (not (file-exists-p (expand-file-name gnus-kill-files-directory)))
+      (setq gnus-score-file-list nil)
+    (if (gnus-use-long-file-name 'not-score)
+       ;; We want long file names.
+       (if (or (not gnus-score-file-list)
+               (not (car gnus-score-file-list))
+               (gnus-file-newer-than gnus-kill-files-directory
+                                     (car gnus-score-file-list)))
+           (setq gnus-score-file-list 
+                 (cons (nth 5 (file-attributes gnus-kill-files-directory))
+                       (nreverse 
+                        (directory-files 
+                         gnus-kill-files-directory t 
+                         (gnus-score-file-regexp))))))
+      ;; We do not use long file names, so we have to do some
+      ;; directory traversing.  
+      (let ((mdir (length (expand-file-name gnus-kill-files-directory)))
+           (suffixes (list gnus-score-file-suffix gnus-adaptive-file-suffix))
+           dir files suffix)
+       (while suffixes
+         (setq dir (expand-file-name
+                    (concat gnus-kill-files-directory
+                            (gnus-replace-chars-in-string group ?. ?/))))
+         (setq dir (gnus-replace-chars-in-string dir ?: ?/))
+         (setq suffix (car suffixes)
+               suffixes (cdr suffixes))
+         (if (file-exists-p (concat dir "/" suffix))
+             (setq files (cons (concat dir "/" suffix) files)))
+         (while (>= (1+ (length dir)) mdir)
+           (and (file-exists-p (concat dir "/all/" suffix))
+                (setq files (cons (concat dir "/all/" suffix) files)))
+           (string-match "/[^/]*$" dir)
+           (setq dir (substring dir 0 (match-beginning 0)))))
+       (setq gnus-score-file-list 
+             (cons nil (nreverse files)))))
+    (cdr gnus-score-file-list)))
+
+(defun gnus-score-file-regexp ()
+  (concat "\\(" gnus-score-file-suffix 
+         "\\|" gnus-adaptive-file-suffix "\\)$"))
+       
+(defun gnus-score-find-bnews (group)
+  "Return a list of score files for GROUP.
+The score files are those files in the ~/News directory which matches
+GROUP using BNews sys file syntax."
+  (let* ((sfiles (append (gnus-score-score-files group)
+                        gnus-internal-global-score-files))
+        (kill-dir (file-name-as-directory 
+                   (expand-file-name gnus-kill-files-directory)))
+        (klen (length kill-dir))
+        (score-regexp (gnus-score-file-regexp))
+        ofiles not-match regexp)
+    (save-excursion
+      (set-buffer (get-buffer-create "*gnus score files*"))
+      (buffer-disable-undo (current-buffer))
+      ;; Go through all score file names and create regexp with them
+      ;; as the source.  
+      (while sfiles
+       (erase-buffer)
+       (insert (car sfiles))
+       (goto-char (point-min))
+       ;; First remove the suffix itself.
+       (re-search-forward (concat "." score-regexp))
+       (replace-match "" t t) 
+       (goto-char (point-min))
+       (if (looking-at (regexp-quote kill-dir))
+           ;; If the file name was just "SCORE", `klen' is one character
+           ;; too much.
+           (delete-char (min (1- (point-max)) klen))
+         (goto-char (point-max))
+         (search-backward "/")
+         (delete-region (1+ (point)) (point-min)))
+       ;; If short file names were used, we have to translate slashes.
+       (goto-char (point-min))
+       (while (re-search-forward "[/:]" nil t)
+         (replace-match "." t t))
+       ;; Cludge to get rid of "nntp+" problems.
+       (goto-char (point-min))
+       (and (looking-at "nn[a-z]+\\+")
+            (progn
+              (search-forward "+")
+              (forward-char -1)
+              (insert "\\")))
+       ;; Translate "all" to ".*".
+       (while (search-forward "all" nil t)
+         (replace-match ".*" t t))
+       (goto-char (point-min))
+       ;; Deal with "not."s.
+       (if (looking-at "not.")
+           (progn
+             (setq not-match t)
+             (setq regexp (buffer-substring 5 (point-max))))
+         (setq regexp (buffer-substring 1 (point-max)))
+         (setq not-match nil))
+       ;; Finally - if this resulting regexp matches the group name,
+       ;; we add this score file to the list of score files
+       ;; applicable to this group.
+       (if (or (and not-match
+                    (not (string-match regexp group)))
+               (and (not not-match)
+                    (string-match regexp group)))
+           (setq ofiles (cons (car sfiles) ofiles)))
+       (setq sfiles (cdr sfiles)))
+      (kill-buffer (current-buffer))
+      ;; Slight kludge here - the last score file returned should be
+      ;; the local score file, whether it exists or not. This is so
+      ;; that any score commands the user enters will go to the right
+      ;; file, and not end up in some global score file.
+      (let ((localscore (gnus-score-file-name group)))
+       (setq ofiles (cons localscore (delete localscore ofiles))))
+      (nreverse ofiles))))
+
+(defun gnus-score-find-single (group)
+  "Return list containing the score file for GROUP."
+  (list (gnus-score-file-name group gnus-adaptive-file-suffix)
+       (gnus-score-file-name group)))
+
+(defun gnus-score-find-hierarchical (group)
+  "Return list of score files for GROUP.
+This includes the score file for the group and all its parents."
+  (let ((all (copy-sequence '(nil)))
+       (start 0))
+    (while (string-match "\\." group (1+ start))
+      (setq start (match-beginning 0))
+      (setq all (cons (substring group 0 start) all)))
+    (setq all (cons group all))
+    (nconc
+     (mapcar (lambda (newsgroup)
+              (gnus-score-file-name newsgroup gnus-adaptive-file-suffix))
+            (setq all (nreverse all)))
+     (mapcar 'gnus-score-file-name all))))
+
+(defvar gnus-score-file-alist-cache nil)
+
+(defun gnus-score-find-alist (group)
+  "Return list of score files for GROUP.
+The list is determined from the variable gnus-score-file-alist."
+  (let ((alist gnus-score-file-multiple-match-alist)
+       score-files)
+    ;; if this group has been seen before, return the cached entry
+    (if (setq score-files (assoc group gnus-score-file-alist-cache))
+       (cdr score-files)               ;ensures caching groups with no matches
+      ;; handle the multiple match alist
+      (while alist
+       (and (string-match (car (car alist)) group)
+            (setq score-files
+                  (nconc score-files (copy-sequence (cdr (car alist))))))
+       (setq alist (cdr alist)))
+      (setq alist gnus-score-file-single-match-alist)
+      ;; handle the single match alist
+      (while alist
+       (and (string-match (car (car alist)) group)
+            ;; progn used just in case ("regexp") has no files
+            ;; and score-files is still nil. -sj
+            ;; this can be construed as a "stop searching here" feature :>
+            ;; and used to simplify regexps in the single-alist 
+            (progn
+              (setq score-files
+                    (nconc score-files (copy-sequence (cdr (car alist)))))
+              (setq alist nil)))
+       (setq alist (cdr alist)))
+      ;; cache the score files
+      (setq gnus-score-file-alist-cache
+           (cons (cons group score-files) gnus-score-file-alist-cache))
+      score-files)))
+
+(defun gnus-possibly-score-headers (&optional trace)
+  (let ((func gnus-score-find-score-files-function)
+       score-files)
+    (and func 
+        (not (listp func))
+        (setq func (list func)))
+    ;; Go through all the functions for finding score files (or actual
+    ;; scores) and add them to a list.
+    (and func (setq score-files (gnus-score-find-alist gnus-newsgroup-name)))
+    (while func
+      (and (symbolp (car func))
+          (fboundp (car func))
+          (setq score-files 
+                (nconc score-files (funcall (car func) gnus-newsgroup-name))))
+      (setq func (cdr func)))
+    (if score-files (gnus-score-headers score-files trace))))
+
+(defun gnus-score-file-name (newsgroup &optional suffix)
+  "Return the name of a score file for NEWSGROUP."
+  (let ((suffix (or suffix gnus-score-file-suffix)))
+    (cond 
+     ((or (null newsgroup)
+         (string-equal newsgroup ""))
+      ;; The global score file is placed at top of the directory.
+      (expand-file-name 
+       suffix (or gnus-kill-files-directory "~/News")))
+     ((gnus-use-long-file-name 'not-score)
+      ;; Append ".SCORE" to newsgroup name.
+      (expand-file-name (concat (gnus-newsgroup-saveable-name newsgroup)
+                               "." suffix)
+                       (or gnus-kill-files-directory "~/News")))
+     (t
+      ;; Place "SCORE" under the hierarchical directory.
+      (expand-file-name (concat (gnus-newsgroup-directory-form newsgroup)
+                               "/" suffix)
+                       (or gnus-kill-files-directory "~/News"))))))
+
+(defun gnus-score-search-global-directories (files)
+  "Scan all global score directories for score files."
+  ;; Set the variable `gnus-internal-global-score-files' to all
+  ;; available global score files.
+  (interactive (list gnus-global-score-files))
+  (let (out)
+    (while files
+      (if (string-match "/$" (car files))
+         (setq out (nconc (directory-files 
+                           (car files) t
+                           (concat (gnus-score-file-regexp) "$"))))
+       (setq out (cons (car files) out)))
+      (setq files (cdr files)))
+    (setq gnus-internal-global-score-files out)))
+
 (provide 'gnus-score)
 
 ;;; gnus-score.el ends here
index 94f0e78..2615451 100644 (file)
@@ -150,7 +150,7 @@ move those articles instead."
        ;; Mark article as read. 
        (set-buffer gnus-summary-buffer)
        (gnus-summary-remove-process-mark (car articles))
-       (gnus-summary-mark-as-read (car articles) "F")
+       (gnus-summary-mark-as-read (car articles) gnus-souped-mark)
        (setq articles (cdr articles)))
       (kill-buffer tmp-buf))
     (gnus-soup-save-areas)))
@@ -303,15 +303,16 @@ $ emacs -batch -f gnus-batch-brew-soup ^nnml \".*emacs.*\""
 
 (defun gnus-soup-write-prefixes ()
   (let ((prefix gnus-soup-last-prefix))
-    (while prefix
-      (gnus-set-work-buffer)
-      (insert (format "(setq gnus-soup-prev-prefix %d)\n" 
-                     (cdr (car prefix))))
-      (write-region (point-min) (point-max)
-                   (concat (car (car prefix)) 
-                           gnus-soup-prefix-file) 
-                   nil 'nomesg)
-      (setq prefix (cdr prefix)))))
+    (save-excursion
+      (while prefix
+       (gnus-set-work-buffer)
+       (insert (format "(setq gnus-soup-prev-prefix %d)\n" 
+                       (cdr (car prefix))))
+       (write-region (point-min) (point-max)
+                     (concat (car (car prefix)) 
+                             gnus-soup-prefix-file) 
+                     nil 'nomesg)
+       (setq prefix (cdr prefix))))))
 
 (defun gnus-soup-pack (dir packer)
   (let* ((files (mapconcat 'identity
@@ -378,7 +379,8 @@ file. The vector contain three strings, [prefix name encoding]."
                            (gnus-soup-field))
                    replies))
        (if (eq (preceding-char) ?\t)
-           (beginning-of-line 2))))
+           (beginning-of-line 2)))
+      (kill-buffer (current-buffer)))
     replies))
 
 (defun gnus-soup-field ()
@@ -399,6 +401,7 @@ file. The vector contain three strings, [prefix name encoding]."
     (save-excursion
       (set-buffer (find-file-noselect
                   (concat gnus-soup-directory "AREAS")))
+      (buffer-disable-undo)
       (erase-buffer)
       (let ((areas gnus-soup-areas)
            area)
@@ -430,6 +433,7 @@ file. The vector contain three strings, [prefix name encoding]."
       (gnus-make-directory dir))
   (save-excursion
     (set-buffer (find-file-noselect (concat dir "REPLIES")))
+    (buffer-disable-undo)
     (erase-buffer)
     (let (area)
       (while areas
diff --git a/lisp/gnus-srvr.el b/lisp/gnus-srvr.el
new file mode 100644 (file)
index 0000000..e970b45
--- /dev/null
@@ -0,0 +1,397 @@
+;;; gnus-srvr.el --- virtual server support for Gnus
+;; Copyright (C) 1995 Free Software Foundation, Inc.
+
+;; Author: Lars Magne Ingebrigtsen <larsi@ifi.uio.no>
+;; Keywords: news
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 2, or (at your option)
+;; any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING.  If not, write to
+;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+
+;;; Commentary:
+
+;;; Code:
+
+(require 'gnus)
+(eval-when-compile (require 'cl))
+
+(defvar gnus-server-mode-hook nil
+  "Hook run in `gnus-server-mode' buffers.")
+
+(defconst gnus-server-line-format "     {%(%h:%w%)} %s\n"
+  "Format of server lines.
+It works along the same lines as a normal formatting string,
+with some simple extensions.")
+
+(defvar gnus-server-mode-line-format "Gnus  List of servers"
+  "The format specification for the server mode line.")
+
+;;; Internal variables.
+
+(defconst gnus-server-line-format-alist
+  (` ((?h how ?s)
+      (?n name ?s)
+      (?w where ?s)
+      (?s status ?s)))) 
+
+(defconst gnus-server-mode-line-format-alist 
+  (` ((?S news-server ?s)
+      (?M news-method ?s)
+      (?u user-defined ?s))))
+
+(defvar gnus-server-line-format-spec nil)
+(defvar gnus-server-mode-line-format-spec nil)
+(defvar gnus-server-killed-servers nil)
+
+(defvar gnus-server-mode-map nil)
+(put 'gnus-server-mode 'mode-class 'special)
+
+(if gnus-server-mode-map
+    nil
+  (setq gnus-server-mode-map (make-sparse-keymap))
+  (suppress-keymap gnus-server-mode-map)
+  (define-key gnus-server-mode-map " " 'gnus-server-read-server)
+  (define-key gnus-server-mode-map "\r" 'gnus-server-read-server)
+  (define-key gnus-server-mode-map gnus-mouse-2 'gnus-server-pick-server)
+  (define-key gnus-server-mode-map "q" 'gnus-server-exit)
+  (define-key gnus-server-mode-map "l" 'gnus-server-list-servers)
+  (define-key gnus-server-mode-map "k" 'gnus-server-kill-server)
+  (define-key gnus-server-mode-map "y" 'gnus-server-yank-server)
+  (define-key gnus-server-mode-map "c" 'gnus-server-copy-server)
+  (define-key gnus-server-mode-map "a" 'gnus-server-add-server)
+  (define-key gnus-server-mode-map "e" 'gnus-server-edit-server)
+
+  (define-key gnus-server-mode-map "O" 'gnus-server-open-server)
+  (define-key gnus-server-mode-map "C" 'gnus-server-close-server)
+  (define-key gnus-server-mode-map "D" 'gnus-server-deny-server)
+  (define-key gnus-server-mode-map "R" 'gnus-server-remove-denials)
+  )
+
+(defun gnus-server-mode ()
+  "Major mode for listing and editing servers.
+
+All normal editing commands are switched off.
+\\<gnus-server-mode-map>
+
+For more in-depth information on this mode, read the manual (`\\[gnus-info-find-node]'). 
+
+The following commands are available:
+
+\\{gnus-server-mode-map}"
+  (interactive)
+  (if (gnus-visual-p 'server-menu 'menu) (gnus-server-make-menu-bar))
+  (kill-all-local-variables)
+  (setq mode-line-modified "-- ")
+  (make-local-variable 'mode-line-format)
+  (setq mode-line-format (copy-sequence mode-line-format))
+  (and (equal (nth 3 mode-line-format) "   ")
+       (setcar (nthcdr 3 mode-line-format) ""))
+  (setq major-mode 'gnus-server-mode)
+  (setq mode-name "Server")
+                                       ;  (gnus-group-set-mode-line)
+  (setq mode-line-process nil)
+  (use-local-map gnus-server-mode-map)
+  (buffer-disable-undo (current-buffer))
+  (setq truncate-lines t)
+  (setq buffer-read-only t)
+  (run-hooks 'gnus-server-mode-hook))
+
+(defun gnus-server-insert-server-line (sformat name method)
+  (let* ((sformat (or sformat gnus-server-line-format-spec))
+        (how (car method))
+        (where (nth 1 method))
+        (elem (assoc method gnus-opened-servers))
+        (status (cond ((eq (nth 1 elem) 'denied)
+                       "(denied)")
+                      ((gnus-server-opened method)
+                       "(open)")
+                      (t
+                       "(closed)")))
+        b)
+    (beginning-of-line)
+    (setq b (point))
+    ;; Insert the text.
+    (insert (eval sformat))
+    (add-text-properties b (1+ b) (list 'gnus-server (intern name)))))
+
+(defun gnus-server-enter-server-buffer ()
+  "Set up the server buffer."
+  (gnus-server-setup-buffer)
+  (gnus-configure-windows 'server)
+  (gnus-server-prepare))
+
+(defun gnus-server-setup-buffer ()
+  (if (get-buffer gnus-server-buffer)
+      ()
+    (save-excursion
+      (set-buffer (get-buffer-create gnus-server-buffer))
+      (gnus-server-mode)
+      (and gnus-carpal (gnus-carpal-setup-buffer 'server)))))
+
+(defun gnus-server-prepare ()
+  (setq gnus-server-mode-line-format-spec 
+       (gnus-parse-format gnus-server-mode-line-format 
+                          gnus-server-mode-line-format-alist))
+  (setq gnus-server-line-format-spec 
+       (gnus-parse-format gnus-server-line-format 
+                          gnus-server-line-format-alist))
+  (let ((alist gnus-server-alist)
+       (buffer-read-only nil)
+       (opened gnus-opened-servers)
+       done)
+    (erase-buffer)
+    ;; First we do the real list of servers.
+    (while alist
+      (gnus-server-insert-server-line nil (car (car alist)) (cdr (car alist)))
+      (and (assoc (cdr (car alist)) gnus-opened-servers)
+          (setq done (cons (cdr (car alist)) done)))
+      (setq alist (cdr alist)))
+    ;; Then we insert the list of servers that have been opened in
+    ;; this session.
+    (while opened 
+      (or (member (car (car opened)) done)
+         (gnus-server-insert-server-line 
+          nil (format "%s:%s" (car (car (car opened))) 
+                      (nth 1 (car (car opened))))
+          (car (car opened))))
+      (setq opened (cdr opened))))
+  (goto-char (point-min))
+  (gnus-server-position-point))
+
+(defun gnus-server-server-name ()
+  (let ((server (get-text-property (gnus-point-at-bol) 'gnus-server)))
+    (and server (symbol-name server))))
+
+(defalias 'gnus-server-position-point 'gnus-goto-colon)
+
+(defconst gnus-server-edit-buffer "*Gnus edit server*")
+
+(defun gnus-server-update-server (server)
+  (save-excursion
+    (set-buffer gnus-server-buffer)
+    (let ((buffer-read-only nil)
+         (info (cdr (assoc server gnus-server-alist))))
+      (gnus-dribble-enter 
+       (concat "(gnus-server-set-info \"" server "\" '"
+              (prin1-to-string info) ")"))
+      ;; Buffer may be narrowed.
+      (save-restriction
+       (widen)
+       (if (gnus-server-goto-server server)
+           (delete-region (progn (beginning-of-line) (point))
+                          (progn (forward-line 1) (point))))
+       (let ((entry (assoc server gnus-server-alist)))
+         (gnus-server-insert-server-line nil (car entry) (cdr entry))
+         (gnus-server-position-point))))))
+
+(defun gnus-server-set-info (server info)
+  ;; Enter a select method into the virtual server alist.
+  (gnus-dribble-enter 
+   (concat "(gnus-server-set-info \"" server "\" '"
+          (prin1-to-string info) ")"))
+  (let* ((server (nth 1 info))
+        (entry (assoc server gnus-server-alist)))
+    (if entry (setcdr entry info)
+      (setq gnus-server-alist
+           (nconc gnus-server-alist (list (cons server info)))))))
+
+;;; Interactive server functions.
+
+(defun gnus-server-kill-server (server)
+  "Kill the server on the current line."
+  (interactive (list (gnus-server-server-name)))
+  (or (gnus-server-goto-server server)
+      (if server (error "No such server: %s" server)
+       (error "No server on the current line")))
+  (gnus-dribble-enter "")
+  (let ((buffer-read-only nil))
+    (delete-region (progn (beginning-of-line) (point))
+                  (progn (forward-line 1) (point))))
+  (setq gnus-server-killed-servers 
+       (cons (assoc server gnus-server-alist) gnus-server-killed-servers))
+  (setq gnus-server-alist (delq (car gnus-server-killed-servers)
+                               gnus-server-alist))
+  (gnus-server-position-point))
+
+(defun gnus-server-yank-server ()
+  "Yank the previously killed server."
+  (interactive)
+  (or gnus-server-killed-servers
+      (error "No killed servers to be yanked"))
+  (let ((alist gnus-server-alist)
+       (server (gnus-server-server-name))
+       (killed (car gnus-server-killed-servers)))
+    (if (not server) 
+       (setq gnus-server-alist (nconc gnus-server-alist (list killed)))
+      (if (string= server (car (car gnus-server-alist)))
+         (setq gnus-server-alist (cons killed gnus-server-alist))
+       (while (and (cdr alist)
+                   (not (string= server (car (car (cdr alist))))))
+         (setq alist (cdr alist)))
+       (setcdr alist (cons killed (cdr alist)))
+       (if alist
+           (setcdr alist (cons killed (cdr alist)))
+         (setq gnus-server-alist (list killed)))))
+    (gnus-server-update-server (car killed))
+    (setq gnus-server-killed-servers (cdr gnus-server-killed-servers))
+    (gnus-server-position-point)))
+
+(defun gnus-server-exit ()
+  "Return to the group buffer."
+  (interactive)
+  (kill-buffer (current-buffer))
+  (switch-to-buffer gnus-group-buffer))
+
+(defun gnus-server-list-servers ()
+  "List all available servers."
+  (interactive)
+  (let ((cur (gnus-server-server-name)))
+    (gnus-server-prepare)
+    (if cur (gnus-server-goto-server cur)
+      (goto-char (point-max))
+      (forward-line -1))
+    (gnus-server-position-point)))
+
+(defun gnus-opened-servers-remove (method)
+  "Remove METHOD from the list of opened servers."
+  (setq gnus-opened-servers (delq (assoc method gnus-opened-servers)
+                                 gnus-opened-servers)))
+
+(defun gnus-server-open-server (server)
+  "Force an open of SERVER."
+  (interactive (list (gnus-server-server-name)))
+  (let ((method (gnus-server-to-method server)))
+    (or method (error "No such server: %s" server))
+    (gnus-opened-servers-remove method)
+    (prog1
+       (or (gnus-open-server method)
+           (progn (message "Couldn't open %s" server) nil))
+      (gnus-server-update-server server)
+      (gnus-server-position-point))))
+
+(defun gnus-server-close-server (server)
+  "Close SERVER."
+  (interactive (list (gnus-server-server-name)))
+  (let ((method (gnus-server-to-method server)))
+    (or method (error "No such server: %s" server))
+    (gnus-opened-servers-remove method)
+    (prog1
+       (gnus-close-server method)
+      (gnus-server-update-server server)
+      (gnus-server-position-point))))
+
+(defun gnus-server-deny-server (server)
+  "Make sure SERVER will never be attempted opened."
+  (interactive (list (gnus-server-server-name)))
+  (let ((method (gnus-server-to-method server)))
+    (or method (error "No such server: %s" server))
+    (gnus-opened-servers-remove method)
+    (setq gnus-opened-servers
+         (cons (list method 'denied) gnus-opened-servers)))
+  (gnus-server-update-server server)
+  (gnus-server-position-point))
+
+(defun gnus-server-remove-denials ()
+  "Remove all marks as to whether Gnus could open servers or not."
+  (interactive)
+  (setq gnus-opened-servers nil)
+  (gnus-server-list-servers))
+
+(defun gnus-server-copy-server (from to)
+  (interactive
+   (list
+    (or (gnus-server-server-name)
+       (error "No server on the current line"))
+    (read-string "Copy to: ")))
+  (or from (error "No server on current line"))
+  (or (and to (not (string= to ""))) (error "No name to copy to"))
+  (and (assoc to gnus-server-alist) (error "%s already exists" to))
+  (or (assoc from gnus-server-alist) 
+      (error "%s: no such server" from))
+  (let ((to-entry (gnus-copy-sequence (assoc from gnus-server-alist))))
+    (setcar to-entry to)
+    (setcar (nthcdr 2 to-entry) to)
+    (setq gnus-server-killed-servers 
+         (cons to-entry gnus-server-killed-servers))
+    (gnus-server-yank-server)))
+
+(defun gnus-server-add-server (how where)
+  (interactive 
+   (list (intern (completing-read "Server method: "
+                                 gnus-valid-select-methods nil t))
+        (read-string "Server name: ")))
+  (setq gnus-server-killed-servers 
+       (cons (list where how where) gnus-server-killed-servers))
+  (gnus-server-yank-server))
+
+(defun gnus-server-goto-server (server)
+  "Jump to a server line."
+  (interactive
+   (list (completing-read "Goto server: " gnus-server-alist nil t)))
+  (let ((to (text-property-any (point-min) (point-max) 
+                              'gnus-server (intern server))))
+    (and to
+        (progn
+          (goto-char to) 
+          (gnus-server-position-point)))))
+
+(defun gnus-server-edit-server (server)
+  "Edit the server on the current line."
+  (interactive (list (gnus-server-server-name)))
+  (or server
+      (error "No server on current line"))
+  (let ((winconf (current-window-configuration)))
+    (get-buffer-create gnus-server-edit-buffer)
+    (gnus-configure-windows 'edit-server)
+    (gnus-add-current-to-buffer-list)
+    (emacs-lisp-mode)
+    (make-local-variable 'gnus-prev-winconf)
+    (setq gnus-prev-winconf winconf)
+    (use-local-map (copy-keymap (current-local-map)))
+    (let ((done-func '(lambda () 
+                       "Exit editing mode and update the information."
+                       (interactive)
+                       (gnus-server-edit-server-done 'group))))
+      (setcar (cdr (nth 4 done-func)) server)
+      (local-set-key "\C-c\C-c" done-func))
+    (erase-buffer)
+    (insert ";; Type `C-c C-c' after you have edited the server.\n\n")
+    (insert (pp-to-string (cdr (assoc server gnus-server-alist))))))
+
+(defun gnus-server-edit-server-done (server)
+  (interactive)
+  (set-buffer (get-buffer-create gnus-server-edit-buffer))
+  (goto-char (point-min))
+  (let ((form (read (current-buffer)))
+       (winconf gnus-prev-winconf))
+    (gnus-server-set-info server form)
+    (kill-buffer (current-buffer))
+    (and winconf (set-window-configuration winconf))
+    (set-buffer gnus-server-buffer)
+    (gnus-server-update-server (gnus-server-server-name))
+    (gnus-server-list-servers)
+    (gnus-server-position-point)))
+
+(defun gnus-server-read-server (server)
+  "Browse a server."
+  (interactive (list (gnus-server-server-name)))
+  (gnus-browse-foreign-server (gnus-server-to-method server) (current-buffer)))
+
+(defun gnus-mouse-pick-server (e)
+  (interactive "e")
+  (mouse-set-point e)
+  (gnus-server-read-server (gnus-server-server-name)))
+
+;;; gnus-srvr.el ends here.
index 17f52bc..bd7499b 100644 (file)
@@ -77,7 +77,8 @@ If LOWEST is non-nil, list all newsgroups of level LOWEST or higher."
         (lowest (or lowest 1))
        tlist info)
     
-    (or list-topic (erase-buffer))
+    (unless list-topic 
+      (erase-buffer))
     
     ;; List dead groups?
     (and (>= level gnus-level-zombie) (<= lowest gnus-level-zombie)
@@ -109,7 +110,7 @@ If LOWEST is non-nil, list all newsgroups of level LOWEST or higher."
               (point)
               (progn
                 (insert topic "\n")
-                (point))
+                (1- (point)))
               (list 'mouse-face gnus-mouse-face
                     'face gnus-group-topic-face
                     'gnus-topic topic)))
@@ -118,6 +119,7 @@ If LOWEST is non-nil, list all newsgroups of level LOWEST or higher."
             (if (and (or (and (not how) (not gnus-group-topic-topics-only))
                         (and how (not (numberp how))))
                     (not (member topic gnus-topics-not-listed)))
+               ;; We want to list this topic.
                (progn
                  (setq gnus-topics-not-listed
                        (delete topic gnus-topics-not-listed))
@@ -125,12 +127,14 @@ If LOWEST is non-nil, list all newsgroups of level LOWEST or higher."
                  (while tlist
                    (setq info (car tlist))
                    (gnus-group-insert-group-line 
-                    nil (car info) (car (cdr info)) (nth 3 info) 
-                    (car (gnus-gethash (car info) gnus-newsrc-hashtb))
-                    (nth 4 info))
+                    nil (gnus-info-group info)
+                    (gnus-info-level info) (gnus-info-marks info) 
+                    (car (gnus-gethash (gnus-info-group info)
+                                       gnus-newsrc-hashtb))
+                    (gnus-info-method info))
                    (setq tlist (cdr tlist))))
-             (setq gnus-topics-not-listed
-                   (cons topic gnus-topics-not-listed)))))))
+             ;; This one is hiddent.
+             (push topic gnus-topics-not-listed))))))
 
   (gnus-group-set-mode-line)
   (setq gnus-group-list-mode (cons level all))
@@ -153,21 +157,21 @@ If TOPIC, just find the groups in that topic."
     ;; We go through the newsrc to look for matches.
     (while newsrc
       (setq info (car newsrc)
-            group (car info)
+            group (gnus-info-group info)
             newsrc (cdr newsrc)
             unread (car (gnus-gethash group gnus-newsrc-hashtb)))
       (and 
        unread                          ; nil means that the group is dead.
-       (<= (setq clevel (car (cdr info))) level) 
+       (<= (setq clevel (gnus-info-level info)) level) 
        (>= clevel lowest)              ; Is inside the level we want.
        (or all
           (eq unread t)
           (> unread 0)
-          (cdr (assq 'tick (nth 3 info)))) ; Has right readedness.
+          (cdr (assq 'tick (gnus-info-marks info)))) ; Has right readedness.
        (progn
         ;; So we find out what topic this group belongs to.  First we
         ;; check the group parameters.
-        (setq gtopic (cdr (assq 'topic (nth 5 info))))
+        (setq gtopic (cdr (assq 'topic (gnus-info-params info))))
         ;; On match, we add it.
         (and (stringp gtopic) 
              (or (not topic)
@@ -192,13 +196,13 @@ If TOPIC, just find the groups in that topic."
   "Remove the current topic."
   (let ((topic (gnus-group-topic-name))
        buffer-read-only)
-    (if (not topic) 
-       ()
+    (when topic
       (setq gnus-topics-not-listed (cons topic gnus-topics-not-listed))
       (forward-line 1)
-      (delete-region (point) 
-                    (or (next-single-property-change (point) 'gnus-topic)
-                        (point-max))))))
+      (unless (gnus-group-topic-name)
+       (delete-region (point) 
+                      (or (next-single-property-change (point) 'gnus-topic)
+                          (point-max)))))))
 
 (defun gnus-topic-insert-topic (topic)
   "Insert TOPIC."
@@ -226,8 +230,18 @@ If TOPIC, just find the groups in that topic."
    (list current-prefix-arg
         (completing-read "Add to topic: " gnus-topic-names)))
   (let ((groups (gnus-group-process-prefix n)))
-    (mapcar (lambda (g) (gnus-group-add-parameter g (cons 'topic topic)))
+    (mapcar (lambda (g) 
+             (gnus-group-remove-mark g)
+             (gnus-group-add-parameter g (cons 'topic topic)))
            groups)
     (gnus-group-position-point)))
 
+(defun gnus-topic-toggle-topic ()
+  "Toggle between a flat group buffer and a topic display."
+  (interactive)
+  (if (eq gnus-group-prepare-function 'gnus-group-prepare-topics)
+      (setq gnus-group-prepare-function 'gnus-group-prepare-flat)
+    (setq gnus-group-prepare-function 'gnus-group-prepare-topics))
+  (gnus-group-list-groups))
+
 ;;; gnus-topic.el ends here
index 3b31e44..70cf023 100644 (file)
@@ -727,8 +727,12 @@ The headers will be included in the sequence they are matched.")
              (put-text-property (point-min) (point-max) 'intangible nil))
            (goto-char (point-min))
            (re-search-forward "\n\n")
+           ;; Quote all lines that begin with a dash.
+           (save-excursion
+             (while (re-search-forward "^-" nil t)
+               (replace-match "- -")))
            (setq body (buffer-substring (1- (point)) (point-max)))
-           (narrow-to-region 1 (point))
+           (narrow-to-region (point-min) (point))
            (if (not (setq headers gnus-uu-digest-headers))
                (setq sorthead (buffer-substring (point-min) (point-max)))
              (while headers
index 84ed809..e575d0b 100644 (file)
 ;(defvar gnus-signature-face 'italic
 ;  "Face used for signature.")
 
+(defvar gnus-button-url-regexp "\\b\\(s?https?\\|ftp\\|file\\|gopher\\|news\\|telnet\\|wais\\|mailto\\):\\(//[-a-zA-Z0-9_.]+:[0-9]*\\)?[-a-zA-Z0-9_=?#$@~`%&*+|\\/.,]*[-a-zA-Z0-9_=#$@~`%&*+|\\/]"
+  "*Regular expression matching Urls")
+
 (defvar gnus-button-alist 
-  '(("in\\( +article\\)? +\\(<\\([^\n @<>]+@[^\n @<>]+\\)>\\)" 2 
-     (assq (count-lines (point-min) (match-end 0)) 
-          gnus-cite-attribution-alist)
+  `(("\\bin\\( +article\\)? +\\(<\\([^\n @<>]+@[^\n @<>]+\\)>\\)" 2 
+     (let ((lines (count-lines (point-min) (match-end 0))))
+       (or (assq lines gnus-cite-attribution-alist)
+          (assq (1+ lines) gnus-cite-attribution-alist)))
      gnus-button-message-id 3)
     ;; This is how URLs _should_ be embedded in text...
     ("<URL:\\([^\n\r>]*\\)>" 0 t gnus-button-url 1)
     ;; Next regexp stolen from highlight-headers.el.
     ;; Modified by Vladimir Alexiev.
-    ("\\b\\(s?https?\\|ftp\\|file\\|gopher\\|news\\|telnet\\|wais\\|mailto\\):\\(//[-a-zA-Z0-9_.]+:[0-9]*\\)?[-a-zA-Z0-9_=?#$@~`%&*+|\\/.,]*[-a-zA-Z0-9_=#$@~`%&*+|\\/]" 0 t gnus-button-url 0))
+    (,gnus-button-url-regexp 0 t gnus-button-url 0))
   "Alist of regexps matching buttons in article bodies.
 
 Each entry has the form (REGEXP BUTTON FORM CALLBACK PAR...), where
@@ -234,10 +238,11 @@ CALLBACK can also be a variable, in that case the value of that
 variable it the real callback function.")
 
 (defvar gnus-header-button-alist 
-  '(("^\\(References\\|Message-ID\\):" "<[^>]+>" 0 t gnus-button-message-id 0)
+  `(("^\\(References\\|Message-ID\\):" "<[^>]+>" 0 t gnus-button-message-id 0)
     ("^\\(From\\|Reply-To\\): " ": *\\(.+\\)$" 1 t gnus-button-reply 0)
     ("^\\(Cc\\|To\\):" "[^ \t\n<>,()\"]+@[^ \t\n<>,()\"]+" 
-     0 t gnus-button-mailto 0))
+     0 t gnus-button-mailto 0)
+    ("^X-[Uu][Rr][Ll]:" ,gnus-button-url-regexp 0 t gnus-button-url 0))
   "Alist of headers and regexps to match buttons in article heads.
 
 This alist is very similar to `gnus-button-alist', except that each
@@ -294,7 +299,7 @@ HEADER is a regexp to match a header.  For a fuller explanation, see
       '("Group"
        ["Read" gnus-group-read-group t]
        ["Select" gnus-group-select-group t]
-       ["See old articles" gnus-group-select-group-all t]
+       ["See old articles" (gnus-group-select-group 'all) :keys "C-u SPC" ]
        ["Catch up" gnus-group-catchup-current t]
        ["Catch up all articles" gnus-group-catchup-current-all t]
        ["Check for new articles" gnus-group-get-new-news-this-group t]
@@ -382,6 +387,8 @@ HEADER is a regexp to match a header.  For a fuller explanation, see
      (run-hooks 'gnus-group-menu-hook)
      )))
 
+(defvar gnus-server-mode-map)
+
 ;; Server mode
 (defun gnus-server-make-menu-bar ()
   (gnus-visual-turn-off-edit-menu 'server)
@@ -983,9 +990,9 @@ If nil, the user will be asked for a duration.")
     ("prev" . gnus-group-prev-unread-group)
     ("read" . gnus-group-read-group)
     ("select" . gnus-group-select-group)
-    ("catch up" . gnus-group-catchup-current)
-    ("new news" . gnus-group-get-new-news-this-group)
-    ("toggle sub" . gnus-group-unsubscribe-current-group)
+    ("catch-up" . gnus-group-catchup-current)
+    ("new-news" . gnus-group-get-new-news-this-group)
+    ("toggle-sub" . gnus-group-unsubscribe-current-group)
     ("subscribe" . gnus-group-unsubscribe-group)
     ("kill" . gnus-group-kill-group)
     ("yank" . gnus-group-yank-group)
@@ -999,7 +1006,7 @@ If nil, the user will be asked for a duration.")
     ("post" . gnus-group-post-news)
     ("mail" . gnus-group-mail)
     ("rescan" . gnus-group-get-new-news)
-    ("browse foreign" . gnus-group-browse-foreign)
+    ("browse-foreign" . gnus-group-browse-foreign)
     ("exit" . gnus-group-exit)))
 
 (defvar gnus-carpal-summary-buffer-buttons
@@ -1010,15 +1017,15 @@ If nil, the user will be asked for a duration.")
     ("expirable" . gnus-summary-mark-as-expirable)
     "move"
     ("scroll" . gnus-summary-next-page)
-    ("next unread" . gnus-summary-next-unread-article)
-    ("prev unread" . gnus-summary-prev-unread-article)
+    ("next-unread" . gnus-summary-next-unread-article)
+    ("prev-unread" . gnus-summary-prev-unread-article)
     ("first" . gnus-summary-first-unread-article)
     ("best" . gnus-summary-best-unread-article)
     "article"
     ("headers" . gnus-summary-toggle-header)
     ("uudecode" . gnus-uu-decode-uu)
-    ("enter digest" . gnus-summary-enter-digest-group)
-    ("fetch parent" . gnus-summary-refer-parent-article)
+    ("enter-digest" . gnus-summary-enter-digest-group)
+    ("fetch-parent" . gnus-summary-refer-parent-article)
     "mail"
     ("move" . gnus-summary-move-article)
     ("copy" . gnus-summary-copy-article)
@@ -1034,7 +1041,7 @@ If nil, the user will be asked for a duration.")
     ("cancel" . gnus-summary-cancel-article)
     "misc"
     ("exit" . gnus-summary-exit)
-    ("fed up" . gnus-summary-catchup-and-goto-next-group)))
+    ("fed-up" . gnus-summary-catchup-and-goto-next-group)))
 
 (defvar gnus-carpal-server-buffer-buttons 
   '(("add" . gnus-server-add-server)
@@ -1309,33 +1316,38 @@ It does this by making everything after `gnus-signature-separator' invisible."
 \"External references\" are things like Message-IDs and URLs, as
 specified by `gnus-button-alist'."
   (interactive (list 'force))
-  (if (eq gnus-button-last gnus-button-alist)
-      ()
+  (unless (eq gnus-button-last gnus-button-alist)
     (setq gnus-button-regexp (mapconcat 'car gnus-button-alist  "\\|")
          gnus-button-last gnus-button-alist))
   (save-excursion
     (set-buffer gnus-article-buffer)
+    ;; We parse citations first to be able to match attributions.
     (gnus-cite-parse-maybe force)
     (let ((buffer-read-only nil)
          (inhibit-point-motion-hooks t)
          (case-fold-search t))
       (goto-char (point-min))
-      (or (search-forward "\n\n" nil t)
-         (goto-char (point-max)))
+      ;; We skip the headers.
+      (unless (search-forward "\n\n" nil t)
+       (goto-char (point-max)))
+      ;; Then we search forward using that big regexp we have.
       (while (re-search-forward gnus-button-regexp nil t)
        (goto-char (match-beginning 0))
        (let* ((from (point))
-              (entry (gnus-button-entry))
+              (current (match-end 0))
+              (entry (gnus-button-entry)) ; Find sub-regexp.
               (start (and entry (match-beginning (nth 1 entry))))
               (end (and entry (match-end (nth 1 entry))))
               (form (nth 2 entry)))
-         (if (not entry)
-             ()
-           (goto-char (match-end 0))
-           (if (eval form)
-               (gnus-article-add-button 
-                start end 'gnus-button-push
-                (set-marker (make-marker) from)))))))))
+         ;; We now have a valid entry.
+         (when entry
+           (goto-char current)
+           (when (eval form)
+             ;; That optional form returned non-nil, so we add the
+             ;; button. 
+             (gnus-article-add-button 
+              start end 'gnus-button-push 
+              (set-marker (make-marker) from)))))))))
 
 ;; Add buttons to the head of an article.
 (defun gnus-article-add-buttons-to-head ()
index 1c598b6..65b94f4 100644 (file)
@@ -102,7 +102,7 @@ save those articles instead."
                            (and default-name
                                 (file-name-directory default-name))))
     (gnus-make-directory (file-name-directory folder))
-    (set-buffer gnus-article-buffer)
+    (set-buffer gnus-original-article-buffer)
     (save-excursion
       (save-restriction
        (widen)
@@ -111,7 +111,7 @@ save those articles instead."
          (kill-buffer vm-folder))))
     ;; Remember the directory name to save articles.
     (setq gnus-newsgroup-last-mail folder)))
-  
+
 (defun gnus-vm-mail-setup (to subject in-reply-to cc replybuffer actions)
   (gnus-sendmail-mail-setup to subject in-reply-to cc replybuffer actions)
   )
index e65bb27..cf172f6 100644 (file)
@@ -24,7 +24,6 @@
 
 ;;; Code:
 
-(require 'mode-motion)
 (require 'text-props)
 
 (defvar gnus-xmas-glyph-directory nil
@@ -83,10 +82,6 @@ automatically.")
 (defvar gnus-mouse-2)
 (defvar standard-display-table)
 
-(defun gnus-xmas-install-mouse-tracker ()
-  (or (featurep 'mode-motion+)
-      (add-hook 'mode-motion-hook 'mode-motion-highlight-line)))
-
 (defun gnus-xmas-set-text-properties (start end props &optional buffer)
   "You should NEVER use this function.  It is ideologically blasphemous.
 It is provided only to ease porting of broken FSF Emacs programs."
@@ -129,8 +124,8 @@ It is provided only to ease porting of broken FSF Emacs programs."
      ;; possible valid number, or the second line from the top,
      ;; whichever is the least.
      (set-window-start
-      window (min bottom (save-excursion (forward-line (- top)) 
-                                        (point)))))))
+      window (min bottom (save-excursion
+                          (forward-line (- top)) (point)))))))
 
 (defun gnus-xmas-group-insert-group-line-info (group)
   (let ((entry (gnus-gethash group gnus-newsrc-hashtb)) 
@@ -140,7 +135,8 @@ It is provided only to ease porting of broken FSF Emacs programs."
        (progn
          (setq info (nth 2 entry))
          (gnus-group-insert-group-line 
-          nil group (nth 1 info) (nth 3 info) (car entry) (nth 4 info)))
+          nil group (gnus-info-group info) (gnus-info-marks info)
+          (car entry) (gnus-info-method info)))
       (setq active (gnus-gethash group gnus-active-hashtb))
          
       (gnus-group-insert-group-line 
@@ -227,16 +223,14 @@ call it with the value of the `gnus-data' text property."
 (defun gnus-xmas-group-menu-add ()
   (easy-menu-add gnus-group-reading-menu)
   (easy-menu-add gnus-group-group-menu)
-  (easy-menu-add gnus-group-misc-menu)
-  (gnus-xmas-install-mouse-tracker))
+  (easy-menu-add gnus-group-misc-menu))
 
 (defun gnus-xmas-summary-menu-add ()
   (easy-menu-add gnus-summary-article-menu)
   (easy-menu-add gnus-summary-thread-menu)
   (easy-menu-add gnus-summary-misc-menu)
   (easy-menu-add gnus-summary-post-menu)
-  (easy-menu-add gnus-summary-kill-menu)
-  (gnus-xmas-install-mouse-tracker)) 
+  (easy-menu-add gnus-summary-kill-menu)) 
 
 (defun gnus-xmas-article-menu-add ()
   (easy-menu-add gnus-article-article-menu)
index cee8f1b..514bac7 100644 (file)
@@ -24,7 +24,7 @@
 ;;; Commentary:
 
 ;; Although Gnus looks suspiciously like GNUS, it isn't quite the same
-;; beast. Most internal structures have been changed. If you have
+;; beast.  Most internal structures have been changed.  If you have
 ;; written packages that depend on any of the hash tables,
 ;; `gnus-newsrc-alist', `gnus-killed-assoc', marked lists, the .newsrc
 ;; buffer, or internal knowledge of the `nntp-header-' macros, or
@@ -41,7 +41,7 @@
 
 (eval-when-compile (require 'cl))
 
-;; Site dependent variables. These variables should be defined in
+;; Site dependent variables.  These variables should be defined in
 ;; paths.el.
 
 (defvar gnus-default-nntp-server nil
@@ -66,7 +66,7 @@ no need to set this variable.")
   "String with a description of what organization (if any) the user belongs to.
 The ORGANIZATION environment variable is used instead if it is defined.
 If this variable contains a function, this function will be called
-with the current newsgroup name as the argument. The function should
+with the current newsgroup name as the argument.  The function should
 return a string.
 
 In any case, if the string (either in the variable, in the environment
@@ -89,7 +89,7 @@ If stringp, use this; if non-nil, use no host name (user name only).")
 ;; Don't touch this variable.
 (defvar gnus-nntp-service "nntp"
   "*NNTP service name (\"nntp\" or 119).
-This is an obsolete variable, which is scarcely used. If you use an
+This is an obsolete variable, which is scarcely used.  If you use an
 nntp server for your newsgroup and want to change the port number
 used to 899, you would say something along these lines:
 
@@ -160,7 +160,7 @@ The value must be a valid method as discussed in the documentation of
 (defvar gnus-refer-article-method nil
   "*Preferred method for fetching an article by Message-ID.
 If you are reading news from the local spool (with nnspool), fetching
-articles by Message-ID is painfully slow. By setting this method to an
+articles by Message-ID is painfully slow.  By setting this method to an
 nntp method, you might get acceptable results.
 
 The value of this variable must be a valid select method as discussed
@@ -183,7 +183,7 @@ non-numeric prefix - `C-u M-x gnus', in short.")
 
 (defvar gnus-nntp-server nil
   "*The name of the host running the NNTP server.
-This variable is semi-obsolete. Use the `gnus-select-method'
+This variable is semi-obsolete.  Use the `gnus-select-method'
 variable instead.")
 
 (defvar gnus-startup-file "~/.newsrc"
@@ -248,7 +248,7 @@ started; it'll just use the normal newsgroups subscription methods.")
 (defvar gnus-use-cross-reference t
   "*Non-nil means that cross referenced articles will be marked as read.
 If nil, ignore cross references.  If t, mark articles as read in
-subscribed newsgroups. If neither t nor nil, mark as read in all
+subscribed newsgroups.  If neither t nor nil, mark as read in all
 newsgroups.") 
 
 (defvar gnus-use-dribble-file t
@@ -264,60 +264,6 @@ saved will be used.")
 (defvar gnus-asynchronous nil
   "*If non-nil, Gnus will supply backends with data needed for async article fetching.")
 
-(defvar gnus-score-file-single-match-alist nil
-  "*Alist mapping regexps to lists of score files.
-Each element of this alist should be of the form
-       (\"REGEXP\" [ \"SCORE-FILE-1\" ] [ \"SCORE-FILE-2\" ] ... )
-
-If the name of a group is matched by REGEXP, the corresponding scorefiles
-will be used for that group.
-The first match found is used, subsequent matching entries are ignored (to
-use multiple matches, see gnus-score-file-multiple-match-alist).
-
-These score files are loaded in addition to any files returned by
-gnus-score-find-score-files-function (which see).")
-
-(defvar gnus-score-file-multiple-match-alist nil
-  "*Alist mapping regexps to lists of score files.
-Each element of this alist should be of the form
-       (\"REGEXP\" [ \"SCORE-FILE-1\" ] [ \"SCORE-FILE-2\" ] ... )
-
-If the name of a group is matched by REGEXP, the corresponding scorefiles
-will be used for that group.
-If multiple REGEXPs match a group, the score files corresponding to each
-match will be used (for only one match to be used, see
-gnus-score-file-single-match-alist).
-
-These score files are loaded in addition to any files returned by
-gnus-score-find-score-files-function (which see).")
-
-(defvar gnus-score-file-suffix "SCORE"
-  "*Suffix of the score files.")
-
-(defvar gnus-adaptive-file-suffix "ADAPT"
-  "*Suffix of the adaptive score files.")
-
-(defvar gnus-score-find-score-files-function 'gnus-score-find-bnews
-  "*Function used to find score files.
-The function will be called with the group name as the argument, and
-should return a list of score files to apply to that group.  The score
-files do not actually have to exist.
-
-Predefined values are:
-
-gnus-score-find-single: Only apply the group's own score file.
-gnus-score-find-hierarchical: Also apply score files from parent groups.
-gnus-score-find-bnews: Apply score files whose names matches.
-
-See the documentation to these functions for more information.
-
-This variable can also be a list of functions to be called.  Each
-function should either return a list of score files, or a list of
-score alists.")
-
-(defvar gnus-score-interactive-default-score 1000
-  "*Scoring commands will raise/lower the score with this number as the default.")
-
 (defvar gnus-large-newsgroup 200
   "*The number of articles which indicates a large newsgroup.
 If the number of articles in a newsgroup is greater than this value,
@@ -458,7 +404,7 @@ jabbering all the time.")
 (defvar gnus-keep-same-level nil
   "*Non-nil means that the next newsgroup after the current will be on the same level.
 When you type, for instance, `n' after reading the last article in the
-current newsgroup, you will go to the next newsgroup. If this variable
+current newsgroup, you will go to the next newsgroup.  If this variable
 is nil, the next newsgroup will be the next from the group
 buffer. 
 If this variable is non-nil, Gnus will either put you in the
@@ -472,7 +418,7 @@ with the best level.")
   "*nil means that Gnus won't gather loose threads.
 If the root of a thread has expired or been read in a previous
 session, the information necessary to build a complete thread has been
-lost. Instead of having many small sub-threads from this original thread
+lost.  Instead of having many small sub-threads from this original thread
 scattered all over the summary buffer, Gnus can gather them. 
 
 If non-nil, Gnus will try to gather all loose sub-threads from an
@@ -523,11 +469,11 @@ This variable will only be used if the value of
 (defvar gnus-check-new-newsgroups t
   "*Non-nil means that Gnus will add new newsgroups at startup.
 If this variable is `ask-server', Gnus will ask the server for new
-groups since the last time it checked. This means that the killed list
+groups since the last time it checked.  This means that the killed list
 is no longer necessary, so you could set `gnus-save-killed-list' to
 nil. 
 
-A variant is to have this variable be a list of select methods. Gnus
+A variant is to have this variable be a list of select methods.  Gnus
 will then use the `ask-server' method on all these select methods to
 query for new groups from all those servers.
 
@@ -580,14 +526,14 @@ less than this variable, are subscribed.")
 
 (defvar gnus-activate-foreign-newsgroups 4
   "*If nil, Gnus will not check foreign newsgroups at startup.
-If it is non-nil, it should be a number between one and nine. Foreign
+If it is non-nil, it should be a number between one and nine.  Foreign
 newsgroups that have a level lower or equal to this number will be
-activated on startup. For instance, if you want to active all
+activated on startup.  For instance, if you want to active all
 subscribed newsgroups, but not the rest, you'd set this variable to 
 `gnus-level-subscribed'.
 
 If you subscribe to lots of newsgroups from different servers, startup
-might take a while. By setting this variable to nil, you'll save time,
+might take a while.  By setting this variable to nil, you'll save time,
 but you won't be told how many unread articles there are in the
 groups.")
 
@@ -604,7 +550,7 @@ exit.")
 This will save both time (when starting and quitting) and space (both
 memory and disk), but it will also mean that Gnus has no record of
 which groups are new and which are old, so the automatic new
-newsgroups subscription methods become meaningless. You should always
+newsgroups subscription methods become meaningless.  You should always
 set `gnus-check-new-newsgroups' to `ask-server' or nil if you set this
 variable to nil.")
 
@@ -711,7 +657,7 @@ thus making them effectively non-existent.")
   "*All headers that match this regexp will be hidden.
 If `gnus-visible-headers' is non-nil, this variable will be ignored.")
 
-(defvar gnus-visible-headers "^From:\\|^Newsgroups:\\|^Subject:\\|^Date:\\|^Followup-To:\\|^Reply-To:\\|^Organization:\\|^Summary:\\|^Keywords:\\|^To:\\|^Cc:"
+(defvar gnus-visible-headers "^From:\\|^Newsgroups:\\|^Subject:\\|^Date:\\|^Followup-To:\\|^Reply-To:\\|^Organization:\\|^Summary:\\|^Keywords:\\|^To:\\|^Cc:\\|^Posted-To:\\|^Mail-Copy-To:"
   "*All headers that do not match this regexp will be hidden.
 If this variable is non-nil, `gnus-ignored-headers' will be ignored.")
 
@@ -745,7 +691,11 @@ will be kept while the rest will be deleted before saving.")
   "*If non-nil, extend newsgroup forward and backward when requested.")
 
 (defvar gnus-auto-select-first t
-  "*If non-nil, select the first unread article when entering a group.
+  "*If nil, don't select the first unread article when entering a group.
+If this variable is `best', select the highest-scored unread article
+in the group.  If neither nil nor `best', select the first unread
+article.
+
 If you want to prevent automatic selection of the first unread article
 in some newsgroups, set the variable to nil in
 `gnus-select-group-hook'.") 
@@ -901,8 +851,9 @@ hierarchy in its entirety.")
   "*Function used for sorting the group buffer.
 This function will be called with group info entries as the arguments
 for the groups to be sorted.  Pre-made functions include
-`gnus-group-sort-by-alphabet', `gnus-group-sort-by-unread' and
-`gnus-group-sort-by-level'.
+`gnus-group-sort-by-alphabet', `gnus-group-sort-by-unread',
+`gnus-group-sort-by-level', `gnus-group-sort-by-score', and
+`gnus-group-sort-by-rank'.  
 
 This variable can also be a list of sorting functions.  In that case,
 the most significant sort function should be the last function in the
@@ -924,6 +875,8 @@ list.")
   "*Mark used for expirable articles.")
 (defvar gnus-killed-mark ?K
   "*Mark used for killed articles.")
+(defvar gnus-souped-mark ?F
+  "*Mark used for killed articles.")
 (defvar gnus-kill-file-mark ?X
   "*Mark used for articles killed by kill files.")
 (defvar gnus-low-score-mark ?Y
@@ -984,19 +937,19 @@ with some simple extensions.
 %O    Moderated group (string, \"(m)\" or \"\")
 %n    Select from where (string)
 %z    A string that look like `<%s:%n>' if a foreign select method is used
-%u    User defined specifier. The next character in the format string should
+%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
-      current header as argument. The function should return a string, which
+      where X is the letter following %u.  The function will be passed the
+      current header as argument.  The function should return a string, which
       will be inserted into the buffer just like information from any other
       group specifier.
 
 Text between %( and %) will be highlighted with `gnus-mouse-face' when
 the mouse point move inside the area.  There can only be one such area.
 
-Note that this format specification is not always respected. For
+Note that this format specification is not always respected.  For
 reasons of efficiency, when listing killed groups, this specification
-is ignored altogether. If the spec is changed considerably, your
+is ignored altogether.  If the spec is changed considerably, your
 output may end up looking strange when listing both alive and killed
 groups.
 
@@ -1029,8 +982,8 @@ with some simple extensions.
 %I   Indentation based on thread level (a string of spaces)
 %T   A string with two possible values: 80 spaces if the article
      is on thread level two or larger and 0 spaces on level one
-%R   \"R\" if this article has been replied to, \" \" otherwise (character)
-%U   Status of this article (character, \"D\", \"K\", \"-\" or \" \")
+%R   \"A\" if this article has been replied to, \" \" otherwise (character)
+%U   Status of this article (character, \"R\", \"K\", \"-\" or \" \")
 %[   Opening bracket (character, \"[\" or \"<\")
 %]   Closing bracket (character, \"]\" or \">\")
 %>   Spaces of length thread-level (string)
@@ -1039,10 +992,10 @@ 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).
-%u   User defined specifier. The next character in the format string should
+%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
-     current header as argument. The function should return a string, which
+     where X is the letter following %u.  The function will be passed the
+     current header as argument.  The function should return a string, which
      will be inserted into the summary just like information from any other
      summary specifier.
 
@@ -1051,9 +1004,9 @@ when the mouse point is placed inside the area.  There can only be one
 such area.
 
 The %U (status), %R (replied) and %z (zcore) specs have to be handled
-with care. For reasons of efficiency, Gnus will compute what column
-these characters will end up in, and \"hard-code\" that. This means that
-it is illegal to have these specs after a variable-length spec. Well,
+with care.  For reasons of efficiency, Gnus will compute what column
+these characters will end up in, and \"hard-code\" that.  This means that
+it is illegal to have these specs after a variable-length spec.  Well,
 you might not be arrested, but your summary buffer will look strange,
 which is bad enough.
 
@@ -1095,15 +1048,15 @@ with some simple extensions.
     ("nnfolder" mail respool))
   "An alist of valid select methods.
 The first element of each list lists should be a string with the name
-of the select method. The other elements may be be the category of
+of the select method.  The other elements may be be the category of
 this method (ie. `post', `mail', `none' or whatever) or other
 properties that this method has (like being respoolable).
 If you implement a new select method, all you should have to change is
-this variable. I think.")
+this variable.  I think.")
 
 (defvar gnus-updated-mode-lines '(group article summary)
   "*List of buffers that should update their mode lines.
-The list may contain the symbols `group', `article' and `summary'. If
+The list may contain the symbols `group', `article' and `summary'.  If
 the corresponding symbol is present, Gnus will keep that mode line
 updated with information that may be pertinent. 
 If this variable is nil, screen refresh may be quicker.")
@@ -1217,8 +1170,8 @@ This hook is called after Gnus is connected to the NNTP server.")
   "*A function that is called to generate the group buffer.
 The function is called with three arguments: The first is a number;
 all group with a level less or equal to that number should be listed,
-if the second is non-nil, empty groups should also be displayed. If
-the third is non-nil, it is a number. No groups with a level lower
+if the second is non-nil, empty groups should also be displayed.  If
+the third is non-nil, it is a number.  No groups with a level lower
 than this number should be displayed.
 
 The only current function implemented are `gnus-group-prepare-flat'
@@ -1234,6 +1187,11 @@ If you want to modify the group buffer, you can use this hook.")
   "*A hook called after the summary buffer has been generated.
 If you want to modify the summary buffer, you can use this hook.")
 
+(defvar gnus-summary-generate-hook nil
+  "*A hook run just before generating the summary buffer.
+This hook is commonly used to customize threading variables and the
+like.")
+
 (defvar gnus-article-prepare-hook nil
   "*A hook called after an article has been prepared in the article buffer.
 If you want to run a special decoding program like nkf, use this hook.")
@@ -1241,7 +1199,7 @@ If you want to run a special decoding program like nkf, use this hook.")
 ;(defvar gnus-article-display-hook nil
 ;  "*A hook called after the article is displayed in the article buffer.
 ;The hook is designed to change the contents of the article
-;buffer. Typical functions that this hook may contain are
+;buffer.  Typical functions that this hook may contain are
 ;`gnus-article-hide-headers' (hide selected headers),
 ;`gnus-article-maybe-highlight' (perform fancy article highlighting), 
 ;`gnus-article-hide-signature' (hide signature) and
@@ -1254,7 +1212,7 @@ If you want to run a special decoding program like nkf, use this hook.")
   "{ echo '/* Width=48, Height=48 */'; uncompface; } | icontopbm | xv -quit -"
   "String or function to be executed to display an X-Face header.
 If it is a string, the command will be executed in a sub-shell
-asynchronously. The compressed face will be piped to this command.") 
+asynchronously.  The compressed face will be piped to this command.") 
 
 (defvar gnus-article-x-face-too-ugly nil
   "Regexp matching posters whose face shouldn't be shown automatically.")
@@ -1288,7 +1246,7 @@ This hook is intended to apply a kill file to the selected newsgroup.
 The function `gnus-apply-kill-file' is called by default.
 
 Since a general kill file is too heavy to use only for a few
-newsgroups, I recommend you to use a lighter hook function. For
+newsgroups, I recommend you to use a lighter hook function.  For
 example, if you'd like to apply a kill file to articles which contains
 a string `rmgroup' in subject in newsgroup `control', you can use the
 following hook:
@@ -1368,8 +1326,6 @@ automatically when it is selected.")
 (defvar gnus-nocem-hashtb nil)
 
 (defvar gnus-current-score-file nil)
-(defvar gnus-internal-global-score-files nil)
-(defvar gnus-score-file-list nil)
 (defvar gnus-scores-exclude-files nil)
 
 (defvar gnus-opened-servers nil)
@@ -1477,7 +1433,7 @@ 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.12"
+(defconst gnus-version "September Gnus v0.13"
   "Version number for this version of Gnus.")
 
 (defvar gnus-info-nodes
@@ -1486,9 +1442,6 @@ variable (string, integer, character, etc).")
     (gnus-article-mode         "(gnus)The Article Buffer"))
   "Assoc list of major modes and related Info nodes.")
 
-(defvar gnus-documentation-group-file "~/dgnus/lisp/doc.txt"
-  "The location of the Gnus documentation group.")
-
 (defvar gnus-group-buffer "*Group*")
 (defvar gnus-summary-buffer "*Summary*")
 (defvar gnus-article-buffer "*Article*")
@@ -1627,7 +1580,7 @@ gnus-newsrc-hashtb should be kept so that both hold the same information.")
 
 (defvar gnus-newsgroup-threads nil)
 
-(defvar gnus-newsgroup-threads nil)
+(defvar gnus-newsgroup-prepared nil)
 
 (defvar gnus-newsgroup-ancient nil
   "List of `gnus-fetch-old-headers' articles in the current newsgroup.")
@@ -1736,7 +1689,7 @@ gnus-newsrc-hashtb should be kept so that both hold the same information.")
     (summary-dummy . "*  :                          : %S\n")
     (summary . "%U%R%z%I%(%[%4L: %-20,20n%]%) %s\n")))
 
-;;; Phew. All that gruft is over, fortunately.  Perhaps one should
+;;; Phew.  All that gruft is over, fortunately.  Perhaps one should
 ;;; hand-optimize the functions above, though.
 
 (defvar gnus-summary-mark-positions nil)
@@ -1762,6 +1715,7 @@ gnus-newsrc-hashtb should be kept so that both hold the same information.")
     gnus-newsgroup-processable gnus-newsgroup-killed
     gnus-newsgroup-bookmarks gnus-newsgroup-dormant
     gnus-newsgroup-headers gnus-newsgroup-threads
+    gnus-newsgroup-prepared
     gnus-current-article gnus-current-headers gnus-have-all-headers
     gnus-last-article gnus-article-internal-prepare-hook
     gnus-newsgroup-dependencies gnus-newsgroup-selected-overlay
@@ -1802,188 +1756,118 @@ Thank you for your help in stamping out bugs.
 ;; Define some autoload functions Gnus might use.
 (eval-and-compile
 
-  ;; Various 
-  (autoload 'metamail-buffer "metamail")
-  (autoload 'Info-goto-node "info")
-  (autoload 'hexl-hex-string-to-integer "hexl")
-  (autoload 'pp "pp")
-  (autoload 'pp-to-string "pp")
-  (autoload 'pp-eval-expression "pp")
-  (autoload 'mail-extract-address-components "mail-extr")
-
-  (autoload 'nnmail-split-fancy "nnmail")
-  (autoload 'nnmail-article-group "nnmail")
-  (autoload 'nnvirtual-catchup-group "nnvirtual")
-
-  ;; timezone
-  (autoload 'timezone-make-date-arpa-standard "timezone")
-  (autoload 'timezone-fix-time "timezone")
-  (autoload 'timezone-make-sortable-date "timezone")
-  (autoload 'timezone-make-time-string "timezone")
-
-  ;; rmail & friends
-  (autoload 'mail-position-on-field "sendmail")
-  (autoload 'mail-setup "sendmail")
-  (autoload 'rmail-output "rmailout")
-  (autoload 'news-mail-other-window "rnewspost")
-  (autoload 'news-reply-yank-original "rnewspost")
-  (autoload 'news-caesar-buffer-body "rnewspost")
-  (autoload 'rmail-insert-rmail-file-header "rmail")
-  (autoload 'rmail-count-new-messages "rmail")
-  (autoload 'rmail-show-message "rmail")
-
-  ;; gnus-soup
-  (autoload 'gnus-group-brew-soup "gnus-soup" nil t)
-  (autoload 'gnus-brew-soup "gnus-soup" nil t)
-  (autoload 'gnus-soup-add-article "gnus-soup" nil t)
-  (autoload 'gnus-soup-send-replies "gnus-soup" nil t)
-  (autoload 'gnus-soup-save-areas "gnus-soup" nil t)
-  (autoload 'gnus-soup-pack-packet "gnus-soup" nil t)
-  (autoload 'nnsoup-pack-replies "nnsoup" nil t)
-
-  ;; gnus-mh
-  (autoload 'gnus-mh-mail-setup "gnus-mh")
-  (autoload 'gnus-summary-save-in-folder "gnus-mh" nil t)
-  (autoload 'gnus-summary-save-article-folder "gnus-mh")
-  (autoload 'gnus-Folder-save-name "gnus-mh")
-  (autoload 'gnus-folder-save-name "gnus-mh")
-
-  ;; gnus-vis misc
-  (autoload 'gnus-group-make-menu-bar "gnus-vis")
-  (autoload 'gnus-summary-make-menu-bar "gnus-vis")
-  (autoload 'gnus-server-make-menu-bar "gnus-vis")
-  (autoload 'gnus-article-make-menu-bar "gnus-vis")
-  (autoload 'gnus-browse-make-menu-bar "gnus-vis")
-  (autoload 'gnus-highlight-selected-summary "gnus-vis")
-  (autoload 'gnus-summary-highlight-line "gnus-vis")
-  (autoload 'gnus-carpal-setup-buffer "gnus-vis")
-
-  ;; gnus-demon
-  (autoload 'gnus-demon-add-nocem "gnus-demon")
-  (autoload 'gnus-demon-add-scanmail "gnus-demon")
-  (autoload 'gnus-demon-add-disconnection "gnus-demon")
-  (autoload 'gnus-demon-add-handler "gnus-demon")
-  (autoload 'gnus-demon-remove-handler "gnus-demon")
-  (autoload 'gnus-demon-init "gnus-demon" nil t)
-  (autoload 'gnus-demon-cancel "gnus-demon" nil t)
-
-  ;; gnus-nocem
-  (autoload 'gnus-nocem-scan-groups "gnus-nocem")
-  (autoload 'gnus-nocem-close "gnus-nocem")
-
-  ;; gnus-vis article
-  (autoload 'gnus-article-push-button "gnus-vis" nil t)
-  (autoload 'gnus-article-press-button "gnus-vis" nil t)
-  (autoload 'gnus-article-highlight "gnus-vis" nil t)
-  (autoload 'gnus-article-highlight-some "gnus-vis" nil t)
-  (autoload 'gnus-article-hide "gnus-vis" nil t)
-  (autoload 'gnus-article-hide-signature "gnus-vis" nil t)
-  (autoload 'gnus-article-highlight-headers "gnus-vis" nil t)
-  (autoload 'gnus-article-highlight-signature "gnus-vis" nil t)
-  (autoload 'gnus-article-add-buttons "gnus-vis" nil t)
-  (autoload 'gnus-article-add-buttons-to-head "gnus-vis" nil t)
-  (autoload 'gnus-article-next-button "gnus-vis" nil t)
-  (autoload 'gnus-article-add-button "gnus-vis")
-
-  ;; gnus-cite
-  (autoload 'gnus-article-highlight-citation "gnus-cite" nil t)
-  (autoload 'gnus-article-hide-citation-maybe "gnus-cite" nil t)
-  (autoload 'gnus-article-hide-citation "gnus-cite" nil t)
-
-  ;; gnus-kill
-  (autoload 'gnus-kill "gnus-kill")
-  (autoload 'gnus-apply-kill-file-internal "gnus-kill")
-  (autoload 'gnus-kill-file-edit-file "gnus-kill")
-  (autoload 'gnus-kill-file-raise-followups-to-author "gnus-kill")
-  (autoload 'gnus-execute "gnus-kill")
-  (autoload 'gnus-expunge "gnus-kill")
-
-  ;; gnus-cache
-  (autoload 'gnus-cache-possibly-enter-article "gnus-cache")
-  (autoload 'gnus-cache-save-buffers "gnus-cache")
-  (autoload 'gnus-cache-possibly-remove-articles "gnus-cache")
-  (autoload 'gnus-cache-request-article "gnus-cache")
-  (autoload 'gnus-cache-retrieve-headers "gnus-cache")
-  (autoload 'gnus-cache-possibly-alter-active "gnus-cache")
-  (autoload 'gnus-jog-cache "gnus-cache" nil t)
-  (autoload 'gnus-cache-enter-remove-article "gnus-cache")
-
-  ;; gnus-score
-  (autoload 'gnus-summary-increase-score "gnus-score" nil t)
-  (autoload 'gnus-summary-lower-score "gnus-score" nil t)
-  (autoload 'gnus-summary-score-map "gnus-score" nil nil 'keymap)
-  (autoload 'gnus-score-save "gnus-score")
-  (autoload 'gnus-score-headers "gnus-score")
-  (autoload 'gnus-current-score-file-nondirectory "gnus-score")
-  (autoload 'gnus-score-adaptive "gnus-score")
-  (autoload 'gnus-score-find-trace "gnus-score")
-  (autoload 'gnus-score-flush-cache "gnus-score" nil t)
-  (autoload 'gnus-score-close "gnus-score" nil t)
-
-  ;; gnus-edit
-  (autoload 'gnus-score-customize "gnus-edit" nil t)
-
-  ;; gnus-topic
-  (autoload 'gnus-topic-fold "gnus-topic")
-  (autoload 'gnus-group-prepare-topics "gnus-topic")
-  (autoload 'gnus-group-add-to-topic "gnus-topic" nil t)
-
-  ;; gnus-uu
-  (autoload 'gnus-uu-extract-map "gnus-uu" nil nil 'keymap)
-  (autoload 'gnus-uu-mark-map "gnus-uu" nil nil 'keymap)
-  (autoload 'gnus-uu-digest-mail-forward "gnus-uu" nil t)
-  (autoload 'gnus-uu-digest-post-forward "gnus-uu" nil t)
-  (autoload 'gnus-uu-mark-series "gnus-uu" nil t)
-  (autoload 'gnus-uu-mark-region "gnus-uu" nil t)
-  (autoload 'gnus-uu-mark-by-regexp "gnus-uu" nil t)
-  (autoload 'gnus-uu-mark-all "gnus-uu" nil t)
-  (autoload 'gnus-uu-mark-sparse "gnus-uu" nil t)
-  (autoload 'gnus-uu-mark-thread "gnus-uu" nil t)
-  (autoload 'gnus-uu-decode-uu "gnus-uu" nil t)
-  (autoload 'gnus-uu-decode-uu-and-save "gnus-uu" nil t)
-  (autoload 'gnus-uu-decode-unshar "gnus-uu" nil t)
-  (autoload 'gnus-uu-decode-unshar-and-save "gnus-uu" nil t)
-  (autoload 'gnus-uu-decode-save "gnus-uu" nil t)
-  (autoload 'gnus-uu-decode-binhex "gnus-uu" nil t)
-  (autoload 'gnus-uu-decode-uu-view "gnus-uu" nil t)
-  (autoload 'gnus-uu-decode-uu-and-save-view "gnus-uu" nil t)
-  (autoload 'gnus-uu-decode-unshar-view "gnus-uu" nil t)
-  (autoload 'gnus-uu-decode-unshar-and-save-view "gnus-uu" nil t)
-  (autoload 'gnus-uu-decode-save-view "gnus-uu" nil t)
-  (autoload 'gnus-uu-decode-binhex-view "gnus-uu" nil t)
-
-  ;; gnus-msg
-  (autoload 'gnus-summary-send-map "gnus-msg" nil nil 'keymap)
-  (autoload 'gnus-group-post-news "gnus-msg" nil t)
-  (autoload 'gnus-group-mail "gnus-msg" nil t)
-  (autoload 'gnus-summary-post-news "gnus-msg" nil t)
-  (autoload 'gnus-summary-followup "gnus-msg" nil t)
-  (autoload 'gnus-summary-followup-with-original "gnus-msg" nil t)
-  (autoload 'gnus-summary-followup-and-reply "gnus-msg" nil t)
-  (autoload 'gnus-summary-followup-and-reply-with-original "gnus-msg" nil t)
-  (autoload 'gnus-summary-cancel-article "gnus-msg" nil t)
-  (autoload 'gnus-summary-supersede-article "gnus-msg" nil t)
-  (autoload 'gnus-post-news "gnus-msg" nil t)
-  (autoload 'gnus-inews-news "gnus-msg" nil t)
-  (autoload 'gnus-cancel-news "gnus-msg" nil t)
-  (autoload 'gnus-summary-reply "gnus-msg" nil t)
-  (autoload 'gnus-summary-reply-with-original "gnus-msg" nil t)
-  (autoload 'gnus-summary-mail-forward "gnus-msg" nil t)
-  (autoload 'gnus-summary-mail-other-window "gnus-msg" nil t)
-  (autoload 'gnus-mail-yank-original "gnus-msg")
-  (autoload 'gnus-mail-send-and-exit "gnus-msg")
-  (autoload 'gnus-sendmail-setup-mail "gnus-msg")
-  (autoload 'gnus-article-mail "gnus-msg")
-  (autoload 'gnus-bug "gnus-msg" nil t)
-  (autoload 'gnus-inews-message-id "gnus-msg")
-
-  ;; gnus-vm
-  (autoload 'gnus-summary-save-in-vm "gnus-vm" nil t)
-  (autoload 'gnus-summary-save-article-vm "gnus-vm" nil t)
-  (autoload 'gnus-vm-mail-setup "gnus-vm")
-  (autoload 'gnus-yank-article "gnus-vm" nil t)
-
-  )
+  ;; This little mapcar goes through the list below and marks the
+  ;; symbols in question as autoloaded functions.
+  (mapcar 
+   (lambda (package)
+     (let ((interactive (nth 1 (memq ':interactive package))))
+       (mapcar 
+       (lambda (function)
+         (let (keymap)
+           (when (consp function)
+             (setq keymap (car (memq 'keymap function)))
+             (setq function (car function)))
+           (autoload function (car package) nil interactive keymap)))
+       (if (eq (cadr package) ':interactive)
+           (cdddr package)
+         (cdr package)))))
+   '(("metamail" metamail-buffer)
+     ("info" Info-goto-node)
+     ("hexl" hexl-hex-string-to-integer)
+     ("pp" pp pp-to-string pp-eval-expression)
+     ("mail-extr" mail-extract-address-components)
+     ("nnmail" nnmail-split-fancy nnmail-article-group)
+     ("nnvirtual" nnvirtual-catchup-group)
+     ("timezone" timezone-make-date-arpa-standard timezone-fix-time
+      timezone-make-sortable-date timezone-make-time-string)
+     ("sendmail" mail-position-on-field mail-setup)
+     ("rmailout" rmail-output)
+     ("rnewspost" news-mail-other-window news-reply-yank-original 
+      news-caesar-buffer-body)
+     ("rmail" rmail-insert-rmail-file-header rmail-count-new-messages
+      rmail-show-message)
+     ("gnus-soup" :interactive t
+      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-mh" gnus-mh-mail-setup gnus-summary-save-article-folder 
+      gnus-Folder-save-name gnus-folder-save-name)
+     ("gnus-mh" :interactive t gnus-mh-save-in-folder)
+     ("gnus-vis" gnus-group-make-menu-bar gnus-summary-make-menu-bar
+      gnus-server-make-menu-bar gnus-article-make-menu-bar
+      gnus-browse-make-menu-bar gnus-highlight-selected-summary
+      gnus-summary-highlight-line gnus-carpal-setup-buffer
+      gnus-article-add-button)
+     ("gnus-vis" :interactive t
+      gnus-article-push-button gnus-article-press-button 
+      gnus-article-highlight gnus-article-highlight-some 
+      gnus-article-hide gnus-article-hide-signature 
+      gnus-article-highlight-headers gnus-article-highlight-signature 
+      gnus-article-add-buttons gnus-article-add-buttons-to-head 
+      gnus-article-next-button)
+     ("gnus-demon" gnus-demon-add-nocem gnus-demon-add-scanmail
+      gnus-demon-add-disconnection gnus-demon-add-handler
+      gnus-demon-remove-handler)
+     ("gnus-demon" :interactive t
+      gnus-demon-init gnus-demon-cancel)
+     ("gnus-nocem" gnus-nocem-scan-groups gnus-nocem-close)
+     ("gnus-srvr" gnus-server-enter-setup-buffer)
+     ("gnus-cite" :interactive t
+      gnus-article-highlight-citation gnus-article-hide-citation-maybe 
+      gnus-article-hide-citation)
+     ("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)
+     ("gnus-cache" gnus-cache-possibly-enter-article gnus-cache-save-buffers
+      gnus-cache-possibly-remove-articles gnus-cache-request-article
+      gnus-cache-retrieve-headers gnus-cache-possibly-alter-active
+      gnus-cache-enter-remove-article)
+     ("gnus-cache" :interactive t gnus-jog-cache)
+     ("gnus-score" :interactive t
+      gnus-summary-increase-score gnus-summary-lower-score
+      gnus-score-flush-cache gnus-score-close 
+      gnus-score-raise-same-subject-and-select 
+      gnus-score-raise-same-subject gnus-score-default 
+      gnus-score-raise-thread gnus-score-lower-same-subject-and-select 
+      gnus-score-lower-same-subject gnus-score-lower-thread 
+      gnus-possibly-score-headers)
+     ("gnus-score" 
+      (gnus-summary-score-map keymap) gnus-score-save gnus-score-headers
+      gnus-current-score-file-nondirectory gnus-score-adaptive
+      gnus-score-find-trace gnus-score-file-name)
+     ("gnus-edit" :interactive t gnus-score-customize)
+     ("gnus-topic" gnus-topic-fold gnus-group-prepare-topics)
+     ("gnus-topic" :interactive t
+      gnus-group-add-to-topic gnus-topic-toggle-topic)
+     ("gnus-uu" (gnus-uu-extract-map keymap) (gnus-uu-mark-map keymap))
+     ("gnus-uu" :interactive t
+      gnus-uu-digest-mail-forward gnus-uu-digest-post-forward 
+      gnus-uu-mark-series gnus-uu-mark-region 
+      gnus-uu-mark-by-regexp gnus-uu-mark-all 
+      gnus-uu-mark-sparse gnus-uu-mark-thread gnus-uu-decode-uu 
+      gnus-uu-decode-uu-and-save gnus-uu-decode-unshar 
+      gnus-uu-decode-unshar-and-save gnus-uu-decode-save 
+      gnus-uu-decode-binhex gnus-uu-decode-uu-view 
+      gnus-uu-decode-uu-and-save-view gnus-uu-decode-unshar-view 
+      gnus-uu-decode-unshar-and-save-view gnus-uu-decode-save-view 
+      gnus-uu-decode-binhex-view)
+     ("gnus-msg" (gnus-summary-send-map keymap)
+      gnus-mail-yank-original gnus-mail-send-and-exit
+      gnus-sendmail-setup-mail gnus-article-mail 
+      gnus-inews-message-id)
+     ("gnus-msg" :interactive t
+      gnus-group-post-news gnus-group-mail 
+      gnus-summary-post-news gnus-summary-followup 
+      gnus-summary-followup-with-original 
+      gnus-summary-followup-and-reply 
+      gnus-summary-followup-and-reply-with-original 
+      gnus-summary-cancel-article gnus-summary-supersede-article 
+      gnus-post-news gnus-inews-news gnus-cancel-news 
+      gnus-summary-reply gnus-summary-reply-with-original 
+      gnus-summary-mail-forward gnus-summary-mail-other-window gnus-bug)
+     ("gnus-vm" gnus-vm-mail-setup)
+     ("gnus-vm" :interactive t gnus-summary-save-in-vm
+      gnus-summary-save-article-vm gnus-yank-article))))
 
 \f
 
@@ -2011,22 +1895,19 @@ Thank you for your help in stamping out bugs.
   (` (symbol-value (intern-soft (, string) (, hashtable)))))
 
 (defmacro gnus-sethash (string value hashtable)
-  "Set hash value. Arguments are STRING, VALUE, and HASHTABLE."
+  "Set hash value.  Arguments are STRING, VALUE, and HASHTABLE."
   ;; We cannot use define-abbrev since it only accepts string as value.
   ;; (set (intern string hashtable) value))
   (` (set (intern (, string) (, hashtable)) (, value))))
 
-(defmacro gnus-buffer-substring (beg end)
-  (` (buffer-substring (match-beginning (, beg)) (match-end (, end)))))
-
 ;; modified by MORIOKA Tomohiko <morioka@jaist.ac.jp>
 ;;   function `substring' might cut on a middle of multi-octet
 ;;   character.
 (defun gnus-truncate-string (str width)
   (substring str 0 width))
 
-;; Added by Geoffrey T. Dairiki <dairiki@u.washington.edu>. A safe way
-;; to limit the length of a string. This function is necessary since
+;; Added by Geoffrey T. Dairiki <dairiki@u.washington.edu>.  A safe way
+;; to limit the length of a string.  This function is necessary since
 ;; `(substr "abc" 0 30)' pukes with "Args out of range".
 (defsubst gnus-limit-string (str width)
   (if (> (length str) width)
@@ -2035,10 +1916,9 @@ Thank you for your help in stamping out bugs.
 
 (defsubst gnus-simplify-subject-re (subject)
   "Remove \"Re:\" from subject lines."
-  (let ((case-fold-search t))
-    (if (string-match "^re: *" subject)
-       (substring subject (match-end 0))
-      subject)))
+  (if (string-match "^[Rr][Ee]: *" subject)
+      (substring subject (match-end 0))
+    subject))
 
 (defsubst gnus-goto-char (point)
   (and point (goto-char point)))
@@ -2070,8 +1950,8 @@ Thank you for your help in stamping out bugs.
 
 ;; Delete the current line (and the next N lines.);
 (defmacro gnus-delete-line (&optional n)
-  (` (delete-region (progn (beginning-of-line) (point))
-                   (progn (forward-line (, (or n 1))) (point)))))
+  `(delete-region (progn (beginning-of-line) (point))
+                 (progn (forward-line ,(or n 1)) (point))))
 
 ;; Suggested by Brian Edmonds <edmonds@cs.ubc.ca>.
 (defvar gnus-init-inhibit nil)
@@ -2087,6 +1967,57 @@ Thank you for your help in stamping out bugs.
             (file-exists-p (concat gnus-init-file ".elc")))
         (load gnus-init-file nil t))))
 
+;; Info access macros.
+
+(defmacro gnus-info-group (info)
+  `(nth 0 ,info))
+(defmacro gnus-info-rank (info)
+  `(nth 1 ,info))
+(defmacro gnus-info-read (info)
+  `(nth 2 ,info))
+(defmacro gnus-info-marks (info)
+  `(nth 3 ,info))
+(defmacro gnus-info-method (info)
+  `(nth 4 ,info))
+(defmacro gnus-info-params (info)
+  `(nth 5 ,info))
+
+(defmacro gnus-info-level (info)
+  `(let ((rank (gnus-info-rank ,info)))
+     (if (consp rank)
+        (car rank)
+       rank)))
+(defmacro gnus-info-score (info)
+  `(let ((rank (gnus-info-rank ,info)))
+     (or (and (consp rank) (cdr rank)) 0)))
+
+(defmacro gnus-info-set-group (info group)
+  `(setcar ,info ,group))
+(defmacro gnus-info-set-rank (info rank)
+  `(setcar (cdr ,info) ,rank))
+(defmacro gnus-info-set-read (info read)
+  `(setcar (cddr ,info) ,read))
+(defmacro gnus-info-set-marks (info marks)
+  `(setcar (cdddr ,info) ,marks))
+(defmacro gnus-info-set-method (info method)
+  `(setcar (cddddr ,info) ,method))
+(defmacro gnus-info-set-params (info params)
+  `(setcar (cdddddr ,info) ,params))
+
+(defmacro gnus-info-set-level (info level)
+  `(let ((rank (cdr ,info)))
+     (if (consp (car rank))
+        (setcar (car rank) ,level)
+       (setcar rank ,level))))
+(defmacro gnus-info-set-score (info score)
+  `(let ((rank (cdr ,info)))
+     (if (consp (car rank))
+        (setcdr (car rank) ,score)
+       (setcar rank (cons (car rank) ,score)))))
+
+(defmacro gnus-get-info (group)
+  `(nth 2 (gnus-gethash ,group gnus-newsrc-hashtb)))
+
 ;;; Load the user startup file.
 ;; (eval '(gnus-read-init-file 'inhibit))
 
@@ -2144,13 +2075,14 @@ Thank you for your help in stamping out bugs.
   (search-forward ":" (gnus-point-at-eol) t))
 
 (defun gnus-narrow-to-headers ()
+  "Narrow to the head of an article."
   (widen)
-  (save-excursion
-    (narrow-to-region
-     (goto-char (point-min))
-     (if (search-forward "\n\n" nil t)
-        (1- (point))
-       (point-max)))))
+  (narrow-to-region
+   (goto-char (point-min))
+   (if (search-forward "\n\n" nil t)
+       (1- (point))
+     (point-max)))
+  (goto-char (point-min)))
 
 (defun gnus-update-format-specifications ()
   (gnus-make-thread-indent-array)
@@ -2219,50 +2151,68 @@ Thank you for your help in stamping out bugs.
                                      (- (point) 2))))))))
 
 (defun gnus-mouse-face-function (form)
-  (` (let ((string (, form)))
-       (put-text-property 0 (length string) 'mouse-face gnus-mouse-face string)
-       string)))
+  (` (put-text-property
+      (point) (progn (insert (, form)) (point))
+      'mouse-face gnus-mouse-face)))
 
 (defun gnus-max-width-function (el max-width)
   (or (numberp max-width) (signal 'wrong-type-argument '(numberp max-width)))
-  (` (let* ((val (eval (, el)))
-           (valstr (if (numberp val)
-                       (int-to-string val) val)))
-       (if (> (length valstr) (, max-width))
-          (substring valstr 0 (, max-width))
-        valstr))))
+  (` (let ((val (eval (, el))))
+       (if (numberp val)
+          (setq val (int-to-string val) val))
+       (if (> (length val) (, max-width))
+          (substring val 0 (, max-width))
+        val))))
 
 (defun gnus-parse-format (format spec-alist &optional insert)
   ;; This function parses the FORMAT string with the help of the
   ;; SPEC-ALIST and returns a list that can be eval'ed to return the
   ;; string.  If the FORMAT string contains the specifiers %( and %)
   ;; the text between them will have the mouse-face text property.
-  (let ((result
-        (if (string-match "\\`\\(.*\\)%(\\(.*\\)%)\\(.*\n?\\)\\'" format)
-            (if (and gnus-visual gnus-mouse-face)
-                (let ((pre (substring format (match-beginning 1)
-                                      (match-end 1)))
-                      (button (substring format (match-beginning 2)
-                                         (match-end 2)))
-                      (post (substring format (match-beginning 3)
-                                       (match-end 3))))
-                  (list 'concat
-                        (gnus-parse-simple-format pre spec-alist)
-                        (gnus-mouse-face-function 
-                         (gnus-parse-simple-format button spec-alist))
-                        (gnus-parse-simple-format post spec-alist)))
-              (gnus-parse-simple-format
-               (concat (substring format (match-beginning 1) (match-end 1))
-                       (substring format (match-beginning 2) (match-end 2))
-                       (substring format (match-beginning 3) (match-end 3)))
-               spec-alist))
-          (gnus-parse-simple-format format spec-alist))))
-    (if insert (list 'insert result) result)))
+  (let (did-insert result)
+    (setq result
+         (if (string-match "\\`\\(.*\\)%(\\(.*\\)%)\\(.*\n?\\)\\'" format)
+             ;; This is a complex that should have mouse-face set on
+             ;; parts of the format.
+             (if (and gnus-visual gnus-mouse-face)
+                 (let ((pre (substring format (match-beginning 1)
+                                       (match-end 1)))
+                       (button (substring format (match-beginning 2)
+                                          (match-end 2)))
+                       (post (substring format (match-beginning 3)
+                                        (match-end 3))))
+                   (if (not insert)
+                       (list 'concat
+                             (gnus-parse-simple-format pre spec-alist)
+                             (gnus-mouse-face-function 
+                              (gnus-parse-simple-format button spec-alist))
+                             (gnus-parse-simple-format post spec-alist))
+                     (setq did-insert t)
+                     ;; So here we want mouse face and insert. 
+                     (list 'progn
+                           (list 'insert
+                                 (gnus-parse-simple-format pre spec-alist))
+                           (gnus-mouse-face-function 
+                            (gnus-parse-simple-format button spec-alist))
+                           (list 'insert
+                                 (gnus-parse-simple-format
+                                  post spec-alist)))))
+               ;; We don't want faces.
+               (gnus-parse-simple-format
+                (concat (substring format (match-beginning 1) (match-end 1))
+                        (substring format (match-beginning 2) (match-end 2))
+                        (substring format (match-beginning 3) (match-end 3)))
+                spec-alist))
+           ;; This is a simple format.
+           (gnus-parse-simple-format format spec-alist)))
+    (if (and insert (not did-insert))
+       (list 'insert result) 
+      result)))
 
 (defun gnus-parse-simple-format (format spec-alist)
   ;; This function parses the FORMAT string with the help of the
   ;; SPEC-ALIST and returns a list that can be eval'ed to return the
-  ;; string. The list will consist of the symbol `format', a format
+  ;; string.  The list will consist of the symbol `format', a format
   ;; specification string, and a list of forms depending on the
   ;; SPEC-ALIST.
   (let ((max-width 0)
@@ -2271,11 +2221,11 @@ Thank you for your help in stamping out bugs.
       (gnus-set-work-buffer)
       (insert format)
       (goto-char (point-min))
-      (while (re-search-forward "%[-0-9]*\\(,[0-9]+\\)?\\([^0-9]\\)\\(.\\)?" nil t)
-       (setq spec (string-to-char (buffer-substring (match-beginning 2)
-                                                    (match-end 2))))
+      (while (re-search-forward "%[-0-9]*\\(,[0-9]+\\)?\\([^0-9]\\)\\(.\\)?"
+                               nil t)
+       (setq spec (string-to-char (match-string 2)))
        ;; First check if there are any specs that look anything like
-       ;; "%12,12A", ie. with a "max width specification". These have
+       ;; "%12,12A", ie. with a "max width specification".  These have
        ;; to be treated specially.
        (if (setq beg (match-beginning 1))
            (setq max-width 
@@ -2291,9 +2241,7 @@ Thank you for your help in stamping out bugs.
             (setq elem
                   (list 
                    (list (intern (concat "gnus-user-format-function-"
-                                         (buffer-substring
-                                          (match-beginning 3)
-                                          (match-end 3))))
+                                         (match-string 3)))
                          'gnus-tmp-header)
                    ?s))
             (delete-region (match-beginning 3) (match-end 3)))
@@ -2477,8 +2425,7 @@ If variable `gnus-use-long-file-name' is non-nil, it is
               (concat "^\\(" (regexp-quote groupkey) ".*\\)[!:]")))
          (while (and (re-search-forward groupkey-re nil t)
                      (progn
-                       (setq before (buffer-substring
-                                     (match-beginning 1) (match-end 1)))
+                       (setq before (match-string 1))
                        (string< before newgroup)))))
        ;; Remove tail of newsgroup name (eg. a.b.c -> a.b)
        (setq groupkey
@@ -2488,7 +2435,7 @@ If variable `gnus-use-long-file-name' is non-nil, it is
 
 (defun gnus-subscribe-interactively (newsgroup)
   "Subscribe new NEWSGROUP interactively.
-It is inserted in hierarchical newsgroup order if subscribed. If not,
+It is inserted in hierarchical newsgroup order if subscribed.  If not,
 it is killed."
   (if (gnus-y-or-n-p (format "Subscribe new newsgroup: %s " newsgroup))
       (gnus-subscribe-hierarchically newsgroup)
@@ -2500,7 +2447,7 @@ it is killed."
 
 (defun gnus-subscribe-newsgroup (newsgroup &optional next)
   "Subscribe new NEWSGROUP.
-If NEXT is non-nil, it is inserted before NEXT. Otherwise it is made
+If NEXT is non-nil, it is inserted before NEXT.  Otherwise it is made
 the first newsgroup."
   ;; We subscribe the group by changing its level to `subscribed'.
   (gnus-group-change-level 
@@ -2578,16 +2525,8 @@ If optional argument RE-ONLY is non-nil, strip `Re:' only."
 
 ;; Remove any leading "re:"s, any trailing paren phrases, and simplify
 ;; all whitespace.
-(defun gnus-simplify-subject-fuzzy (subject)
-  (let ((case-fold-search t))
-    (save-excursion
-      (gnus-set-work-buffer)
-      (insert subject)
-      (inline (gnus-simplify-buffer-fuzzy))
-      (buffer-string))))
-
+;; Written by Stainless Steel Rat <ratinox@ccs.neu.edu>.
 (defun gnus-simplify-buffer-fuzzy ()
-  ;; Fix by Stainless Steel Rat <ratinox@ccs.neu.edu>.
   (goto-char (point-min))
   (while (or
          (looking-at "^[ \t]*\\(re\\|fwd\\)[[{(^0-9]*[])}]?[:;][ \t]*")
@@ -2598,13 +2537,13 @@ If optional argument RE-ONLY is non-nil, strip `Re:' only."
       (replace-match "" t t))
     (goto-char (point-min))
     (while (re-search-forward "^[[].*:[ \t].*[]]$" nil t)
-      (let ((beg (match-beginning 0))
-           (end (match-end 0)))
-       (goto-char end) (delete-char -1)
-       (goto-char beg) (delete-region beg (re-search-forward ":" nil t))
-       )))
+      (goto-char (match-end 0))
+      (delete-char -1)
+      (delete-region 
+       (progn (goto-char (match-beginning 0)))
+       (re-search-forward ":"))))
   (goto-char (point-min))
-  (while (re-search-forward "[ \t\n]*([^()]*)[ \t\n]*$" nil t)
+  (while (re-search-forward "[ \t\n]*([^()]*)[ \t]*$" nil t)
     (replace-match "" t t))
   (goto-char (point-min))
   (while (re-search-forward "[ \t]+" nil t)
@@ -2625,8 +2564,16 @@ If optional argument RE-ONLY is non-nil, strip `Re:' only."
                (replace-match "" t t))
              (setq list (cdr list))))
        (while (re-search-forward gnus-simplify-subject-fuzzy-regexp nil t)
-         (replace-match "" t t))
-       )))
+         (replace-match "" t t)))))
+
+(defun gnus-simplify-subject-fuzzy (subject)
+  "Siplify a subject string fuzzily."
+  (let ((case-fold-search t))
+    (save-excursion
+      (gnus-set-work-buffer)
+      (insert subject)
+      (inline (gnus-simplify-buffer-fuzzy))
+      (buffer-string))))
 
 ;; Add the current buffer to the list of buffers to be killed on exit. 
 (defun gnus-add-current-to-buffer-list ()
@@ -2946,7 +2893,7 @@ If optional argument RE-ONLY is non-nil, strip `Re:' only."
        (mess gnus-version)
        meth)
     ;; Go through all the legal select methods and add their version
-    ;; numbers to the total version string. Only the backends that are
+    ;; numbers to the total version string.  Only the backends that are
     ;; currently in use will have their message numbers taken into
     ;; consideration. 
     (while methods
@@ -3025,7 +2972,7 @@ that that variable is buffer-local to the summary buffers."
 
 (defun gnus-group-total-expirable-p (group)
   "Check whether GROUP is total-expirable or not."
-  (let ((params (nth 5 (nth 2 (gnus-gethash group gnus-newsrc-hashtb)))))
+  (let ((params (gnus-info-params (gnus-get-info group))))
     (or (memq 'total-expire params) 
        (cdr (assq 'total-expire params)) ; (total-expire . t)
        (and gnus-total-expirable-newsgroups ; Check var.
@@ -3033,7 +2980,7 @@ that that variable is buffer-local to the summary buffers."
 
 (defun gnus-group-auto-expirable-p (group)
   "Check whether GROUP is total-expirable or not."
-  (let ((params (nth 5 (nth 2 (gnus-gethash group gnus-newsrc-hashtb)))))
+  (let ((params (gnus-info-params (gnus-get-info group))))
     (or (memq 'auto-expire params) 
        (cdr (assq 'auto-expire params)) ; (auto-expire . t)
        (and gnus-auto-expirable-newsgroups ; Check var.
@@ -3153,6 +3100,10 @@ that that variable is buffer-local to the summary buffers."
   "Say whether GROUP is ephemeral or not."
   (assoc 'quit-config (gnus-find-method-for-group group)))
 
+(defun gnus-group-quit-config (group)
+  "Return the quit-config of GROUP."
+  (cdr (assoc 'quit-config (gnus-find-method-for-group group))))
+
 ;;; List and range functions
 
 (defun gnus-last-element (list)
@@ -3380,6 +3331,15 @@ Note: LIST has to be sorted over `<'."
        (setq ranges (cdr ranges)))
       (not not-stop))))
 
+(defun gnus-sublist-p (list sublist)
+  "Test whether all elements in SUBLIST are members of LIST."
+  (let ((sublistp t))
+    (while sublist
+      (unless (memq (pop sublist) list)
+       (setq sublistp nil
+             sublist nil)))
+    sublistp))
+
 \f
 ;;;
 ;;; Gnus group mode
@@ -3389,7 +3349,11 @@ Note: LIST has to be sorted over `<'."
 (defvar gnus-group-group-map nil)
 (defvar gnus-group-mark-map nil)
 (defvar gnus-group-list-map nil)
+(defvar gnus-group-sort-map nil)
+(defvar gnus-group-soup-map nil)
+(defvar gnus-group-sub-map nil)
 (defvar gnus-group-sub-map nil)
+(defvar gnus-group-help-map nil)
 (defvar gnus-group-score-map nil)
 (put 'gnus-group-mode 'mode-class 'special)
 
@@ -3447,7 +3411,6 @@ Note: LIST has to be sorted over `<'."
   (define-key gnus-group-mode-map "Z" 'gnus-group-clear-dribble)
   (define-key gnus-group-mode-map "q" 'gnus-group-exit)
   (define-key gnus-group-mode-map "Q" 'gnus-group-quit)
-  (define-key gnus-group-mode-map "\M-f" 'gnus-group-fetch-faq)
   (define-key gnus-group-mode-map "?" 'gnus-group-describe-briefly)
   (define-key gnus-group-mode-map "\C-c\C-i" 'gnus-info-find-node)
   (define-key gnus-group-mode-map "\M-e" 'gnus-group-edit-group-method)
@@ -3482,13 +3445,30 @@ Note: LIST has to be sorted over `<'."
   (define-key gnus-group-group-map "f" 'gnus-group-make-doc-group)
   (define-key gnus-group-group-map "r" 'gnus-group-rename-group)
   (define-key gnus-group-group-map "\177" 'gnus-group-delete-group)
-  (define-key gnus-group-group-map "sb" 'gnus-group-brew-soup)
-  (define-key gnus-group-group-map "sw" 'gnus-soup-save-areas)
-  (define-key gnus-group-group-map "ss" 'gnus-soup-send-replies)
-  (define-key gnus-group-group-map "sp" 'gnus-soup-pack-packet)
-  (define-key gnus-group-group-map "sr" 'nnsoup-pack-replies)
   (define-key gnus-group-group-map "t" 'gnus-group-add-to-topic)
 
+  (define-prefix-command 'gnus-group-soup-map)
+  (define-key gnus-group-group-map "s" 'gnus-group-soup-map)
+  (define-key gnus-group-soup-map "b" 'gnus-group-brew-soup)
+  (define-key gnus-group-soup-map "w" 'gnus-soup-save-areas)
+  (define-key gnus-group-soup-map "s" 'gnus-soup-send-replies)
+  (define-key gnus-group-soup-map "p" 'gnus-soup-pack-packet)
+  (define-key gnus-group-soup-map "r" 'nnsoup-pack-replies)
+
+  (define-prefix-command 'gnus-group-sort-map)
+  (define-key gnus-group-group-map "S" 'gnus-group-sort-map)
+  (define-key gnus-group-sort-map "s" 'gnus-group-sort-groups)
+  (define-key gnus-group-sort-map "a" 'gnus-group-sort-groups-by-alphabet)
+  (define-key gnus-group-sort-map "u" 'gnus-group-sort-groups-by-unread)
+  (define-key gnus-group-sort-map "l" 'gnus-group-sort-groups-by-level)
+  (define-key gnus-group-sort-map "v" 'gnus-group-sort-groups-by-score)
+  (define-key gnus-group-sort-map "r" 'gnus-group-sort-groups-by-rank)
+  (define-key gnus-group-sort-map "m" 'gnus-group-sort-groups-by-method)
+
+  (define-prefix-command 'gnus-group-help-map)
+  (define-key gnus-group-mode-map "H" 'gnus-group-help-map)
+  (define-key gnus-group-help-map "f" 'gnus-group-fetch-faq)
+
   (define-prefix-command 'gnus-group-list-map)
   (define-key gnus-group-mode-map "A" 'gnus-group-list-map)
   (define-key gnus-group-list-map "k" 'gnus-group-list-killed)
@@ -3500,6 +3480,7 @@ Note: LIST has to be sorted over `<'."
   (define-key gnus-group-list-map "d" 'gnus-group-description-apropos)
   (define-key gnus-group-list-map "m" 'gnus-group-list-matching)
   (define-key gnus-group-list-map "M" 'gnus-group-list-all-matching)
+  (define-key gnus-group-list-map "t" 'gnus-topic-toggle-topic)
 
   (define-prefix-command 'gnus-group-score-map)
   (define-key gnus-group-mode-map "W" 'gnus-group-score-map)
@@ -3576,7 +3557,7 @@ The following commands are available:
 (defun gnus-no-server (&optional arg)
   "Read network news.
 If ARG is a positive number, Gnus will use that as the
-startup level. If ARG is nil, Gnus will be started at level 2. 
+startup level.  If ARG is nil, Gnus will be started at level 2. 
 If ARG is non-nil and not a positive number, Gnus will
 prompt the user for the name of an NNTP server to use.
 As opposed to `gnus', this command will not connect to the local server."
@@ -3598,7 +3579,7 @@ As opposed to `gnus', this command will not connect to the local server."
 (defun gnus (&optional arg dont-connect slave)
   "Read network news.
 If ARG is non-nil and a positive number, Gnus will use that as the
-startup level. If ARG is non-nil and not a positive number, Gnus will
+startup level.  If ARG is non-nil and not a positive number, Gnus will
 prompt the user for the name of an NNTP server to use."
   (interactive "P")
   (if (get-buffer gnus-group-buffer)
@@ -3649,7 +3630,8 @@ prompt the user for the name of an NNTP server to use."
          (gnus-summary-make-display-table)
          (gnus-setup-news nil level)
          (gnus-group-list-groups level)
-         (gnus-configure-windows 'group))))))
+         (gnus-configure-windows 'group)
+         (gnus-group-set-mode-line))))))
 
 (defun gnus-unload ()
   "Unload all Gnus features."
@@ -3745,7 +3727,7 @@ This will also compile the user-defined format specs."
           __                             
 
 " 
-          gnus-version))
+          ""))
   ;; And then hack it.
   (gnus-indent-rigidly (point-min) (point-max) 
                       (/ (max (- (window-width) (or x 46)) 0) 2))
@@ -3753,13 +3735,17 @@ This will also compile the user-defined format specs."
   (forward-line 1)
   (let* ((pheight (count-lines (point-min) (point-max)))
         (wheight (window-height))
-        (rest (- wheight  pheight)))
+        (rest (- wheight pheight)))
     (insert (make-string (max 0 (* 2 (/ rest 3))) ?\n)))
   ;; Fontify some.
   (goto-char (point-min))
   (and (search-forward "Praxis" nil t)
        (put-text-property (match-beginning 0) (match-end 0) 'face 'bold))
-  (goto-char (point-min)))
+  (goto-char (point-min))
+  (let* ((mode-string (gnus-group-set-mode-line)))
+    (setq mode-line-buffer-identification 
+         (concat gnus-version (substring mode-string 4)))
+    (set-buffer-modified-p t)))
 
 (defun gnus-group-startup-message-old (&optional x y)
   "Insert startup message in current buffer."
@@ -3817,6 +3803,7 @@ listed."
            unread (cdr gnus-group-list-mode)))
   (setq level (gnus-group-default-level level))
   (gnus-group-setup-buffer)            ;May call from out of group buffer
+  (gnus-update-format-specifications)
   (let ((case-fold-search nil)
        (group (gnus-group-group-name)))
     (funcall gnus-group-prepare-function level unread nil)
@@ -3826,9 +3813,9 @@ listed."
       (if (not group)
          ;; Go to the first group with unread articles.
          (gnus-group-search-forward nil nil nil t)
-       ;; Find the right group to put point on. If the current group
+       ;; Find the right group to put point on.  If the current group
        ;; has disapeared in the new listing, try to find the next
-       ;; one. If no next one can be found, just leave point at the
+       ;; one.  If no next one can be found, just leave point at the
        ;; first newsgroup in the buffer.
        (if (not (gnus-goto-char
                  (text-property-any (point-min) (point-max) 
@@ -3860,21 +3847,23 @@ If REGEXP, only list groups matching REGEXP."
        ;; List living groups.
        (while newsrc
          (setq info (car newsrc)
-               group (car info)
+               group (gnus-info-group info)
                newsrc (cdr newsrc)
                unread (car (gnus-gethash group gnus-newsrc-hashtb)))
          (and unread                   ; This group might be bogus
               (or (not regexp)
                   (string-match regexp group))
-              (<= (setq clevel (car (cdr info))) level) 
+              (<= (setq clevel (gnus-info-level info)) level) 
               (>= clevel lowest)
               (or all                  ; We list all groups?
                   (eq unread t)        ; We list unactivated groups
                   (> unread 0)         ; We list groups with unread articles
-                  (cdr (assq 'tick (nth 3 info)))) ; And groups with tickeds
+                  (cdr (assq 'tick (gnus-info-marks info)))) 
+                                       ; And groups with tickeds
               (gnus-group-insert-group-line 
-               nil group (car (cdr info)) (nth 3 info) unread (nth 4 info)))))
-
+               nil group (gnus-info-level info) 
+               (gnus-info-marks info) unread (gnus-info-method info)))))
+      
     ;; List dead groups.
     (and (>= level gnus-level-zombie) (<= lowest gnus-level-zombie)
         (gnus-group-prepare-flat-list-dead 
@@ -3892,28 +3881,60 @@ If REGEXP, only list groups matching REGEXP."
 
 (defun gnus-group-prepare-flat-list-dead (groups level mark regexp)
   ;; List zombies and killed lists somehwat faster, which was
-  ;; suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>. It does
+  ;; suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>.  It does
   ;; this by ignoring the group format specification altogether.
   (let (group beg)
-    (while groups
-      (setq group (car groups)
-           groups (cdr groups))
-      (if (or (not regexp)
-             (string-match regexp group))
-         (progn
-           (setq beg (point))
-           (insert (format " %c     *: %s\n" mark group))
+    (if regexp
+       ;; This loop is used when listing groups that match some
+       ;; regexp. 
+       (while groups
+         (setq group (pop groups))
+         (when (string-match regexp group)
            (add-text-properties 
-            beg (1+ beg) 
+            (point) (prog1 (1+ (point))
+                      (insert " " mark "     *: " group "\n"))
             (list 'gnus-group (intern group)
                   'gnus-unread t
-                  'gnus-level level)))))))
-
-(defun gnus-group-real-name (group)
+                  'gnus-level level))))
+      ;; This loop is used when listing all groups.
+      (while groups
+       (add-text-properties 
+        (point) (prog1 (1+ (point))
+                  (insert " " mark "     *: " 
+                          (setq group (pop groups)) "\n"))
+        (list 'gnus-group (intern group)
+              'gnus-unread t
+              'gnus-level level))))))
+
+(defmacro gnus-group-real-name (group)
   "Find the real name of a foreign newsgroup."
-  (if (string-match ":[^:]+$" group)
-      (substring group (1+ (match-beginning 0)))
-    group))
+  `(let ((gname ,group))
+     (if (string-match ":[^:]+$" gname)
+        (substring gname (1+ (match-beginning 0)))
+       gname)))
+
+(defsubst gnus-server-add-address (method)
+  (let ((method-name (symbol-name (car method))))
+    (if (and (memq 'address (assoc method-name gnus-valid-select-methods))
+            (not (assq (intern (concat method-name "-address")) method)))
+       (append method (list (list (intern (concat method-name "-address"))
+                                  (nth 1 method))))
+      method)))
+
+(defsubst gnus-server-get-method (group method)
+  ;; Input either a server name, and extended server name, or a
+  ;; select method, and return a select method. 
+  (cond ((stringp method)
+        (gnus-server-to-method method))
+       ((and (stringp (car method)) group)
+        (gnus-server-extend-method group method))
+       (t
+        (gnus-server-add-address method))))
+
+(defun gnus-server-to-method (server)
+  "Map virtual server names to select methods."
+  (or (and (equal server "native") gnus-select-method)
+      (cdr (assoc server gnus-server-alist))))
 
 (defun gnus-group-prefixed-name (group method)
   "Return the whole name from GROUP and METHOD."
@@ -3941,6 +3962,16 @@ If REGEXP, only list groups matching REGEXP."
                (substring prefix (match-end 0) (1- (length prefix))))
        (list (intern (substring prefix 0 (1- (length prefix)))) "")))))
 
+(defsubst gnus-secondary-method-p (method)
+  "Return whether METHOD is a secondary select method."
+  (let ((methods gnus-secondary-select-methods)
+       (gmethod (gnus-server-get-method nil method)))
+    (while (and methods
+               (not (equal (gnus-server-get-method nil (car methods)) 
+                           gmethod)))
+      (setq methods (cdr methods)))
+    methods))
+
 (defun gnus-group-foreign-p (group)
   "Say whether a group is foreign or not."
   (and (not (gnus-group-native-p group))
@@ -3958,6 +3989,14 @@ If REGEXP, only list groups matching REGEXP."
   "Return non-nil if the current line is a topic."
   (get-text-property (gnus-point-at-bol) 'gnus-topic))
 
+(defun gnus-group-get-parameter (group &optional symbol)
+  "Returns the group parameters for GROUP.
+If SYMBOL, return the value of that symbol in the group parameters."
+  (let ((params (gnus-info-params (gnus-get-info group))))
+    (if symbol
+       (gnus-group-parameter-value params symbol)
+      params)))
+
 (defun gnus-group-parameter-value (params symbol)
   "Return the value of SYMBOL in group PARAMS."
   (or (car (memq symbol params))       ; It's either a simple symbol
@@ -3965,15 +4004,29 @@ If REGEXP, only list groups matching REGEXP."
 
 (defun gnus-group-add-parameter (group param)
   "Add parameter PARAM to GROUP."
-  (let ((info (nth 2 (gnus-gethash group gnus-newsrc-hashtb))))
+  (let ((info (gnus-get-info group)))
     (if (not info)
-       () ; This is a dead group. We just ignore it.
+       () ; This is a dead group.  We just ignore it.
       ;; Cons the new param to the old one and update.
-      (gnus-group-set-info (cons param (nth 5 info)) group 'params))))
+      (gnus-group-set-info (cons param (gnus-info-params info)) 
+                          group 'params))))
+
+(defun gnus-group-add-score (group &optional score)
+  "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)))))
+
+(defun gnus-summary-bubble-group ()
+  "Increase the score of the current group.
+This is a handy function to add to `gnus-summary-exit-hook' to
+increase the score of each group you read."
+  (gnus-group-add-score gnus-newsgroup-name))
 
 (defun gnus-group-set-info (info &optional method-only-group part)
   (let* ((entry (gnus-gethash
-                (or method-only-group (car info)) gnus-newsrc-hashtb))
+                (or method-only-group (gnus-info-group info))
+                gnus-newsrc-hashtb))
         (part-info info)
         (info (if method-only-group (nth 2 entry) info)))
     (if (not method-only-group)
@@ -3992,7 +4045,7 @@ If REGEXP, only list groups matching REGEXP."
        (setcar (nthcdr (1- total) info) part-info)))
     ;; We uncompress some lists of marked articles.
     (let (marked)
-      (if (not (setq marked (nth 3 info)))
+      (if (not (setq marked (gnus-info-marks info)))
          ()
        (while marked
          (or (eq 'score (car (car marked)))
@@ -4006,19 +4059,19 @@ If REGEXP, only list groups matching REGEXP."
       ;; This is a new group, so we just create it.
       (save-excursion
        (set-buffer gnus-group-buffer)
-       (if (nth 4 info)
+       (if (gnus-info-method info)
            ;; It's a foreign group...
            (gnus-group-make-group 
-            (gnus-group-real-name (car info))
-            (prin1-to-string (car (nth 4 info)))
-            (nth 1 (nth 4 info)))
+            (gnus-group-real-name (gnus-info-group info))
+            (prin1-to-string (car (gnus-info-method info)))
+            (nth 1 (gnus-info-method info)))
          ;; It's a native group.
-         (gnus-group-make-group (car info)))
+         (gnus-group-make-group (gnus-info-group info)))
        (gnus-message 6 "Note: New group created")
        (setq entry 
              (gnus-gethash (gnus-group-prefixed-name 
-                            (gnus-group-real-name (car info))
-                            (or (nth 4 info) gnus-select-method))
+                            (gnus-group-real-name (gnus-info-group info))
+                            (or (gnus-info-method info) gnus-select-method))
                            gnus-newsrc-hashtb))))
     ;; Whether it was a new group or not, we now have the entry, so we
     ;; can do the update.
@@ -4026,14 +4079,11 @@ If REGEXP, only list groups matching REGEXP."
        (progn
          (setcar (nthcdr 2 entry) info)
          (if (and (not (eq (car entry) t)) 
-                  (gnus-gethash (car info) gnus-active-hashtb))
-             (let ((marked (nth 3 info)))
-               (setcar entry 
-                       (max 0 (- (length (gnus-list-of-unread-articles 
-                                          (car info)))
-                                 (length (cdr (assq 'tick marked)))
-                                 (length (cdr (assq 'dormant marked)))))))))
-      (error "No such group: %s" (car info)))))
+                  (gnus-gethash (gnus-info-group info) gnus-active-hashtb))
+             (let ((marked (gnus-info-marks info)))
+               (setcar entry (length (gnus-list-of-unread-articles 
+                                      (car info)))))))
+      (error "No such group: %s" (gnus-info-group info)))))
 
 (defun gnus-group-set-method-info (group select-method)
   (gnus-group-set-info select-method group 'method))
@@ -4046,7 +4096,8 @@ If REGEXP, only list groups matching REGEXP."
   (let* ((buffer-read-only nil)
         (group (gnus-group-group-name))
         (entry (and group (gnus-gethash group gnus-newsrc-hashtb))))
-    (and entry
+    (and entry 
+        (not (gnus-ephemeral-group-p group))
         (gnus-dribble-enter 
          (concat "(gnus-group-set-info '" 
                  (prin1-to-string (nth 2 entry)) ")")))
@@ -4063,7 +4114,8 @@ If REGEXP, only list groups matching REGEXP."
        (progn
          (setq info (nth 2 entry))
          (gnus-group-insert-group-line 
-          nil group (nth 1 info) (nth 3 info) (car entry) (nth 4 info)))
+          nil group (gnus-info-level info) (gnus-info-marks info)
+          (car entry) (gnus-info-method info)))
       (setq active (gnus-gethash group gnus-active-hashtb))
       (gnus-group-insert-group-line 
        nil group 
@@ -4157,7 +4209,7 @@ already."
            found buffer-read-only visible)
        ;; Enter the current status into the dribble buffer.
        (let ((entry (gnus-gethash group gnus-newsrc-hashtb)))
-         (if entry
+         (if (and entry (not (gnus-ephemeral-group-p group)))
              (gnus-dribble-enter 
               (concat "(gnus-group-set-info '" (prin1-to-string (nth 2 entry))
                       ")"))))
@@ -4189,21 +4241,23 @@ already."
        (gnus-group-set-mode-line)))))
 
 (defun gnus-group-set-mode-line ()
-  (if (memq 'group gnus-updated-mode-lines)
-      (let* ((gformat (or gnus-group-mode-line-format-spec
-                         (setq gnus-group-mode-line-format-spec
-                               (gnus-parse-format 
-                                gnus-group-mode-line-format 
-                                gnus-group-mode-line-format-alist))))
-            (gnus-tmp-news-server (car (cdr gnus-select-method)))
-            (gnus-tmp-news-method (car gnus-select-method))
-            (max-len 60)
-            (mode-string (eval gformat)))
-       (setq mode-string (eval gformat))
-       (if (> (length mode-string) max-len) 
-           (setq mode-string (substring mode-string 0 (- max-len 4))))
-       (setq mode-line-buffer-identification mode-string)
-       (set-buffer-modified-p t))))
+  (when (memq 'group gnus-updated-mode-lines)
+    (let* ((gformat (or gnus-group-mode-line-format-spec
+                       (setq gnus-group-mode-line-format-spec
+                             (gnus-parse-format 
+                              gnus-group-mode-line-format 
+                              gnus-group-mode-line-format-alist))))
+          (gnus-tmp-news-server (car (cdr gnus-select-method)))
+          (gnus-tmp-news-method (car gnus-select-method))
+          (max-len 60)
+          ;; Get the resulting string.
+          (mode-string (eval gformat)))
+      ;; If the line is too long, we chop it off.
+      (when (> (length mode-string) max-len) 
+       (setq mode-string (substring mode-string 0 (- max-len 4))))
+      (prog1
+         (setq mode-line-buffer-identification mode-string)
+       (set-buffer-modified-p t)))))
 
 (defun gnus-group-group-name ()
   "Get the name of the newsgroup on the current line."
@@ -4340,8 +4394,10 @@ If UNMARK, remove the mark instead."
 (defun gnus-group-read-group (&optional all no-article group)
   "Read news in this newsgroup.
 If the prefix argument ALL is non-nil, already read articles become
-readable. If the optional argument NO-ARTICLE is non-nil, no article
-will be auto-selected upon group entry."
+readable.  IF ALL is a number, fetch this number of articles.  If the
+optional argument NO-ARTICLE is non-nil, no article will be
+auto-selected upon group entry.  If GROUP is non-nil, fetch that
+group."
   (interactive "P")
   (if (gnus-group-topic-p)
       (gnus-topic-fold) ; This is a topic line.
@@ -4349,15 +4405,15 @@ will be auto-selected upon group entry."
     (let ((group (or group (gnus-group-group-name)))
          number active marked entry)
       (or group (error "No group on current line"))
-      (setq marked 
-           (nth 3 (nth 2 (setq entry (gnus-gethash
-                                      group gnus-newsrc-hashtb)))))
-      ;; This group might be a dead group. In that case we have to get
+      (setq marked (nth 3 (nth 2 (setq entry (gnus-gethash
+                                             group gnus-newsrc-hashtb)))))
+      ;; This group might be a dead group.  In that case we have to get
       ;; the number of unread articles from `gnus-active-hashtb'.
-      (if entry
-         (setq number (car entry))
-       (if (setq active (gnus-gethash group gnus-active-hashtb))
-           (setq number (- (1+ (cdr active)) (car active)))))
+      (setq number
+           (cond ((numberp all) all)
+                 (entry (car entry))
+                 ((setq active (gnus-gethash group gnus-active-hashtb))
+                  (- (1+ (cdr active)) (car active)))))
       (gnus-summary-read-group 
        group (or all (and (numberp number) 
                          (zerop (+ number (length (cdr (assq 'tick marked)))
@@ -4367,7 +4423,8 @@ will be auto-selected upon group entry."
 (defun gnus-group-select-group (&optional all)
   "Select this newsgroup.
 No article is selected automatically.
-If argument ALL is non-nil, already read articles become readable."
+If ALL is non-nil, already read articles become readable.
+If ALL is a number, fetch this number of articles."
   (interactive "P")
   (gnus-group-read-group all t))
 
@@ -4390,12 +4447,7 @@ Returns whether the fetching was successful or not."
       (gnus))
   (gnus-group-select-group))
 
-(defun gnus-group-select-group-all ()
-  "Select the current group and display all articles in it."
-  (interactive)
-  (gnus-group-select-group 'all))
-
-;; Enter a group that is not in the group buffer. Non-nil is returned
+;; Enter a group that is not in the group buffer.  Non-nil is returned
 ;; if selection was successful.
 (defun gnus-group-read-ephemeral-group 
   (group method &optional activate quit-config)
@@ -4552,9 +4604,7 @@ If EXCLUDE-GROUP, do not go to that group."
 (defun gnus-group-enter-server-mode ()
   "Jump to the server buffer."
   (interactive)
-  (gnus-server-setup-buffer)
-  (gnus-configure-windows 'server)
-  (gnus-server-prepare))
+  (gnus-server-enter-setup-buffer))
 
 (defun gnus-group-make-group (name &optional method address)
   "Add a new newsgroup.
@@ -4591,8 +4641,9 @@ ADDRESS."
                          gnus-newsrc-hashtb))
        t)
       (gnus-sethash nname (cons 1 0) gnus-active-hashtb)
-      (gnus-dribble-enter 
-       (concat "(gnus-group-set-info '" (prin1-to-string (cdr info)) ")"))
+      (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)
 
       (if (assoc method gnus-valid-select-methods)
@@ -4650,7 +4701,7 @@ of the Earth\".  There is no undo."
   (setq new-name
        (gnus-group-prefixed-name 
         (gnus-group-real-name new-name)
-        (nth 4 (nth 2 (gnus-gethash group gnus-newsrc-hashtb)))))
+        (gnus-info-method (gnus-get-info group))))
 
   (gnus-message 6 "Renaming group %s to %s..." group new-name)
   (prog1
@@ -4682,7 +4733,7 @@ of the Earth\".  There is no undo."
        (winconf (current-window-configuration))
        info)
     (or group (error "No group on current line"))
-    (or (setq info (nth 2 (gnus-gethash group gnus-newsrc-hashtb)))
+    (or (setq info (gnus-get-info group))
        (error "Killed group; can't be edited"))
     (set-buffer (get-buffer-create gnus-group-edit-buffer))
     (gnus-configure-windows 'edit-group)
@@ -4707,7 +4758,7 @@ of the Earth\".  There is no undo."
        ";; Type `C-c C-c' after editing the group info.\n\n")))
     (let ((cinfo (gnus-copy-sequence info))
          marked)
-      (if (not (setq marked (nth 3 cinfo)))
+      (if (not (setq marked (gnus-info-marks cinfo)))
          ()
        (while marked
          (or (eq 'score (car (car marked)))
@@ -4720,9 +4771,9 @@ of the Earth\".  There is no undo."
       (insert 
        (pp-to-string
        (cond ((eq part 'method)
-              (or (nth 4 info) "native"))
+              (or (gnus-info-method info) "native"))
              ((eq part 'params)
-              (nth 5 info))
+              (gnus-info-params info))
              (t
               cinfo)))
        "\n"))))
@@ -4755,25 +4806,23 @@ of the Earth\".  There is no undo."
 (defun gnus-group-make-help-group ()
   "Create the Gnus documentation group."
   (interactive)
-  (let ((path load-path)
-       name)
-    (and (gnus-gethash (setq name (gnus-group-prefixed-name
-                                  "gnus-help" '(nndoc "gnus-help")))
-                      gnus-newsrc-hashtb)
-        (error "Documentation group already exists"))
+  (let ((path (cons (concat installation-directory "etc/") load-path))
+       (name (gnus-group-prefixed-name "gnus-help" '(nndoc "gnus-help")))
+       file)
+    (and (gnus-gethash name gnus-newsrc-hashtb)
+        (error "Documentation group already exists"))
     (while (and path
-               (not (file-exists-p (concat (file-name-as-directory (car path))
-                                           "doc.txt"))))
+               (not (file-exists-p 
+                     (setq file (concat (file-name-as-directory (car path))
+                                        "gnus-tut.txt")))))
       (setq path (cdr path)))
     (if (not path)
-       (message "Couldn't find doc group")
+       (message "Couldn't find doc group")
       (gnus-group-make-group 
        (gnus-group-real-name name)
        (list 'nndoc name
-            (list 'nndoc-address 
-                  (concat (file-name-as-directory (car path)) "doc.txt"))
-            (list 'nndoc-article-type 'mbox)))
-      (forward-line -1)))
+            (list 'nndoc-address file)
+            (list 'nndoc-article-type 'mbox)))))
   (gnus-group-position-point))
 
 (defun gnus-group-make-doc-group (file type)
@@ -4821,8 +4870,8 @@ Given a prefix, create a full group."
 
 (defun gnus-group-make-directory-group (dir)
   "Create an nndir group.
-The user will be prompted for a directory. The contents of this
-directory will be used as a newsgroup. The directory should contain
+The user will be prompted for a directory.  The contents of this
+directory will be used as a newsgroup.  The directory should contain
 mail messages or news articles in files that have numeric names."
   (interactive
    (list (read-file-name "Create group from directory: ")))
@@ -4885,7 +4934,7 @@ score file entries for articles to include in the group."
   (or (eq (car (gnus-find-method-for-group vgroup)) 'nnvirtual)
       (error "%s is not an nnvirtual group" vgroup))
   (let* ((groups (gnus-group-process-prefix n))
-        (method (nth 4 (nth 2 (gnus-gethash vgroup gnus-newsrc-hashtb)))))
+        (method (gnus-info-method (gnus-get-info vgroup))))
     (setcar (cdr method)
            (concat 
             (nth 1 method) "\\|"
@@ -4928,11 +4977,13 @@ score file entries for articles to include in the group."
 ;; Group sorting commands
 ;; Suggested by Joe Hildebrand <hildjj@idaho.fuentez.com>.
 
-(defun gnus-group-sort-groups ()
+(defun gnus-group-sort-groups (&optional func)
   "Sort the group buffer according to `gnus-group-sort-function'."
   (interactive)
-  (let ((funcs (if (listp gnus-group-sort-function) gnus-group-sort-function
-                (list gnus-group-sort-function))))
+  (let ((funcs 
+        (cond (func (list func))
+              ((listp gnus-group-sort-function) gnus-group-sort-function)
+              (t list gnus-group-sort-function))))
     ;; We peel off the dummy group off the alist.
     (and (equal (car (car gnus-newsrc-alist)) "dummy.group")
         (setq gnus-newsrc-alist (cdr gnus-newsrc-alist)))
@@ -4944,29 +4995,77 @@ score file entries for articles to include in the group."
   (gnus-make-hashtable-from-newsrc-alist)
   (gnus-group-list-groups))
 
+(defun gnus-group-sort-groups-by-alphabet ()
+  "Sort the group buffer alphabetically by group name."
+  (interactive)
+  (gnus-group-sort-groups 'gnus-group-sort-by-alphabet))
+
+(defun gnus-group-sort-groups-by-unread ()
+  "Sort the group buffer by unread articles."
+  (interactive)
+  (gnus-group-sort-groups 'gnus-group-sort-by-unread))
+
+(defun gnus-group-sort-groups-by-level ()
+  "Sort the group buffer by group level."
+  (interactive)
+  (gnus-group-sort-groups 'gnus-group-sort-by-level))
+
+(defun gnus-group-sort-groups-by-score ()
+  "Sort the group buffer by group score."
+  (interactive)
+  (gnus-group-sort-groups 'gnus-group-sort-by-score))
+
+(defun gnus-group-sort-groups-by-rank ()
+  "Sort the group buffer by group rank."
+  (interactive)
+  (gnus-group-sort-groups 'gnus-group-sort-by-rank))
+
+(defun gnus-group-sort-groups-by-method ()
+  "Sort the group buffer alphabetically by backend name."
+  (interactive)
+  (gnus-group-sort-groups 'gnus-group-sort-by-method))
+
 (defun gnus-group-sort-by-alphabet (info1 info2)
-  (string< (car info1) (car info2)))
+  "Sort alphabetically."
+  (string< (gnus-info-group info1) (gnus-info-group info2)))
 
 (defun gnus-group-sort-by-unread (info1 info2)
-  (let ((n1 (car (gnus-gethash (car info1) gnus-newsrc-hashtb)))
-       (n2 (car (gnus-gethash (car info2) gnus-newsrc-hashtb))))
+  "Sort by number of unread articles."
+  (let ((n1 (car (gnus-gethash (gnus-info-group info1) gnus-newsrc-hashtb)))
+       (n2 (car (gnus-gethash (gnus-info-group info2) gnus-newsrc-hashtb))))
     (< (or (and (numberp n1) n1) 0)
        (or (and (numberp n2) n2) 0))))
 
 (defun gnus-group-sort-by-level (info1 info2)
-  (< (nth 1 info1) (nth 1 info2)))
+  "Sort by level."
+  (< (gnus-info-level info1) (gnus-info-level info2)))
 
 (defun gnus-group-sort-by-method (info1 info2)
-  (string< (symbol-name (car (gnus-find-method-for-group (car info1))))
-          (symbol-name (car (gnus-find-method-for-group (car info2))))))
+  "Sort alphabetically by backend name."
+  (string< (symbol-name (car (gnus-find-method-for-group
+                             (gnus-info-group info1))))
+          (symbol-name (car (gnus-find-method-for-group 
+                             (gnus-info-group info2))))))
+
+(defun gnus-group-sort-by-score (info1 info2)
+  "Sort by group score."
+  (< (gnus-info-score info1) (gnus-info-score info2)))
+
+(defun gnus-group-sort-by-rank (info1 info2)
+  "Sort by level and score."
+  (let ((level1 (gnus-info-level info1))
+       (level2 (gnus-info-level info2)))
+    (or (< level1 level2)
+       (and (= level1 level2)
+            (< (gnus-info-score info1) (gnus-info-score info2))))))
 
 ;; Group catching up.
 
 (defun gnus-group-catchup-current (&optional n all)
   "Mark all articles not marked as unread in current newsgroup as read.
 If prefix argument N is numeric, the ARG next newsgroups will be
-caught up. If ALL is non-nil, marked articles will also be marked as
-read. Cross references (Xref: header) of articles are ignored.
+caught up.  If ALL is non-nil, marked articles will also be marked as
+read.  Cross references (Xref: header) of articles are ignored.
 The difference between N and actual number of newsgroups that were
 caught up is returned."
   (interactive "P")
@@ -5015,9 +5114,7 @@ or nil if no action could be taken."
       (if (not entry)
          ()
        (gnus-update-read-articles 
-        group (and (not all) (append (cdr (assq 'tick marked))
-                                     (cdr (assq 'dormant marked))))
-        nil (and (not all) (cdr (assq 'tick marked))))
+        group nil nil (and (not all) (cdr (assq 'tick marked))))
        (and all 
             (setq marked (nth 3 (nth 2 entry)))
             (setcar (nthcdr 3 (nth 2 entry)) 
@@ -5037,10 +5134,10 @@ or nil if no action could be taken."
       (gnus-group-remove-mark group)
       (if (not (gnus-check-backend-function 'request-expire-articles group))
          ()
-       (let* ((info (nth 2 (gnus-gethash group gnus-newsrc-hashtb)))
+       (let* ((info (gnus-get-info group))
               (expirable (if (gnus-group-total-expirable-p group)
                              (cons nil (gnus-list-of-read-articles group))
-                           (assq 'expire (nth 3 info)))))
+                           (assq 'expire (gnus-info-marks info)))))
          (and expirable 
               (setcdr expirable
                       (gnus-request-expire-articles 
@@ -5051,7 +5148,7 @@ or nil if no action could be taken."
   (interactive)
   (save-excursion
     (gnus-message 5 "Expiring...")
-    (let ((gnus-group-marked (mapcar (lambda (info) (car info))
+    (let ((gnus-group-marked (mapcar (lambda (info) (gnus-info-group info))
                                     (cdr gnus-newsrc-alist))))
       (gnus-group-expire-articles nil)))
   (gnus-group-position-point)
@@ -5137,7 +5234,7 @@ New newsgroup is added to .newsrc automatically."
 
 (defun gnus-group-transpose-groups (n)
   "Move the current newsgroup up N places.
-If given a negative prefix, move down instead. The difference between
+If given a negative prefix, move down instead.  The difference between
 N and the number of steps taken is returned." 
   (interactive "p")
   (or (gnus-group-group-name)
@@ -5221,7 +5318,7 @@ newsgroup yanked is returned."
          (error "No more newsgroups to yank"))
       (setq group (nth 2 info))
       ;; Find which newsgroup to insert this one before - search
-      ;; backward until something suitable is found. If there are no
+      ;; backward until something suitable is found.  If there are no
       ;; other newsgroups in this buffer, just make this newsgroup the
       ;; first newsgroup.
       (setq prev (gnus-group-group-name))
@@ -5247,7 +5344,7 @@ unsubscribed groups."
 ;; Rewritten by engstrom@src.honeywell.com (Eric Engstrom).
 (defun gnus-group-list-killed (&optional arg)
   "List all killed newsgroups in the group buffer.
-If ARG is non-nil, list ALL killed groups known to Gnus. This may
+If ARG is non-nil, list ALL killed groups known to Gnus.  This may
 entail asking the server for the groups."
   (interactive "P")
   ;; Find all possible killed newsgroups if arg.
@@ -5363,14 +5460,11 @@ If N is negative, this group and the N-1 previous groups will be checked."
     ret))
 
 (defun gnus-get-new-news-in-group (group)
-  (and group 
-       (gnus-activate-group group 'scan)
-       (progn
-        (gnus-get-unread-articles-in-group 
-         (nth 2 (gnus-gethash group gnus-newsrc-hashtb))
-         (gnus-gethash group gnus-active-hashtb))
-        (gnus-group-update-group-line)
-        t)))
+  (when (and group (gnus-activate-group group 'scan))
+    (gnus-get-unread-articles-in-group 
+     (gnus-get-info group) (gnus-gethash group gnus-active-hashtb))
+    (gnus-group-update-group-line)
+    t))
 
 (defun gnus-group-fetch-faq (group &optional faq-dir)
   "Fetch the FAQ for the current group."
@@ -5749,8 +5843,7 @@ and the second element is the address."
        (while (re-search-forward 
                "\\(^[^ \t]+\\)[ \t]+[0-9]+[ \t]+[0-9]+" nil t)
          (goto-char (match-end 1))
-         (setq groups (cons (cons (buffer-substring (match-beginning 1)
-                                                    (match-end 1))
+         (setq groups (cons (cons (match-string 1)
                                   (max 0 (- (1+ (read cur)) (read cur))))
                             groups)))))
     (setq groups (sort groups 
@@ -5843,21 +5936,19 @@ buffer.
 (defun gnus-browse-group-name ()
   (save-excursion
     (beginning-of-line)
-    (if (not (re-search-forward ": \\(.*\\)$" (gnus-point-at-eol) t))
-       ()
-      (gnus-group-prefixed-name 
-       (buffer-substring (match-beginning 1) (match-end 1))
-       gnus-browse-current-method))))
+    (when (re-search-forward ": \\(.*\\)$" (gnus-point-at-eol) t)
+      (gnus-group-prefixed-name (match-string 1) gnus-browse-current-method))))
   
 (defun gnus-browse-unsubscribe-group ()
+  "Toggle subscription of the current group in the browse buffer."
   (let ((sub nil)
        (buffer-read-only nil)
        group)
     (save-excursion
       (beginning-of-line)
+      ;; If this group it killed, then we want to subscribe it.
       (if (= (following-char) ?K) (setq sub t))
       (setq group (gnus-browse-group-name))
-      (beginning-of-line)
       (delete-char 1)
       (if sub
          (progn
@@ -6057,7 +6148,7 @@ buffer.
   (define-key gnus-summary-mode-map "S" 'gnus-summary-send-map)
 
   (define-prefix-command 'gnus-summary-limit-map)
-  (define-key gnus-summary-mark-map "/" 'gnus-summary-limit-map)
+  (define-key gnus-summary-mode-map "/" 'gnus-summary-limit-map)
   (define-key gnus-summary-limit-map "/" 'gnus-summary-limit-to-subject)
   (define-key gnus-summary-limit-map "n" 'gnus-summary-limit-to-articles)
   (define-key gnus-summary-limit-map "w" 'gnus-summary-pop-limit)
@@ -6381,7 +6472,7 @@ The following commands are available:
            (and offset (gnus-data-update-list (cdr list) offset)))
        (setcdr list (cdr data))
        (setcdr data ilist)
-       (gnus-data-update-list (cdr data) offset))
+       (and offset (gnus-data-update-list (cdr data) offset)))
       (setq gnus-newsgroup-data-reverse nil))))
 
 (defun gnus-data-remove (article &optional offset)
@@ -6412,14 +6503,14 @@ The following commands are available:
     (setq data (cdr data))))
 
 (defun gnus-data-compute-positions ()
-  "Compute all positions to all articles."
+  "Compute the positions of all articles."
   (let ((data gnus-newsgroup-data)
        pos)
     (while data
-      (and (setq pos (text-property-any 
-                     (point-min) (point-max)
-                     'gnus-number (gnus-data-number (car data))))
-          (gnus-data-set-pos (car data) (+ pos 3)))
+      (when (setq pos (text-property-any 
+                      (point-min) (point-max)
+                      'gnus-number (gnus-data-number (car data))))
+       (gnus-data-set-pos (car data) (+ pos 3)))
       (setq data (cdr data)))))
 
 (defun gnus-summary-article-pseudo-p (article)
@@ -6435,25 +6526,24 @@ The following commands are available:
     
 (defmacro gnus-summary-skip-intangible ()
   "If the current article is intangible, then jump to a different article."
-  (let ((to (get-text-property (point) 'gnus-intangible)))
+  '(let ((to (get-text-property (point) 'gnus-intangible)))
     (when to
       (gnus-summary-goto-subject to))))
 
 (defmacro gnus-summary-article-intangible-p ()
   "Say whether this article is intangible or not."
-  (get-text-property (point) 'gnus-intangible))
+  '(get-text-property (point) 'gnus-intangible))
 
 ;; Some summary mode macros.
 
-(defmacro gnus-summary-article-number (&optional number-or-nil)
+(defmacro gnus-summary-article-number ()
   "The article number of the article on the current line.
 If there isn's an article number here, then we return the current
 article number."
-  (gnus-summary-skip-intangible)
-  (if number-or-nil
-      '(get-text-property (point) 'gnus-number)
-    '(or (get-text-property (point) 'gnus-number) 
-        gnus-current-article)))
+  '(progn
+     (gnus-summary-skip-intangible)
+     (or (get-text-property (point) 'gnus-number) 
+        gnus-newsgroup-end)))
 
 (defmacro gnus-summary-article-header (&optional number)
   (` (gnus-data-header (gnus-data-find
@@ -6526,7 +6616,7 @@ article number."
     (if (get-buffer buffer)
        (progn
          (set-buffer buffer)
-         (not gnus-newsgroup-begin))
+         (not gnus-newsgroup-prepared))
       ;; Fix by Sudish Joseph <joseph@cis.ohio-state.edu>
       (setq gnus-summary-buffer (set-buffer (get-buffer-create buffer)))
       (gnus-add-current-to-buffer-list)
@@ -6537,7 +6627,7 @@ article number."
 
 (defun gnus-set-global-variables ()
   ;; Set the global equivalents of the summary buffer-local variables
-  ;; to the latest values they had. These reflect the summary buffer
+  ;; to the latest values they had.  These reflect the summary buffer
   ;; that was in action when the last article was fetched.
   (if (eq major-mode 'gnus-summary-mode) 
       (progn
@@ -6629,57 +6719,57 @@ article number."
 
 (defun gnus-summary-update-line (&optional dont-update)
   ;; Update summary line after change.
-  (or (not gnus-summary-default-score)
-      gnus-summary-inhibit-highlight
-      (let ((gnus-summary-inhibit-highlight t)
-           (article (gnus-summary-article-number)))
-       (progn
-         (or dont-update
-             (if (and gnus-summary-mark-below
-                      (< (gnus-summary-article-score)
-                         gnus-summary-mark-below))
-                 (and (not (memq article gnus-newsgroup-marked))
-                      (not (memq article gnus-newsgroup-dormant))
-                      (memq article gnus-newsgroup-unreads)
-                      (gnus-summary-mark-article-as-read gnus-low-score-mark))
-               (and (eq (gnus-summary-article-mark) gnus-low-score-mark)
-                    (gnus-summary-mark-article-as-unread gnus-unread-mark))))
-         (and (gnus-visual-p 'summary-highlight 'highlight)
-              (run-hooks 'gnus-summary-update-hook))))))
+  (when (and gnus-summary-default-score
+            (not gnus-summary-inhibit-highlight))
+    (let ((gnus-summary-inhibit-highlight t) ; Prevent recursion.
+         (article (gnus-summary-article-number)))
+      (unless dont-update
+       (if (and gnus-summary-mark-below
+                (< (gnus-summary-article-score)
+                   gnus-summary-mark-below))
+           ;; This article has a low score, so we mark it as read.
+           (when (memq article gnus-newsgroup-unreads)
+             (gnus-summary-mark-article-as-read gnus-low-score-mark))
+         (when (eq (gnus-summary-article-mark) gnus-low-score-mark)
+           ;; This article was previously marked as read on account
+           ;; of a low score, but now it has risen, so we mark it as
+           ;; unread. 
+           (gnus-summary-mark-article-as-unread gnus-unread-mark))))
+      ;; Do visual highlighting.
+      (when (gnus-visual-p 'summary-highlight 'highlight)
+       (run-hooks 'gnus-summary-update-hook)))))
 
 (defun gnus-summary-update-lines (&optional beg end)
-  ;; Mark article as read (or not) by taking into account scores.
-  (let ((beg (or beg (point-min)))
-       (end (or end (point-max))))
-    (if (or (not gnus-summary-default-score)
-           gnus-summary-inhibit-highlight)
-       ()
-      (let ((gnus-summary-inhibit-highlight t)
-           article)
-       (save-excursion
-         (set-buffer gnus-summary-buffer)
-         (goto-char beg)
-         (beginning-of-line)
-         (while (and (not (eobp)) (< (point) end))
-           (if (and gnus-summary-mark-below
-                    (< (or (cdr (assq 
-                                 (setq article (gnus-summary-article-number))
-                                 gnus-newsgroup-scored))
-                           gnus-summary-default-score 0)
-                       gnus-summary-mark-below))
-               ;; We want to possibly mark it as read...
-               (and (not (memq article gnus-newsgroup-marked))
-                    (not (memq article gnus-newsgroup-dormant))
-                    (memq article gnus-newsgroup-unreads)
-                    (gnus-summary-mark-article-as-read gnus-low-score-mark))
-             ;; We want to possibly mark it as unread.
-             (and (eq (gnus-summary-article-mark article)
-                      gnus-low-score-mark)
-                  (gnus-summary-mark-article-as-unread gnus-unread-mark)))
-           ;; Do the visual highlights at the same time.
-           (and (gnus-visual-p 'summary-highlight 'highlight)
-                (run-hooks 'gnus-summary-update-hook))
-           (forward-line 1)))))))
+  "Mark article as read (or not) by taking into account scores."
+  (when (and gnus-summary-default-score
+            (not gnus-summary-inhibit-highlight))
+    (let ((beg (or beg (point-min)))
+         (end (or end (point-max)))
+         (gnus-summary-inhibit-highlight t)
+         (visual (gnus-visual-p 'summary-highlight 'highlight))
+         article)
+      (save-excursion
+       (set-buffer gnus-summary-buffer)
+       (goto-char beg)
+       (beginning-of-line)
+       (while (and (not (eobp)) 
+                   (< (point) end))
+         (if (and gnus-summary-mark-below
+                  (< (or (cdr (assq 
+                               (setq article (gnus-summary-article-number))
+                               gnus-newsgroup-scored))
+                         gnus-summary-default-score 0)
+                     gnus-summary-mark-below))
+             ;; We want to possibly mark it as read...
+             (when (memq article gnus-newsgroup-unreads)
+               (gnus-summary-mark-article-as-read gnus-low-score-mark))
+           ;; We want to possibly mark it as unread.
+           (when (eq (gnus-summary-article-mark article) gnus-low-score-mark)
+             (gnus-summary-mark-article-as-unread gnus-unread-mark)))
+         ;; Do the visual highlights at the same time.
+         (when visual
+           (run-hooks 'gnus-summary-update-hook))
+         (forward-line 1))))))
 
 (defvar gnus-tmp-new-adopts)
 
@@ -6709,7 +6799,7 @@ article number."
 
 (defun gnus-summary-set-local-parameters (group)
  "Go through the local params of GROUP and set all variable specs in that list."
-  (let ((params (nth 5 (nth 2 (gnus-gethash group gnus-newsrc-hashtb))))
+  (let ((params (gnus-info-params (gnus-get-info group)))
        elem)
     (while params
       (setq elem (car params)
@@ -6729,10 +6819,10 @@ If NO-ARTICLE is non-nil, no article is selected initially.
 If NO-DISPLAY, don't generate a summary buffer."
   (gnus-message 5 "Retrieving newsgroup: %s..." group)
   (let* ((new-group (gnus-summary-setup-buffer group))
-        (quit-config (nth 1 (assoc 'quit-config (gnus-find-method-for-group
-                                                 group))))
+        (quit-config (gnus-group-quit-config group))
         (did-select (and new-group (gnus-select-newsgroup group show-all))))
     (cond 
+     ;; This summary buffer exists already, so we just select it. 
      ((not new-group)
       (gnus-set-global-variables)
       (gnus-kill-buffer kill-buffer)
@@ -6741,24 +6831,26 @@ If NO-DISPLAY, don't generate a summary buffer."
       (gnus-summary-position-point)
       (message "")
       t)
+     ;; We couldn't select this group.
      ((null did-select) 
-      (and (eq major-mode 'gnus-summary-mode)
-          (not (equal (current-buffer) kill-buffer))
-          (progn
-            (kill-buffer (current-buffer))
-            (if (not quit-config)
-                (progn
-                  (set-buffer gnus-group-buffer)
-                  (gnus-group-jump-to-group group)
-                  (gnus-group-next-unread-group 1))
-              (if (not (buffer-name (car quit-config)))
-                  (gnus-configure-windows 'group 'force)
-                (set-buffer (car quit-config))
-                (and (eq major-mode 'gnus-summary-mode)
-                     (gnus-set-global-variables))
-                (gnus-configure-windows (cdr quit-config))))))
+      (when (and (eq major-mode 'gnus-summary-mode)
+                (not (equal (current-buffer) kill-buffer)))
+       (kill-buffer (current-buffer))
+       (if (not quit-config)
+           (progn
+             (set-buffer gnus-group-buffer)
+             (gnus-group-jump-to-group group)
+             (gnus-group-next-unread-group 1))
+         (if (not (buffer-name (car quit-config)))
+             (gnus-configure-windows 'group 'force)
+           (set-buffer (car quit-config))
+           (and (eq major-mode 'gnus-summary-mode)
+                (gnus-set-global-variables))
+           (gnus-configure-windows (cdr quit-config)))))
       (message "Can't select group")
       nil)
+     ;; The user did a `C-g' while prompting for number of articles,
+     ;; so we exit this group.
      ((eq did-select 'quit)
       (and (eq major-mode 'gnus-summary-mode)
           (not (equal (current-buffer) kill-buffer))
@@ -6776,7 +6868,9 @@ If NO-DISPLAY, don't generate a summary buffer."
          (and (eq major-mode 'gnus-summary-mode)
               (gnus-set-global-variables))
          (gnus-configure-windows (cdr quit-config))))
+      ;; Finallt signal the quit.
       (signal 'quit nil))
+     ;; The group was successfully selected.
      (t
       (gnus-set-global-variables)
       ;; Save the active value in effect when the group was entered.
@@ -6788,19 +6882,22 @@ If NO-DISPLAY, don't generate a summary buffer."
       ;; Set any local variables in the group parameters.
       (gnus-summary-set-local-parameters gnus-newsgroup-name)
       ;; Do score processing.
-      (and gnus-use-scoring (gnus-possibly-score-headers))
+      (when gnus-use-scoring
+       (gnus-possibly-score-headers))
       (gnus-update-format-specifications)
       ;; Find the initial limit.
       (gnus-summary-initial-limit)
-      (gnus-set-mode-line 'summary)
       ;; Generate the summary buffer.
-      (or no-display
-         (gnus-summary-prepare))
-      (if (zerop (buffer-size))
-         (cond (gnus-newsgroup-dormant
-                (gnus-summary-limit-include-dormant))
-               ((and gnus-newsgroup-scored show-all)
-                (gnus-summary-limit-include-expunged))))
+      (unless no-display
+       (gnus-summary-prepare))
+      ;; If the summary buffer is empty, but there are some low-scored
+      ;; articles or some excluded dormants, we include these in the
+      ;; buffer. 
+      (when (zerop (buffer-size))
+       (cond (gnus-newsgroup-dormant
+              (gnus-summary-limit-include-dormant))
+             ((and gnus-newsgroup-scored show-all)
+              (gnus-summary-limit-include-expunged))))
       ;; Function `gnus-apply-kill-file' must be called in this hook.
       (run-hooks 'gnus-apply-kill-hook)
       (if (zerop (buffer-size))
@@ -6809,6 +6906,7 @@ If NO-DISPLAY, don't generate a summary buffer."
            (gnus-summary-catchup-and-exit nil t) ;Without confirmations.
            (gnus-message 6 "No unread news")
            (gnus-kill-buffer kill-buffer)
+           ;; Return nil from this function.
            nil)
        ;; Hide conversation thread subtrees.  We cannot do this in
        ;; gnus-summary-prepare-hook since kill processing may not
@@ -6817,46 +6915,50 @@ If NO-DISPLAY, don't generate a summary buffer."
             gnus-thread-hide-subtree
             (gnus-summary-hide-all-threads))
        ;; Show first unread article if requested.
-       (goto-char (point-min))
        (if (and (not no-article)
-                gnus-auto-select-first
-                (gnus-summary-first-unread-article))
-           ()
+                gnus-auto-select-first)
+           (progn
+             (if (eq gnus-auto-select-first 'best)
+                 (gnus-summary-best-unread-article)
+               (gnus-summary-first-unread-article)))
+         ;; Don't select any articles, just move point to the first
+         ;; article in the group.
+         (goto-char (point-min))
+         (gnus-summary-position-point)
+         (gnus-set-mode-line 'summary)
          (gnus-configure-windows 'summary 'force))
-       (gnus-set-mode-line 'summary)
-       (gnus-summary-position-point)
-       ;; If in async mode, we send some info to the backend.
-       (and gnus-newsgroup-async
-            (gnus-request-asynchronous 
-             gnus-newsgroup-name gnus-newsgroup-data))
+       ;; If we are in async mode, we send some info to the backend.
+       (when gnus-newsgroup-async
+         (gnus-request-asynchronous gnus-newsgroup-name gnus-newsgroup-data))
        (gnus-kill-buffer kill-buffer)
-       (if (not (get-buffer-window gnus-group-buffer))
-           ()
-         ;; gotta use windows, because recenter does wierd stuff if
+       (when (get-buffer-window gnus-group-buffer)
+         ;; Gotta use windows, because recenter does wierd stuff if
          ;; the current buffer ain't the displayed window.
          (let ((owin (selected-window))) 
            (select-window (get-buffer-window gnus-group-buffer))
-           (and (gnus-group-goto-group group)
-                (recenter))
+           (when (gnus-group-goto-group group)
+             (recenter))
            (select-window owin))))
+      ;; Mark this buffer as "prepared".
+      (setq gnus-newsgroup-prepared t)
       t))))
 
 (defun gnus-summary-prepare ()
-  ;; Generate the summary buffer.
+  "Generate the summary buffer."
   (let ((buffer-read-only nil))
     (erase-buffer)
     (setq gnus-newsgroup-data nil
          gnus-newsgroup-data-reverse nil)
+    (run-hooks 'gnus-summary-generate-hook)
+    ;; Generate the buffer, either with threads or without.
     (gnus-summary-prepare-threads 
      (if gnus-show-threads
-        (gnus-gather-threads 
-         (gnus-sort-threads 
-          (gnus-make-threads)))
+        (gnus-gather-threads (gnus-sort-threads (gnus-make-threads)))
        gnus-newsgroup-headers))
+    ;; Do score marking and highlights.
     (gnus-summary-update-lines)
     (setq gnus-newsgroup-data (nreverse gnus-newsgroup-data))
     ;; Call hooks for modifying summary buffer.
-    ;; Suggested by sven@tde.LTH.Se (Sven Mattisson).
     (goto-char (point-min))
     (run-hooks 'gnus-summary-prepare-hook)))
 
@@ -6900,10 +7002,6 @@ If NO-DISPLAY, don't generate a summary buffer."
 
 (defun gnus-make-threads ()
   "Go through the dependency hashtb and find the roots.  Return all threads."
-  ;; We might want to build some more threads first.
-  (and gnus-fetch-old-headers
-       (eq gnus-headers-retrieved-by 'nov)
-       (gnus-build-old-threads))
   ;; Then we find all the roots and return all the threads.
   (let (threads)
     (mapatoms
@@ -6915,7 +7013,7 @@ If NO-DISPLAY, don't generate a summary buffer."
   
 (defun gnus-build-old-threads ()
   ;; Look at all the articles that refer back to old articles, and
-  ;; fetch the headers for the articles that aren't there. This will
+  ;; fetch the headers for the articles that aren't there.  This will
   ;; build complete threads - if the roots haven't been expired by the
   ;; server, that is.
   (let (id heads)
@@ -6938,7 +7036,7 @@ If NO-DISPLAY, don't generate a summary buffer."
 
 (defun gnus-build-get-header (id)
   ;; Look through the buffer of NOV lines and find the header to
-  ;; ID. Enter this line into the dependencies hash table, and return
+  ;; ID.  Enter this line into the dependencies hash table, and return
   ;; the id of the parent article (if any).
   (let ((deps gnus-newsgroup-dependencies)
        found header)
@@ -6968,20 +7066,35 @@ If NO-DISPLAY, don't generate a summary buffer."
   "Rebuild the thread containing ID."
   (let ((dep gnus-newsgroup-dependencies)
        (buffer-read-only nil)
-       (orig (progn (beginning-of-line) (point)))
-       (current (save-excursion
-                  (and (zerop (forward-line -1))
-                       (gnus-summary-article-number))))
-       headers refs thread art data)
+       current headers refs thread art data)
     (if (not gnus-show-threads)
-       (setq thread (car (gnus-gethash (downcase id) dep)))
-      ;; Get the thread this article is part op.
+       (setq thread (list (car (gnus-gethash (downcase id) dep))))
+      ;; Get the thread this article is part of.
       (setq thread (gnus-remove-thread id)))
+    (setq current (save-excursion
+                   (and (zerop (forward-line -1))
+                        (gnus-summary-article-number))))
+    ;; If this is a gathered thread, we have to go some re-gathering.
+    (when (stringp (car thread))
+      (let ((subject (car thread))
+           roots thr)
+       (setq thread (cdr thread))
+       (while thread
+         (unless (memq (setq thr (gnus-id-to-thread 
+                                     (gnus-root-id
+                                      (mail-header-id (car (car thread))))))
+                       roots)
+           (push thr roots))
+         (setq thread (cdr thread)))
+       ;; We now have all (unique) roots.
+       (if (= (length roots) 1)
+           ;; All the loose roots are now one solid root.
+           (setq thread (car roots))
+         (setq thread (cons subject (gnus-sort-threads roots))))))
     (let ((beg (point)) 
          threads)
       ;; We then insert this thread into the summary buffer.
       (let (gnus-newsgroup-data gnus-newsgroup-threads)
-       (goto-char orig)
        (gnus-summary-prepare-threads (list thread))
        (setq data (nreverse gnus-newsgroup-data))
        (setq threads gnus-newsgroup-threads))
@@ -6992,14 +7105,28 @@ If NO-DISPLAY, don't generate a summary buffer."
       ;; Do highlighting and stuff.
       (gnus-summary-update-lines beg (point)))))
 
+(defun gnus-id-to-thread (id)
+  "Return the (sub-)thread where ID appears."
+  (gnus-gethash (downcase id) gnus-newsgroup-dependencies))
+
+(defun gnus-root-id (id)
+  "Return the id of the root of the thread where ID appears."
+  (let (last-id prev)
+    (while (and id (setq prev (car (gnus-gethash 
+                                   (downcase id)
+                                   gnus-newsgroup-dependencies))))
+      (setq last-id id
+           id (gnus-parent-id (mail-header-references prev))))
+    last-id))
+
 (defun gnus-remove-thread (id)
   "Remove the thread that has ID in it."
-  ;; First go up in this thread until we find the root.
   (let ((dep gnus-newsgroup-dependencies)
-       headers thread prev)
-    (while (and id (setq prev (car (gnus-gethash (downcase id) dep))))
-      (setq headers prev)
-      (setq id (gnus-parent-id (mail-header-references headers))))
+       headers thread prev last-id)
+    ;; First go up in this thread until we find the root.
+    (setq last-id (gnus-root-id id))
+    (setq headers (list (car (gnus-id-to-thread last-id))
+                       (car (car (cdr (gnus-id-to-thread last-id))))))
     ;; We have now found the real root of this thread.  It might have
     ;; been gathered into some loose thread, so we have to search
     ;; through the threads to find the thread we wanted.
@@ -7014,20 +7141,20 @@ If NO-DISPLAY, don't generate a summary buffer."
            (progn
              (setq sub (cdr sub))
              (while sub
-               (if (equal headers (car (car sub)))
-                   (setq thread (car threads)
-                         threads nil
-                         sub nil))
+               (when (member (car (car sub)) headers)
+                 (setq thread (car threads)
+                       threads nil
+                       sub nil))
                (setq sub (cdr sub))))
          ;; It's an ordinary thread, so we check it.
-         (if (equal headers (car sub))
-             (setq thread sub
-                   threads nil)))
+         (when (member (car sub) headers)
+           (setq thread sub
+                 threads nil)))
        (setq threads (cdr threads)))
       ;; If this article is in no thread, then it's a root. 
       (if thread 
          (setq gnus-newsgroup-threads (delq thread gnus-newsgroup-threads))
-       (setq thread (cadr (gnus-gethash (downcase id) dep))))
+       (setq thread (gnus-gethash (downcase last-id) dep)))
       (when thread
        (prog1 
            thread ; We return this thread.
@@ -7052,21 +7179,20 @@ If NO-DISPLAY, don't generate a summary buffer."
                     (point-min) (point-max) 'gnus-number number))
       (goto-char pos)
       (gnus-delete-line)
-      (gnus-data-remove pos))
+      (gnus-data-remove number))
     (setq thread (cdr thread))
     (while thread
       (gnus-remove-thread-1 (car thread))
       (setq thread (cdr thread)))))
 
 (defun gnus-sort-threads (threads)
-  ;; Sort threads as specified in `gnus-thread-sort-functions'.
-  (let ((fun gnus-thread-sort-functions))
-    (while fun
-      (gnus-message 6 "Sorting with %S..." fun)
-      (setq threads (sort threads (car fun))
-           fun (cdr fun))))
-  (if gnus-thread-sort-functions
-      (gnus-message 6 "Sorting...done"))
+  "Sort THREADS as specified in `gnus-thread-sort-functions'."
+  (let ((funs gnus-thread-sort-functions))
+    (when funs
+      (while funs
+       (gnus-message 7 "Sorting with %S..." (car funs))
+       (setq threads (sort threads (pop funs))))
+      (gnus-message 7 "Sorting...done")))
   threads)
 
 ;; Written by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
@@ -7157,6 +7283,7 @@ or a straight list of headers."
   (message "Generating summary...")
 
   (setq gnus-newsgroup-threads threads)
+  (beginning-of-line)
 
   (let ((level 0)
        thread header number subject stack state gnus-tmp-gathered mark
@@ -7221,7 +7348,9 @@ or a straight list of headers."
                              (lambda (h) (mail-header-number (car h)))
                              (cdr (cdr (car thread))))
                             gnus-tmp-gathered))
-               (setcdr (cdr (car thread)) nil)
+               (setq thread (cons (list (car (car thread))
+                                        (car (cdr (car thread))))
+                                  (cdr thread)))
                (setq level -1
                      gnus-tmp-false-parent t))
               ((eq gnus-summary-make-false-root 'empty)
@@ -7392,8 +7521,28 @@ If READ-ALL is non-nil, all articles in the group are selected."
         (setq gnus-newsgroup-async
               (gnus-request-asynchronous gnus-newsgroup-name)))
 
+    ;; Adjust and set lists of article marks.
+    (when info
+      (gnus-adjust-marked-articles info)
+      (let ((marked (gnus-info-marks info)))
+       (mapcar
+        (lambda (thing)
+          (let ((name (intern (format "gnus-newsgroup-%s" (car thing)))))
+            (set name (copy-sequence (cdr (assq (cdr thing) marked))))))
+        '((marked . tick) (replied . reply) 
+          (exirable . expire) (killed . killed)
+          (bookmarks . bookmark) (dormant . dormant)
+          (scored . score)))))
+
+    (setq gnus-newsgroup-unreads 
+         (gnus-set-difference
+          (gnus-set-difference gnus-newsgroup-unreads gnus-newsgroup-marked)
+          gnus-newsgroup-dormant))
+
+    (setq gnus-newsgroup-processable nil)
+    
     (setq articles (gnus-articles-to-read group read-all))
-
+    
     (cond 
      ((null articles) 
       (gnus-message 3 "Couldn't select newsgroup")
@@ -7428,26 +7577,10 @@ If READ-ALL is non-nil, all articles in the group are selected."
             gnus-newsgroup-unreads
             (mapcar (lambda (headers) (mail-header-number headers))
                     gnus-newsgroup-headers)))
-      ;; Adjust and set lists of article marks.
-      (and info
-          (let (marked)
-            (gnus-adjust-marked-articles info)
-            (setq gnus-newsgroup-marked 
-                  (copy-sequence
-                   (cdr (assq 'tick (setq marked (nth 3 info))))))
-            (setq gnus-newsgroup-replied 
-                  (copy-sequence (cdr (assq 'reply marked))))
-            (setq gnus-newsgroup-expirable
-                  (copy-sequence (cdr (assq 'expire marked))))
-            (setq gnus-newsgroup-killed
-                  (copy-sequence (cdr (assq 'killed marked))))
-            (setq gnus-newsgroup-bookmarks 
-                  (copy-sequence (cdr (assq 'bookmark marked))))
-            (setq gnus-newsgroup-dormant 
-                  (copy-sequence (cdr (assq 'dormant marked))))
-            (setq gnus-newsgroup-scored 
-                  (copy-sequence (cdr (assq 'score marked))))
-            (setq gnus-newsgroup-processable nil)))
+      ;; We might want to build some more threads first.
+      (and gnus-fetch-old-headers
+          (eq gnus-headers-retrieved-by 'nov)
+          (gnus-build-old-threads))
       ;; Check whether auto-expire is to be done in this group.
       (setq gnus-newsgroup-auto-expire
            (gnus-group-auto-expirable-p group))
@@ -7465,14 +7598,17 @@ If READ-ALL is non-nil, all articles in the group are selected."
 (defun gnus-articles-to-read (group read-all)
   ;; Find out what articles the user wants to read.
   (let* ((articles
-         ;; Select all articles if `read-all' is non-nil, or if all the
-         ;; unread articles are dormant articles.
-         (if (or (and read-all (not (numberp read-all)))
-                 (= (length gnus-newsgroup-unreads) 
-                    (length gnus-newsgroup-dormant)))
-             (gnus-uncompress-range 
-              (gnus-gethash group gnus-active-hashtb))
-           gnus-newsgroup-unreads))
+         ;; Select all articles if `read-all' is non-nil, or if there
+         ;; are no unread articles.
+         (if (or read-all
+                 (zerop (length gnus-newsgroup-unreads)))
+             (if (zerop (length gnus-newsgroup-marked))
+                 (gnus-uncompress-range 
+                  (gnus-gethash group gnus-active-hashtb))
+               gnus-newsgroup-marked)
+           (sort (append gnus-newsgroup-dormant gnus-newsgroup-marked 
+                         (copy-sequence gnus-newsgroup-unreads))
+                 '<)))
         (scored-list (gnus-killed-articles gnus-newsgroup-killed articles))
         (scored (length scored-list))
         (number (length articles))
@@ -7537,60 +7673,62 @@ If READ-ALL is non-nil, all articles in the group are selected."
 
 (defun gnus-adjust-marked-articles (info &optional active)
   "Remove all marked articles that are no longer legal."
-  (let ((marked-lists (nth 3 info))
-       (active (or active (gnus-gethash (car info) gnus-active-hashtb)))
-       m prev)
+  (let* ((marked-lists (gnus-info-marks info))
+        (active (or active (gnus-gethash (gnus-info-group info)
+                                         gnus-active-hashtb)))
+        (min (car active))
+        m prev)
     ;; There are many types of marked articles.
     (while marked-lists
       (setq m (cdr (setq prev (car marked-lists))))
-      (cond ((or (eq 'tick (car prev)) (eq 'dormant (car prev)))
-            ;; Make sure that all ticked articles are a subset of the
-            ;; unread/unselected articles.
-            (while m
-              (if (or (memq (car m) gnus-newsgroup-unreads)
-                      (memq (car m) gnus-newsgroup-unselected))
-                  (setq prev m)
-                (setcdr prev (cdr m)))
-              (setq m (cdr m))))
-           ((eq 'score (car prev))
-            ;; Scored articles should be a subset of
-            ;; unread/unselected articles. 
-            (while m
-              (if (or (memq (car (car m)) gnus-newsgroup-unreads)
-                      (memq (car (car m)) gnus-newsgroup-unreads))
-                  (setq prev m)
-                (setcdr prev (cdr m)))
-              (setq m (cdr m))))
-           ((eq 'bookmark (car prev))
-            ;; Bookmarks should be a subset of active articles.
-            (while m
-              (if (< (car (car m)) (car active))
-                  (setcdr prev (cdr m))
-                (setq prev m))
-              (setq m (cdr m))))
-           ((eq 'killed (car prev))
-            ;; Articles that have been through the kill process are
-            ;; to be a subset of active articles.
-            (while (and m (< (or (and (numberp (car m)) (car m))
-                                 (cdr (car m)))
-                             (car active)))
-              (setcdr prev (cdr m))
-              (setq m (cdr m)))
-            (if (and m (< (or (and (numberp (car m)) (car m))
-                              (car (car m)))
-                          (car active))) 
-                (setcar (if (numberp (car m)) m (car m)) (car active))))
-           ((or (eq 'reply (car prev)) (eq 'expire (car prev)))
-            ;; The replied and expirable articles have to be articles
-            ;; that are active. 
-            (while m
-              (if (< (car m) (car active))
-                  (setcdr prev (cdr m))
-                (setq prev m))
-              (setq m (cdr m)))))
+      (cond
+       ((or (eq 'tick (car prev)) (eq 'dormant (car prev)))
+       ;; Make sure that all ticked articles are a subset of the
+       ;; active articles. 
+       (while m
+         (if (< (car m) min)
+             (setcdr prev (cdr m))
+           (setq prev m))
+         (setq m (cdr m))))
+       ((eq 'score (car prev))
+       ;; Scored articles should be a subset of
+       ;; unread/unselected articles. 
+       (while m
+         (if (or (memq (car (car m)) gnus-newsgroup-unreads)
+                 (memq (car (car m)) gnus-newsgroup-unreads))
+             (setq prev m)
+           (setcdr prev (cdr m)))
+         (setq m (cdr m))))
+       ((eq 'bookmark (car prev))
+       ;; Bookmarks should be a subset of active articles.
+       (while m
+         (if (< (car (car m)) min)
+             (setcdr prev (cdr m))
+           (setq prev m))
+         (setq m (cdr m))))
+       ((eq 'killed (car prev))
+       ;; Articles that have been through the kill process are
+       ;; to be a subset of active articles.
+       (while (and m (< (or (and (numberp (car m)) (car m))
+                            (cdr (car m)))
+                        min))
+         (setcdr prev (cdr m))
+         (setq m (cdr m)))
+       (if (and m (< (or (and (numberp (car m)) (car m))
+                         (car (car m)))
+                     min)) 
+           (setcar (if (numberp (car m)) m (car m)) min)))
+       ((or (eq 'reply (car prev)) (eq 'expire (car prev)))
+       ;; The replied and expirable articles have to be articles
+       ;; that are active. 
+       (while m
+         (if (< (car m) min)
+             (setcdr prev (cdr m))
+           (setq prev m))
+         (setq m (cdr m)))))
       (setq marked-lists (cdr marked-lists)))
     ;; Remove all lists that are empty.
-    (setq marked-lists (nth 3 info))
+    (setq marked-lists (gnus-info-marks info))
     (if marked-lists
        (progn
          (while (= 1 (length (car marked-lists)))
@@ -7601,7 +7739,7 @@ If READ-ALL is non-nil, all articles in the group are selected."
                (setcdr prev (cdr m))
              (setq prev m))
            (setq m (cdr m)))
-         (setcar (nthcdr 3 info) marked-lists)))
+         (gnus-info-set-marks info marked-lists)))
     ;; Finally, if there are no marked lists at all left, and if there
     ;; are no elements after the lists in the info list, we just chop
     ;; the info list off before the marked lists.
@@ -7634,9 +7772,9 @@ If READ-ALL is non-nil, all articles in the group are selected."
 
 (defun gnus-add-marked-articles (group type articles &optional info force)
   ;; Add ARTICLES of TYPE to the info of GROUP.
-  ;; If INFO is non-nil, use that info. If FORCE is non-nil, don't
+  ;; If INFO is non-nil, use that info.  If FORCE is non-nil, don't
   ;; add, but replace marked articles of TYPE with ARTICLES.
-  (let ((info (or info (nth 2 (gnus-gethash group gnus-newsrc-hashtb))))
+  (let ((info (or info (gnus-get-info group)))
        marked m)
     (or (not info)
        (and (not (setq marked (nthcdr 3 info)))
@@ -7650,49 +7788,51 @@ If READ-ALL is non-nil, all articles in the group are selected."
 (defun gnus-set-mode-line (where)
   "This function sets the mode line of the article or summary buffers.
 If WHERE is `summary', the summary mode line format will be used."
-  (if (memq where gnus-updated-mode-lines)
-      (let (mode-string)
-       (save-excursion
-         (set-buffer gnus-summary-buffer)
-         (let* ((mformat (if (eq where 'article) 
-                             gnus-article-mode-line-format-spec
-                           gnus-summary-mode-line-format-spec))
-                (gnus-tmp-group-name gnus-newsgroup-name)
-                (gnus-tmp-article-number (or gnus-current-article 0))
-                (gnus-tmp-unread (- (length gnus-newsgroup-unreads)
-                                    (length gnus-newsgroup-dormant)))
-                (gnus-tmp-unread-and-unticked 
-                 (- gnus-tmp-unread (length gnus-newsgroup-marked)))
-                (gnus-tmp-unselected (length gnus-newsgroup-unselected))
-                (gnus-tmp-unread-and-unselected
-                 (cond ((and (zerop gnus-tmp-unread-and-unticked)
-                             (zerop gnus-tmp-unselected)) "")
-                       ((zerop gnus-tmp-unselected) 
-                        (format "{%d more}" gnus-tmp-unread-and-unticked))
-                       (t (format "{%d(+%d) more}"
-                                  gnus-tmp-unread-and-unticked
-                                  gnus-tmp-unselected))))
-                (gnus-tmp-subject
-                 (if gnus-current-headers
-                     (mail-header-subject gnus-current-headers) ""))
-                (max-len (and gnus-mode-non-string-length
-                              (- (frame-width) gnus-mode-non-string-length)))
-                header);; passed as argument to any user-format-funcs
-           (setq mode-string (eval mformat))
-            (or (numberp max-len)
-               (setq max-len (length mode-string)))
-           (if (< max-len 4) (setq max-len 4))
-           (if (> (length mode-string) max-len)
-               ;; modified by MORIOKA Tomohiko <morioka@jaist.ac.jp>
-               ;;  function `substring' might cut on a middle
-               ;;  of multi-octet character.
-               (setq mode-string 
-                     (concat (gnus-truncate-string mode-string (- max-len 3))
-                             "...")))
-           (setq mode-string (format (format "%%-%ds" max-len)
-                                     mode-string))))
-       (setq mode-line-buffer-identification mode-string)
-       (set-buffer-modified-p t))))
+  ;; Is this mode line one we keep updated?
+  (when (memq where gnus-updated-mode-lines)
+    (let (mode-string)
+      (save-excursion
+       ;; We evaluate this in the summary buffer since these
+       ;; variables are buffer-local to that buffer.
+       (set-buffer gnus-summary-buffer)
+       ;; We bind all these variables that are used in the `eval' form
+       ;; below. 
+       (let* ((mformat (if (eq where 'article) 
+                           gnus-article-mode-line-format-spec
+                         gnus-summary-mode-line-format-spec))
+              (gnus-tmp-group-name gnus-newsgroup-name)
+              (gnus-tmp-article-number (or gnus-current-article 0))
+              (gnus-tmp-unread gnus-newsgroup-unreads)
+              (gnus-tmp-unread-and-unticked (length gnus-newsgroup-unreads))
+              (gnus-tmp-unselected (length gnus-newsgroup-unselected))
+              (gnus-tmp-unread-and-unselected
+               (cond ((and (zerop gnus-tmp-unread-and-unticked)
+                           (zerop gnus-tmp-unselected)) "")
+                     ((zerop gnus-tmp-unselected) 
+                      (format "{%d more}" gnus-tmp-unread-and-unticked))
+                     (t (format "{%d(+%d) more}"
+                                gnus-tmp-unread-and-unticked
+                                gnus-tmp-unselected))))
+              (gnus-tmp-subject
+               (if gnus-current-headers
+                   (mail-header-subject gnus-current-headers) ""))
+              max-len 
+              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) 
+                                     gnus-mode-non-string-length)
+                                (length mode-string))))
+         ;; We might have to chop a bit of the string off...
+         (when (> (length mode-string) max-len)
+           (setq mode-string 
+                 (concat (gnus-truncate-string mode-string (- max-len 3))
+                         "...")))
+         ;; Pad the mode string a bit.
+         (setq mode-string (format (format "%%-%ds" max-len) mode-string))))
+      ;; Update the mode line.
+      (setq mode-line-buffer-identification mode-string)
+      (set-buffer-modified-p t))))
 
 (defun gnus-create-xref-hashtb (from-newsgroup headers unreads ticked dormant)
   "Go through the HEADERS list and add all Xrefs to a hash table.
@@ -7750,7 +7890,7 @@ The resulting hash table is returned, or nil if no Xrefs were found."
               (if (and (prog1 
                            (setq entry (gnus-gethash name gnus-newsrc-hashtb)
                                  info (nth 2 entry))
-                         (if (stringp (setq nth4 (nth 4 info)))
+                         (if (stringp (setq nth4 (gnus-info-method info)))
                              (setq nth4 (gnus-server-to-method nth4))))
                        ;; Only do the xrefs if the group has the same
                        ;; select method as the group we have just read.
@@ -7767,7 +7907,7 @@ The resulting hash table is returned, or nil if no Xrefs were found."
                            virtual
                            ;; Only do cross-references on subscribed
                            ;; groups, if that is what is wanted.  
-                           (<= (nth 1 info) gnus-level-subscribed)))
+                           (<= (gnus-info-level info) gnus-level-subscribed)))
                   (gnus-group-make-articles-read name idlist expirable))))
           xref-hashtb)))))
 
@@ -7780,8 +7920,6 @@ The resulting hash table is returned, or nil if no Xrefs were found."
     ;; First peel off all illegal article numbers.
     (if active
        (let ((ids articles)
-             (ticked (cdr (assq 'tick (nth 3 info))))
-             (dormant (cdr (assq 'dormant (nth 3 info))))
              id first)
          (setq exps nil)
          (while ids
@@ -7789,34 +7927,34 @@ The resulting hash table is returned, or nil if no Xrefs were found."
            (if (and first (> id (cdr active)))
                (progn
                  ;; We'll end up in this situation in one particular
-                 ;; obscure situation. If you re-scan a group and get
+                 ;; obscure situation.  If you re-scan a group and get
                  ;; a new article that is cross-posted to a different
                  ;; group that has not been re-scanned, you might get
                  ;; crossposted article that has a higher number than
-                 ;; Gnus believes possible. So we re-activate this
-                 ;; group as well. This might mean doing the
+                 ;; Gnus believes possible.  So we re-activate this
+                 ;; group as well.  This might mean doing the
                  ;; crossposting thingie will *increase* the number
-                 ;; of articles in some groups. Tsk, tsk.
+                 ;; of articles in some groups.  Tsk, tsk.
                  (setq active (or (gnus-activate-group group) active))))
            (if (or (> id (cdr active))
-                   (< id (car active))
-                   (memq id ticked)
-                   (memq id dormant))
+                   (< id (car active)))
                (setq articles (delq id articles)))
            (and (memq id expirable)
                 (setq exps (cons id exps)))
            (setq ids (cdr ids)))))
     ;; Update expirable articles.
     (gnus-add-marked-articles nil 'expirable exps info)
+    ;; If the read list is nil, we init it.
     (and active
-        (null (nth 2 info))
+        (null (gnus-info-read info))
         (> (car active) 1)
-        (setcar (nthcdr 2 info) (cons 1 (1- (car active)))))
-    (setcar (nthcdr 2 info)
-           (setq range
-                 (gnus-add-to-range 
-                  (nth 2 info) 
-                  (setq articles (sort articles '<)))))
+        (gnus-info-set-read info (cons 1 (1- (car active)))))
+    ;; Then we add the read articles to the range.
+    (gnus-info-set-read
+     info
+     (setq range
+          (gnus-add-to-range 
+           (gnus-info-read info) (setq articles (sort articles '<)))))
     ;; Then we have to re-compute how many unread
     ;; articles there are in this group.
     (if active
@@ -7836,12 +7974,7 @@ The resulting hash table is returned, or nil if no Xrefs were found."
              (setq range (cdr range)))
            (setq num (- (cdr active) num))))
          ;; Update the number of unread articles.
-         (setcar 
-          entry 
-          (max 0 (- num 
-                    (length (cdr (assq 'tick (nth 3 info))))
-                    (length 
-                     (cdr (assq 'dormant (nth 3 info)))))))
+         (setcar entry num)
          ;; Update the group buffer.
          (gnus-group-update-group group t)))))
 
@@ -7870,7 +8003,7 @@ The resulting hash table is returned, or nil if no Xrefs were found."
       (let ((case-fold-search t)
            in-reply-to header number p lines)
        (goto-char (point-min))
-       ;; Search to the beginning of the next header. Error messages
+       ;; Search to the beginning of the next header.  Error messages
        ;; do not begin with 2 or 3.
        (while (re-search-forward "^[23][0-9]+ " nil t)
          (setq id nil
@@ -7878,8 +8011,8 @@ The resulting hash table is returned, or nil if no Xrefs were found."
          ;; This implementation of this function, with nine
          ;; search-forwards instead of the one re-search-forward and
          ;; a case (which basically was the old function) is actually
-         ;; about twice as fast, even though it looks messier. You
-         ;; can't have everything, I guess. Speed and elegance
+         ;; about twice as fast, even though it looks messier.  You
+         ;; can't have everything, I guess.  Speed and elegance
          ;; doesn't always go hand in hand.
          (setq 
           header
@@ -7966,9 +8099,9 @@ The resulting hash table is returned, or nil if no Xrefs were found."
                   (gnus-gethash id gnus-nocem-hashtb))
              ;; Banned article.
              (setq header nil)
-           ;; We do the threading while we read the headers. The
+           ;; We do the threading while we read the headers.  The
            ;; message-id and the last reference are both entered into
-           ;; the same hash table. Some tippy-toeing around has to be
+           ;; the same hash table.  Some tippy-toeing around has to be
            ;; done in case an article has arrived before the article
            ;; which it refers to.
            (if (boundp (setq id-dep (intern (downcase id) dependencies)))
@@ -8171,7 +8304,7 @@ This is meant to be called in `gnus-article-internal-prepare-hook'."
       number)))
 
 (defun gnus-summary-work-articles (n)
-  "Return a list of articles to be worked upon. The prefix argument,
+  "Return a list of articles to be worked upon.  The prefix argument,
 the list of process marked articles, and the current article will be
 taken into consideration."
   (let (articles article)
@@ -8212,26 +8345,29 @@ 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)))
-          (arts (cdr (gnus-data-find-list article)))
+          (arts (gnus-data-find-list article))
           result)
-      (if (setq result
+      (unless gnus-summary-check-current
+       (setq arts (cdr arts)))
+      (when (setq result
                (if unread
                    (progn
                      (while arts
-                       (and (gnus-data-unread-p (car arts))
-                            (setq result (car arts)
-                                  arts nil))
+                       (when (gnus-data-unread-p (car arts))
+                         (setq result (car arts)
+                               arts nil))
                        (setq arts (cdr arts)))
                      result)
                  (car arts)))
-         (progn
-           (goto-char (gnus-data-pos result))
-           (gnus-data-number result))))))
+       (goto-char (gnus-data-pos result))
+       (gnus-data-number result)))))
 
 (defun gnus-summary-find-prev (&optional unread article)
   (let* ((article (or article (gnus-summary-article-number)))
-        result arts)
-    (setq arts (cdr (gnus-data-find-list article (gnus-data-list 'rev))))
+        (arts (gnus-data-find-list article (gnus-data-list 'rev)))
+        result)
+    (unless gnus-summary-check-current
+      (setq arts (cdr arts)))
     (if (setq result
              (if unread
                  (progn
@@ -8249,8 +8385,10 @@ If EXCLUDE-GROUP, do not go to this group."
 (defun gnus-summary-find-subject (subject &optional unread backward article)
   (let* ((article (or article (gnus-summary-article-number)))
         (articles (gnus-data-list backward))
-        (arts (cdr (gnus-data-find-list article articles)))
+        (arts (gnus-data-find-list article articles))
         result)
+    (unless gnus-summary-check-current
+      (setq arts (cdr arts)))
     (while arts
       (and (or (not unread)
               (gnus-data-unread-p (car arts)))
@@ -8277,7 +8415,7 @@ If EXCLUDE-GROUP, do not go to this group."
 If `gnus-auto-center-summary' is nil, or the article buffer isn't
 displayed, no centering will be performed." 
   ;; Suggested by earle@mahendo.JPL.NASA.GOV (Greg Earle).
-  ;; Recenter only when requested. Suggested by popovich@park.cs.columbia.edu.
+  ;; Recenter only when requested.  Suggested by popovich@park.cs.columbia.edu.
   (let* ((top (cond ((< (window-height) 4) 0)
                    ((< (window-height) 7) 1)
                    (t 2)))
@@ -8340,7 +8478,7 @@ displayed, no centering will be performed."
 ;; difference between the ranges of read articles in this group and
 ;; the range of active articles.
 (defun gnus-list-of-unread-articles (group)
-  (let* ((read (nth 2 (nth 2 (gnus-gethash group gnus-newsrc-hashtb))))
+  (let* ((read (gnus-info-read (gnus-get-info group)))
         (active (gnus-gethash group gnus-active-hashtb))
         (last (cdr active))
         first nlast unread)
@@ -8349,7 +8487,7 @@ displayed, no centering will be performed."
        (setq first (car active))
       ;; If the range of read articles is a single range, then the
       ;; first unread article is the article after the last read
-      ;; article. Sounds logical, doesn't it?
+      ;; article.  Sounds logical, doesn't it?
       (if (not (listp (cdr read)))
          (setq first (1+ (cdr read)))
        ;; `read' is a list of ranges.
@@ -8374,12 +8512,17 @@ displayed, no centering will be performed."
     (nreverse unread)))
 
 (defun gnus-list-of-read-articles (group)
-  (let ((info (nth 2 (gnus-gethash group gnus-newsrc-hashtb)))
-       (active (gnus-gethash group gnus-active-hashtb)))
+  (let* ((info (gnus-get-info group))
+        (marked (gnus-info-marks info))
+        (active (gnus-gethash group gnus-active-hashtb)))
     (and info active
-        (gnus-sorted-complement 
-         (gnus-uncompress-range active) 
-         (gnus-list-of-unread-articles group)))))
+        (gnus-set-difference
+         (gnus-sorted-complement 
+          (gnus-uncompress-range active) 
+          (gnus-list-of-unread-articles group))
+         (append 
+          (cdr (assq 'dormant marked))
+          (cdr (assq 'tick marked)))))))
 
 ;; Various summary commands
 
@@ -8439,18 +8582,18 @@ The prefix argument ALL means to select all articles."
 
 (defun gnus-summary-update-info ()
   (let* ((group gnus-newsgroup-name))
-    (if gnus-newsgroup-kill-headers
-       (setq gnus-newsgroup-killed
-             (gnus-compress-sequence
-              (nconc
-               (gnus-set-sorted-intersection
-                (gnus-uncompress-range gnus-newsgroup-killed)
-                (setq gnus-newsgroup-unselected
-                      (sort gnus-newsgroup-unselected '<)))
-               (setq gnus-newsgroup-unreads
-                     (sort gnus-newsgroup-unreads '<))) t)))
-    (or (listp (cdr gnus-newsgroup-killed))
-       (setq gnus-newsgroup-killed (list gnus-newsgroup-killed)))
+    (when gnus-newsgroup-kill-headers
+      (setq gnus-newsgroup-killed
+           (gnus-compress-sequence
+            (nconc
+             (gnus-set-sorted-intersection
+              (gnus-uncompress-range gnus-newsgroup-killed)
+              (setq gnus-newsgroup-unselected
+                    (sort gnus-newsgroup-unselected '<)))
+             (setq gnus-newsgroup-unreads
+                   (sort gnus-newsgroup-unreads '<))) t)))
+    (unless (listp (cdr gnus-newsgroup-killed))
+      (setq gnus-newsgroup-killed (list gnus-newsgroup-killed)))
     (let ((headers gnus-newsgroup-headers))
       (gnus-close-group group)
       (run-hooks 'gnus-exit-group-hook)
@@ -8461,19 +8604,18 @@ The prefix argument ALL means to select all articles."
        gnus-newsgroup-killed gnus-newsgroup-dormant
        gnus-newsgroup-bookmarks 
        (and gnus-save-score gnus-newsgroup-scored))
-      (and gnus-use-cross-reference
-          (gnus-mark-xrefs-as-read 
-           group headers gnus-newsgroup-unreads gnus-newsgroup-expirable
-           gnus-newsgroup-marked gnus-newsgroup-dormant))
+      (when gnus-use-cross-reference
+       (gnus-mark-xrefs-as-read 
+        group headers gnus-newsgroup-unreads gnus-newsgroup-expirable
+        gnus-newsgroup-marked gnus-newsgroup-dormant))
       ;; Do adaptive scoring, and possibly save score files.
-      (and gnus-newsgroup-adaptive
-          (gnus-score-adaptive))
-      (and gnus-use-scoring 
-          (fboundp 'gnus-score-save)
-          (funcall 'gnus-score-save))
+      (when gnus-newsgroup-adaptive
+       (gnus-score-adaptive))
+      (when gnus-use-scoring 
+       (gnus-score-save))
       ;; Do not switch windows but change the buffer to work.
       (set-buffer gnus-group-buffer)
-      (or (assoc 'quit-config (gnus-find-method-for-group gnus-newsgroup-name))
+      (or (gnus-ephemeral-group-p gnus-newsgroup-name)
          (gnus-group-update-group group)))))
   
 (defun gnus-summary-exit (&optional temporary)
@@ -8483,8 +8625,7 @@ gnus-exit-group-hook is called with no arguments if that value is non-nil."
   (gnus-set-global-variables)
   (gnus-kill-save-kill-buffer)
   (let* ((group gnus-newsgroup-name)
-        (quit-config (nth 1 (assoc 'quit-config (gnus-find-method-for-group
-                                                 gnus-newsgroup-name))))
+        (quit-config (gnus-group-quit-config gnus-newsgroup-name))
         (mode major-mode)
         (buf (current-buffer)))
     (run-hooks 'gnus-summary-prepare-exit-hook)
@@ -8500,9 +8641,9 @@ gnus-exit-group-hook is called with no arguments if that value is non-nil."
          (gnus-group-next-unread-group 1)))
     (if temporary
        nil                             ;Nothing to do.
-      ;; We set all buffer-local variables to nil. It is unclear why
+      ;; We set all buffer-local variables to nil.  It is unclear why
       ;; this is needed, but if we don't, buffer-local variables are
-      ;; not garbage-collected, it seems. This would the lead to en
+      ;; not garbage-collected, it seems.  This would the lead to en
       ;; ever-growing Emacs.
       (set-buffer buf)
       (gnus-summary-clear-local-variables)
@@ -8535,8 +8676,7 @@ gnus-exit-group-hook is called with no arguments if that value is non-nil."
   (interactive)
   (gnus-set-global-variables)
   (let* ((group gnus-newsgroup-name)
-        (quit-config (nth 1 (assoc 'quit-config 
-                                   (gnus-find-method-for-group group)))))
+        (quit-config (gnus-group-quit-config group)))
     (if (or no-questions
            gnus-expert-user
            (gnus-y-or-n-p "Do you really wanna quit reading this group? "))
@@ -8595,7 +8735,7 @@ in."
 (defun gnus-summary-next-group (&optional no-article target-group backward)
   "Exit current newsgroup and then select next unread newsgroup.
 If prefix argument NO-ARTICLE is non-nil, no article is selected
-initially. If NEXT-GROUP, go to this group. If BACKWARD, go to
+initially.  If NEXT-GROUP, go to this group.  If BACKWARD, go to
 previous group instead."
   (interactive "P")
   (gnus-set-global-variables)
@@ -8712,7 +8852,7 @@ If optional argument UNREAD is non-nil, only unread article is selected."
   (interactive "p")
   (gnus-summary-next-subject (- n) t))
 
-(defun gnus-summary-goto-subject (article &optional force)
+(defun gnus-summary-goto-subject (article &optional force silent)
   "Go the subject line of ARTICLE.
 If FORCE, also allow jumping to articles not currently shown."
   (let ((b (point))
@@ -8723,7 +8863,7 @@ If FORCE, also allow jumping to articles not currently shown."
         (gnus-summary-insert-subject article)
         (setq data (gnus-data-find article)))
     (goto-char b)
-    (if (not data)
+    (if (and (not silent) (not data))
        (progn
          (message "Can't find article %d" article)
          nil)
@@ -8823,14 +8963,14 @@ If BACKWARD, the previous article is selected instead of the next."
        nil t))
      ;; Go to next/previous group.
      (t
-      (or (assoc 'quit-config (gnus-find-method-for-group gnus-newsgroup-name))
+      (or (gnus-ephemeral-group-p gnus-newsgroup-name)
          (gnus-summary-jump-to-group gnus-newsgroup-name))
       (let ((cmd last-command-char)
            (group 
             (if (eq gnus-keep-same-level 'best) 
                 (gnus-summary-best-group gnus-newsgroup-name)
               (gnus-summary-search-group backward gnus-keep-same-level))))
-       ;; For some reason, the group window gets selected. We change
+       ;; For some reason, the group window gets selected.  We change
        ;; it back.  
        (select-window (get-buffer-window (current-buffer)))
        ;; Keep just the event type of CMD.
@@ -8843,8 +8983,7 @@ If BACKWARD, the previous article is selected instead of the next."
              (and (eq gnus-auto-select-next 'almost-quietly)
                   (gnus-summary-last-article-p)))
          ;; Select quietly.
-         (if (assoc 'quit-config (gnus-find-method-for-group 
-                                  gnus-newsgroup-name))
+         (if (gnus-ephemeral-group-p gnus-newsgroup-name)
              (gnus-summary-exit)
            (gnus-message 7 "No more%s articles (%s)..."
                          (if unread " unread" "") 
@@ -8857,9 +8996,8 @@ If BACKWARD, the previous article is selected instead of the next."
            (while (or (null key) (memq key keystrokes))
              (gnus-message 
               7 "No more%s articles%s" (if unread " unread" "")
-              (if (and group (not (assoc 'quit-config
-                                         (gnus-find-method-for-group 
-                                          gnus-newsgroup-name))))
+              (if (and group 
+                       (not (gnus-ephemeral-group-p gnus-newsgroup-name)))
                   (format " (Type %s for %s [%s])"
                           (single-key-description cmd) group
                           (car (gnus-gethash group gnus-newsrc-hashtb)))
@@ -8880,9 +9018,8 @@ If BACKWARD, the previous article is selected instead of the next."
                      (setq group (gnus-group-group-name))
                      (switch-to-buffer obuf)))))
            (if (equal key cmd)
-               (if (or (not group) (assoc 'quit-config
-                                          (gnus-find-method-for-group
-                                           gnus-newsgroup-name)))
+               (if (or (not group)
+                       (gnus-ephemeral-group-p gnus-newsgroup-name))
                    (gnus-summary-exit)
                  (gnus-summary-next-group nil group backward))
              (execute-kbd-macro (char-to-string key)))))))))))
@@ -9096,7 +9233,7 @@ If given a prefix, remove all limits."
   (interactive "sRegexp: ")
   (when (not (equal "" subject))
     (prog1
-       (let ((articles (gnus-summary-find-matching "subject" subject)))
+       (let ((articles (gnus-summary-find-matching "subject" subject 'all)))
          (or articles (error "Found no matches for \"%s\"" subject))
          (gnus-summary-limit articles))
       (gnus-summary-position-point))))
@@ -9153,13 +9290,13 @@ Returns how many articles were removed."
   (let ((data gnus-newsgroup-data)
        articles)
     (while data
-      (and (>= (gnus-summary-article-score (gnus-data-number (car data)))
-              score)
-          (setq articles (cons (gnus-data-number (car data)) articles)))
-      (setq data (cdr data))
-      (prog1
-         (gnus-summary-limit articles)
-       (gnus-summary-position-point)))))
+      (when (>= (gnus-summary-article-score (gnus-data-number (car data)))
+               score)
+       (push (gnus-data-number (car data)) articles))
+      (setq data (cdr data)))
+    (prog1
+       (gnus-summary-limit articles)
+      (gnus-summary-position-point))))
 
 (defun gnus-summary-limit-include-dormant ()
   "Display all the hidden articles that are marked as dormant."
@@ -9225,7 +9362,7 @@ Returns how many articles were removed."
          (setq data (cdr data))))
     (or found
        ;; If there is no data, that means that we were after the last
-       ;; article. The same goes when we can't find any articles
+       ;; article.  The same goes when we can't find any articles
        ;; after the current one.
        (progn
          (goto-char (point-max))
@@ -9267,7 +9404,8 @@ fetch-old-headers verbiage, and so on."
   (let ((children (apply '+ (mapcar (lambda (th)
                                      (gnus-summary-limit-children th))
                                    (cdr thread))))
-       (number (mail-header-number (car thread))))
+       (number (mail-header-number (car thread)))
+       score)
     (if (or 
         ;; If this article is dormant and has absolutely no visible
         ;; children, then this article isn't visible.
@@ -9276,16 +9414,23 @@ fetch-old-headers verbiage, and so on."
         ;; If this is a "fetch-old-headered" and there is only one
         ;; visible child (or less), then we don't want this article. 
         (and (eq gnus-fetch-old-headers 'some)
+             (memq number gnus-newsgroup-ancient)
              (<= children 1))
         ;; If we use expunging, and this article is really
         ;; low-scored, then we don't want this article.
-        (and gnus-summary-expunge-below
-             (< (or (cdr (assq number gnus-newsgroup-scored)) 
-                    gnus-summary-default-score)
-                gnus-summary-expunge-below)
-             ;; We increase the expunge-tally here, but that has
-             ;; nothing to do with the limits, really.
-             (incf gnus-newsgroup-expunged-tally)))
+        (when (and gnus-summary-expunge-below
+                   (< (setq score 
+                            (or (cdr (assq number gnus-newsgroup-scored)) 
+                                gnus-summary-default-score))
+                      gnus-summary-expunge-below))
+          ;; We increase the expunge-tally here, but that has
+          ;; nothing to do with the limits, really.
+          (incf gnus-newsgroup-expunged-tally)
+          ;; We also mark as read here, if that's wanted.
+          (when (< score gnus-summary-mark-below)
+            (setq gnus-newsgroup-unreads (delq number gnus-newsgroup-unreads))
+            (push (cons number gnus-low-score-mark) gnus-newsgroup-reads))
+          t))
        ;; Nope, invisible article.
        0
       ;; Ok, this article is to be visible, so we add it to the limit
@@ -9324,7 +9469,7 @@ The difference between N and the number of articles fetched is returned."
                 ;; the value we got from the server. 
                 (mail-header-references header))))
         (if ref
-            (or (gnus-summary-refer-article ref)
+            (or (gnus-summary-refer-article (gnus-parent-id ref))
                 (gnus-message 1 "Couldn't find parent"))
           (gnus-message 1 "No references in article %d"
                         (gnus-summary-article-number))
@@ -9339,12 +9484,17 @@ Return how many articles were fetched."
   (interactive)
   (gnus-set-global-variables)
   (let ((ref (mail-header-references (gnus-summary-article-header)))
+       (current (gnus-summary-article-number))
        (n 0))
-    (while (string-match "<[^]*>" ref)
-      (setq n (1+ n))
+    ;; For each Message-ID in the References header...
+    (while (string-match "<[^>]*>" ref)
+      (incf n)
+      ;; ... fetch that article.
       (gnus-summary-refer-article 
-       (substring ref (match-beginning 0) (match-end 0)))
-      (setq ref (substring ref (match-end 0))))
+       (prog1 (match-string 0 ref)
+        (setq ref (substring ref (match-end 0))))))
+    (gnus-summary-goto-subject current)
+    (gnus-summary-position-point)
     n))
     
 (defun gnus-summary-refer-article (message-id)
@@ -9393,7 +9543,7 @@ Return how many articles were fetched."
                    (list 'nndoc-address (get-buffer gnus-article-buffer))
                    '(nndoc-article-type digest))
         t)
-       (setcdr (nthcdr 4 (nth 2 (gnus-gethash name gnus-newsrc-hashtb)))
+       (setcdr (nthcdr 4 (gnus-get-info name))
                (list (list (cons 'to-group ogroup))))
       (switch-to-buffer buf)
       (gnus-set-global-variables)
@@ -9489,11 +9639,13 @@ gnus-select-article-hook is not called during the search."
                                          not-case-fold)
   "Return a list of all articles that match REGEXP on HEADER.
 The search stars on the current article and goes forwards unless
-BACKWARD is non-nil.  If UNREAD is non-nil, only unread articles will
+BACKWARD is non-nil.  If BACKWARD is `all', do all articles.
+If UNREAD is non-nil, only unread articles will
 be taken into consideration.  If NOT-CASE-FOLD, case won't be folded
 in the comparisons."
-  (let ((data (gnus-data-find-list (gnus-summary-article-number 
-                                   (gnus-data-list backward))))
+  (let ((data (if (eq backward 'all) gnus-newsgroup-data
+               (gnus-data-find-list 
+                (gnus-summary-article-number) (gnus-data-list backward))))
        (func (intern (concat "gnus-header-" header)))
        (case-fold-search (not not-case-fold))
        articles d)
@@ -9511,7 +9663,7 @@ in the comparisons."
 (defun gnus-summary-execute-command (header regexp command &optional backward)
   "Search forward for an article whose HEADER matches REGEXP and execute COMMAND.
 If HEADER is an empty string (or nil), the match is done on the entire
-article. If BACKWARD (the prefix) is non-nil, search backward instead."
+article.  If BACKWARD (the prefix) is non-nil, search backward instead."
   (interactive
    (list (let ((completion-ignore-case t))
           (completing-read 
@@ -9604,16 +9756,18 @@ If ARG is a negative number, hide the unwanted header lines."
     (set-buffer gnus-article-buffer)
     (let* ((buffer-read-only nil)
           (inhibit-point-motion-hooks t) 
-          (hidden (text-property-any (point-min) (search-forward "\n\n")
-                                     'invisible t))
+          (hidden (text-property-any 
+                   (goto-char (point-min)) (search-forward "\n\n")
+                   'invisible t))
           e)
       (goto-char (point-min))
-      (delete-region (point) (1- (search-forward "\n\n" nil t)))
+      (when (search-forward "\n\n" nil t)
+       (delete-region (point-min) (1- (point))))
       (goto-char (point-min))
       (save-excursion 
        (set-buffer gnus-original-article-buffer)
        (goto-char (point-min))
-       (setq e (1- (search-forward "\n\n"))))
+       (setq e (1- (or (search-forward "\n\n" nil t) (point-max)))))
       (insert-buffer-substring gnus-original-article-buffer 1 e)
       (let ((hook (delq 'gnus-article-hide-headers-if-wanted
                        (delq 'gnus-article-hide-headers
@@ -9740,9 +9894,9 @@ and `request-accept' functions. (Ie. mail newsgroups at present.)"
            (if (not info)
                ()                      ; This group does not exist yet.
              (if (not (memq article gnus-newsgroup-unreads))
-                 (setcar (cdr (cdr info))
-                         (gnus-add-to-range (nth 2 info) 
-                                            (list (cdr art-group)))))
+                 (gnus-info-set-read 
+                  info (gnus-add-to-range (gnus-info-read info) 
+                                          (list (cdr art-group)))))
 
              ;; Copy any marks over to the new group.
              (let ((marks '((tick . gnus-newsgroup-marked)
@@ -9755,7 +9909,7 @@ and `request-accept' functions. (Ie. mail newsgroups at present.)"
                ;; See whether the article is to be put in the cache.
                (when gnus-use-cache
                  (gnus-cache-possibly-enter-article 
-                  (car info) to-article
+                  (gnus-info-group info) to-article
                   (let ((header (copy-sequence
                                  (gnus-summary-article-header article))))
                     (mail-header-set-number header to-article)
@@ -9767,7 +9921,8 @@ and `request-accept' functions. (Ie. mail newsgroups at present.)"
                (while marks
                  (if (memq article (symbol-value (cdr (car marks))))
                      (gnus-add-marked-articles 
-                      (car info) (car (car marks)) (list to-article) info))
+                      (gnus-info-group info) (car (car marks))
+                      (list to-article) info))
                  (setq marks (cdr marks)))))
            ;; Update marks.
            (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
@@ -9779,7 +9934,8 @@ and `request-accept' functions. (Ie. mail newsgroups at present.)"
                        gnus-newsgroup-reads)))
        (gnus-message 1 "Couldn't move article %s" (car articles)))
       (gnus-summary-remove-process-mark (car articles))
-      (setq articles (cdr articles)))))
+      (setq articles (cdr articles)))
+    (gnus-set-mode-line 'summary)))
 
 (defun gnus-summary-respool-article (&optional n respool-method)
   "Respool the current article.
@@ -9883,9 +10039,9 @@ functions. (Ie. mail newsgroups at present.)"
            (if (not info)
                ()                      ; This group does not exist (yet).
              (if (not (memq article gnus-newsgroup-unreads))
-                 (setcar (cdr (cdr info))
-                         (gnus-add-to-range (nth 2 info) 
-                                            (list (cdr art-group)))))
+                 (gnus-info-set-read 
+                  info (gnus-add-to-range (gnus-info-read info) 
+                                          (list (cdr art-group)))))
 
              ;; Copy any marks over to the new group.
              (let ((marks '((tick . gnus-newsgroup-marked)
@@ -9898,7 +10054,7 @@ functions. (Ie. mail newsgroups at present.)"
              ;; See whether the article is to be put in the cache.
              (when gnus-use-cache
                (gnus-cache-possibly-enter-article 
-                (car info) to-article 
+                (gnus-info-group info) to-article 
                 (let ((header (copy-sequence
                                (gnus-summary-article-header article))))
                   (mail-header-set-number header to-article)
@@ -9910,7 +10066,8 @@ functions. (Ie. mail newsgroups at present.)"
              (while marks
                (if (memq article (symbol-value (cdr (car marks))))
                    (gnus-add-marked-articles 
-                    (car info) (car (car marks)) (list to-article) info))
+                    (gnus-info-group info) (car (car marks)) 
+                    (list to-article) info))
                (setq marks (cdr marks))))))
        (gnus-message 1 "Couldn't copy article %s" (car articles)))
       (gnus-summary-remove-process-mark (car articles))
@@ -9920,6 +10077,7 @@ functions. (Ie. mail newsgroups at present.)"
 (defun gnus-summary-import-article (file)
   "Import a random file into a mail newsgroup."
   (interactive "fImport file: ")
+  (gnus-set-global-variables)
   (let ((group gnus-newsgroup-name)
        atts lines)
     (or (gnus-check-backend-function 'request-accept-article group)
@@ -9949,30 +10107,33 @@ functions. (Ie. mail newsgroups at present.)"
 (defun gnus-summary-expire-articles ()
   "Expire all articles that are marked as expirable in the current group."
   (interactive)
-  (if (not (gnus-check-backend-function 
-           'request-expire-articles gnus-newsgroup-name))
-      ()
+  (gnus-set-global-variables)
+  (when (gnus-check-backend-function 
+        'request-expire-articles gnus-newsgroup-name)
+    ;; This backend supports expiry.
     (let* ((total (gnus-group-total-expirable-p gnus-newsgroup-name))
           (expirable (if total
                          (gnus-list-of-read-articles gnus-newsgroup-name)
                        (setq gnus-newsgroup-expirable
                              (sort gnus-newsgroup-expirable '<))))
           es)
-      (if (not expirable)
-         ()
+      (when expirable
+       ;; There are expirable articles in this group, so we run them
+       ;; through the expiry process.
        (gnus-message 6 "Expiring articles...")
        ;; The list of articles that weren't expired is returned.
        (setq es (gnus-request-expire-articles expirable gnus-newsgroup-name))
        (or total (setq gnus-newsgroup-expirable es))
        ;; We go through the old list of expirable, and mark all
        ;; really expired articles as non-existant.
-       (or (eq es expirable)           ;If nothing was expired, we don't mark.
-           (let ((gnus-use-cache nil))
-             (while expirable
-               (or (memq (car expirable) es)
-                   (gnus-summary-mark-article
-                    (car expirable) gnus-canceled-mark))
-               (setq expirable (cdr expirable)))))
+       (unless (eq es expirable)       ;If nothing was expired, we don't mark.
+         (let ((gnus-use-cache nil))
+           (while expirable
+             (unless (memq (car expirable) es)
+               (when (gnus-data-find (car expirable))
+                 (gnus-summary-mark-article
+                  (car expirable) gnus-canceled-mark)))
+             (setq expirable (cdr expirable)))))
        (gnus-message 6 "Expiring articles...done")))))
 
 (defun gnus-summary-expire-articles-now ()
@@ -9980,6 +10141,7 @@ functions. (Ie. mail newsgroups at present.)"
 This means that *all* articles that are marked as expirable will be
 deleted forever, right now."
   (interactive)
+  (gnus-set-global-variables)
   (or gnus-expert-user
       (gnus-y-or-n-p
        "Are you really, really, really sure you want to expunge? ")
@@ -9991,13 +10153,14 @@ deleted forever, right now."
 ;; Suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>.
 (defun gnus-summary-delete-article (&optional n)
   "Delete the N next (mail) articles.
-This command actually deletes articles. This is not a marking
-command. The article will disappear forever from your life, never to
+This command actually deletes articles.  This is not a marking
+command.  The article will disappear forever from your life, never to
 return. 
 If N is negative, delete backwards.
 If N is nil and articles have been marked with the process mark,
 delete these instead."
   (interactive "P")
+  (gnus-set-global-variables)
   (or (gnus-check-backend-function 'request-expire-articles 
                                   gnus-newsgroup-name)
       (error "The current newsgroup does not support article deletion."))
@@ -10021,6 +10184,7 @@ delete these instead."
            (gnus-summary-mark-article (car articles) gnus-canceled-mark))
        (setq articles (cdr articles))))
     (gnus-summary-position-point)
+    (gnus-set-mode-line 'summary)
     not-deleted))
 
 (defun gnus-summary-edit-article (&optional force)
@@ -10029,9 +10193,10 @@ This will have permanent effect only in mail groups.
 If FORCE is non-nil, allow editing of articles even in read-only
 groups."
   (interactive "P")
-  (or force
-      (not (gnus-group-read-only-p))
-      (error "The current newsgroup does not support article editing."))
+  (gnus-set-global-variables)
+  (when (and (not force)
+            (gnus-group-read-only-p))
+    (error "The current newsgroup does not support article editing."))
   (gnus-summary-select-article t)
   (gnus-configure-windows 'article)
   (select-window (get-buffer-window gnus-article-buffer))
@@ -10082,6 +10247,7 @@ groups."
 (defun gnus-summary-respool-query ()
   "Query where the respool algorithm would put this article."
   (interactive)
+  (gnus-set-global-variables)
   (gnus-summary-select-article)
   (save-excursion
     (set-buffer gnus-article-buffer)
@@ -10099,12 +10265,13 @@ groups."
 (defun gnus-summary-raise-score (n)
   "Raise the score of the current article by N."
   (interactive "p")
+  (gnus-set-global-variables)
   (gnus-summary-set-score (+ (gnus-summary-article-score) n)))
 
 (defun gnus-summary-set-score (n)
   "Set the score of the current article to N."
   (interactive "p")
-  ;; Skip dummy header line.
+  (gnus-set-global-variables)
   (save-excursion
     (gnus-summary-show-thread)
     (let ((buffer-read-only nil))
@@ -10123,77 +10290,23 @@ groups."
 (defun gnus-summary-current-score ()
   "Return the score of the current article."
   (interactive)
+  (gnus-set-global-variables)
   (message "%s" (gnus-summary-article-score)))
 
 ;; Summary marking commands.
 
-(defun gnus-summary-raise-same-subject-and-select (score)
-  "Raise articles which has the same subject with SCORE and select the next."
-  (interactive "p")
-  (let ((subject (gnus-summary-article-subject)))
-    (gnus-summary-raise-score score)
-    (while (gnus-summary-find-subject subject)
-      (gnus-summary-raise-score score))
-    (gnus-summary-next-article t)))
-
-(defun gnus-summary-raise-same-subject (score)
-  "Raise articles which has the same subject with SCORE."
-  (interactive "p")
-  (let ((subject (gnus-summary-article-subject)))
-    (gnus-summary-raise-score score)
-    (while (gnus-summary-find-subject subject)
-      (gnus-summary-raise-score score))
-    (gnus-summary-next-subject 1 t)))
-
-(defun gnus-score-default (level)
-  (if level (prefix-numeric-value level) 
-    gnus-score-interactive-default-score))
-
-(defun gnus-summary-raise-thread (&optional score)
-  "Raise the score of the articles in the current thread with SCORE."
-  (interactive "P")
-  (setq score (gnus-score-default score))
-  (let (e)
-    (save-excursion
-      (let ((articles (gnus-summary-articles-in-thread)))
-       (while articles
-         (gnus-summary-goto-subject (car articles))
-         (gnus-summary-raise-score score)
-         (setq articles (cdr articles))))
-      (setq e (point)))
-    (let ((gnus-summary-check-current t))
-      (or (zerop (gnus-summary-next-subject 1 t))
-         (goto-char e))))
-  (gnus-summary-recenter)
-  (gnus-summary-position-point)
-  (gnus-set-mode-line 'summary))
-
-(defun gnus-summary-lower-same-subject-and-select (score)
-  "Raise articles which has the same subject with SCORE and select the next."
-  (interactive "p")
-  (gnus-summary-raise-same-subject-and-select (- score)))
-
-(defun gnus-summary-lower-same-subject (score)
-  "Raise articles which has the same subject with SCORE."
-  (interactive "p")
-  (gnus-summary-raise-same-subject (- score)))
-
-(defun gnus-summary-lower-thread (&optional score)
-  "Lower score of articles in the current thread with SCORE."
-  (interactive "P")
-  (gnus-summary-raise-thread (- (1- (gnus-score-default score)))))
-
 (defun gnus-summary-kill-same-subject-and-select (&optional unmark)
   "Mark articles which has the same subject as read, and then select the next.
 If UNMARK is positive, remove any kind of mark.
 If UNMARK is negative, tick articles."
   (interactive "P")
+  (gnus-set-global-variables)
   (if unmark
       (setq unmark (prefix-numeric-value unmark)))
   (let ((count
         (gnus-summary-mark-same-subject
          (gnus-summary-article-subject) unmark)))
-    ;; Select next unread article. If auto-select-same mode, should
+    ;; Select next unread article.  If auto-select-same mode, should
     ;; select the first unread article.
     (gnus-summary-next-article t (and gnus-auto-select-same
                                      (gnus-summary-article-subject)))
@@ -10206,6 +10319,7 @@ If UNMARK is negative, tick articles."
 If UNMARK is positive, remove any kind of mark.
 If UNMARK is negative, tick articles."
   (interactive "P")
+  (gnus-set-global-variables)
   (if unmark
       (setq unmark (prefix-numeric-value unmark)))
   (let ((count
@@ -10256,6 +10370,7 @@ If N is negative, mark backward instead.  If UNMARK is non-nil, remove
 the process mark instead.  The difference between N and the actual
 number of articles marked is returned."
   (interactive "p")
+  (gnus-set-global-variables)
   (let ((backward (< n 0))
        (n (abs n)))
     (while (and 
@@ -10276,11 +10391,13 @@ number of articles marked is returned."
 If N is negative, mark backward instead.  The difference between N and
 the actual number of articles marked is returned."
   (interactive "p")
+  (gnus-set-global-variables)
   (gnus-summary-mark-as-processable n t))
 
 (defun gnus-summary-unmark-all-processable ()
   "Remove the process mark from all articles."
   (interactive)
+  (gnus-set-global-variables)
   (save-excursion
     (while gnus-newsgroup-processable
       (gnus-summary-remove-process-mark (car gnus-newsgroup-processable))))
@@ -10288,9 +10405,10 @@ the actual number of articles marked is returned."
 
 (defun gnus-summary-mark-as-expirable (n)
   "Mark N articles forward as expirable.
-If N is negative, mark backward instead. The difference between N and
+If N is negative, mark backward instead.  The difference between N and
 the actual number of articles marked is returned."
   (interactive "p")
+  (gnus-set-global-variables)
   (gnus-summary-mark-forward n gnus-expirable-mark))
 
 (defun gnus-summary-mark-article-as-replied (article)
@@ -10305,6 +10423,7 @@ the actual number of articles marked is returned."
 (defun gnus-summary-set-bookmark (article)
   "Set a bookmark in current article."
   (interactive (list (gnus-summary-article-number)))
+  (gnus-set-global-variables)
   (if (or (not (get-buffer gnus-article-buffer))
          (not gnus-current-article)
          (not gnus-article-current)
@@ -10334,6 +10453,7 @@ the actual number of articles marked is returned."
 (defun gnus-summary-remove-bookmark (article)
   "Remove the bookmark from the current article."
   (interactive (list (gnus-summary-article-number)))
+  (gnus-set-global-variables)
   ;; Remove old bookmark, if one exists.
   (let ((old (assq article gnus-newsgroup-bookmarks)))
     (if old 
@@ -10349,6 +10469,7 @@ the actual number of articles marked is returned."
 If N is negative, mark backward instead.  The difference between N and
 the actual number of articles marked is returned."
   (interactive "p")
+  (gnus-set-global-variables)
   (gnus-summary-mark-forward n gnus-dormant-mark))
 
 (defun gnus-summary-set-process-mark (article)
@@ -10376,7 +10497,7 @@ the actual number of articles marked is returned."
 (defun gnus-summary-mark-forward (n &optional mark no-expire)
   "Mark N articles as read forwards.
 If N is negative, mark backwards instead.
-Mark with MARK. If MARK is ? , ?! or ??, articles will be
+Mark with MARK.  If MARK is ? , ?! or ??, articles will be
 marked as unread. 
 The difference between N and the actual number of articles marked is
 returned."
@@ -10413,7 +10534,7 @@ returned."
     (and gnus-newsgroup-auto-expire 
         (or (= mark gnus-killed-mark) (= mark gnus-del-mark)
             (= mark gnus-catchup-mark) (= mark gnus-low-score-mark)
-            (= mark gnus-read-mark))
+            (= mark gnus-read-mark) (= mark gnus-souped-mark))
         (progn
           (setq mark gnus-expirable-mark)
           (setq gnus-newsgroup-expirable 
@@ -10425,18 +10546,19 @@ returned."
 (defun gnus-summary-mark-article-as-unread (mark)
   "Mark the current article quickly as unread with MARK."
   (let ((article (gnus-summary-article-number)))
-    (or (memq article gnus-newsgroup-unreads)
-       (setq gnus-newsgroup-unreads (cons article gnus-newsgroup-unreads)))
     (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
     (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
     (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable))
+    (setq gnus-newsgroup-reads (delq article gnus-newsgroup-reads))
+    (cond ((= mark gnus-ticked-mark)
+          (push article gnus-newsgroup-marked))
+         ((= mark gnus-dormant-mark)
+          (push article gnus-newsgroup-dormant))
+         (t     
+          (push article gnus-newsgroup-unreads)))
     (setq gnus-newsgroup-reads
          (delq (assq article gnus-newsgroup-reads)
                gnus-newsgroup-reads))
-    (if (= mark gnus-ticked-mark)
-       (setq gnus-newsgroup-marked (cons article gnus-newsgroup-marked)))
-    (if (= mark gnus-dormant-mark)
-       (setq gnus-newsgroup-dormant (cons article gnus-newsgroup-dormant)))
 
     ;; See whether the article is to be put in the cache.
     (and gnus-use-cache
@@ -10459,6 +10581,7 @@ Four MARK strings are reserved: `? ' (unread), `?!' (ticked), `??'
 If MARK is nil, then the default character `?D' is used.
 If ARTICLE is nil, then the article on the current line will be
 marked." 
+  ;; The mark might be a string.
   (and (stringp mark)
        (setq mark (aref mark 0)))
   ;; If no mark is given, then we check auto-expiring.
@@ -10468,7 +10591,7 @@ marked."
           (and (numberp mark) 
                (or (= mark gnus-killed-mark) (= mark gnus-del-mark)
                    (= mark gnus-catchup-mark) (= mark gnus-low-score-mark)
-                   (= mark gnus-read-mark))))
+                   (= mark gnus-read-mark) (= mark gnus-souped-mark))))
        (setq mark gnus-expirable-mark))
   (let* ((mark (or mark gnus-del-mark))
         (article (or article (gnus-summary-article-number))))
@@ -10490,7 +10613,7 @@ marked."
            (= mark gnus-ticked-mark)
            (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
 
-    (if (gnus-summary-goto-subject article)
+    (if (gnus-summary-goto-subject article nil t)
        (let ((buffer-read-only nil))
          (gnus-summary-show-thread)
          ;; Fix the mark.
@@ -10526,27 +10649,27 @@ marked."
     (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
     (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
     (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
-    (setq gnus-newsgroup-reads 
-         (cons (cons article mark) gnus-newsgroup-reads))
+    (push (cons article mark) gnus-newsgroup-reads)
     ;; Possibly remove from cache, if that is used. 
-    (and gnus-use-cache (gnus-cache-enter-remove-article article))))
+    (when gnus-use-cache 
+      (gnus-cache-enter-remove-article article))))
 
 (defun gnus-mark-article-as-unread (article &optional mark)
   "Enter ARTICLE in the pertinent lists and remove it from others."
   (let ((mark (or mark gnus-ticked-mark)))
-    ;; Add to unread list.
-    (or (memq article gnus-newsgroup-unreads)
-       (setq gnus-newsgroup-unreads (cons article gnus-newsgroup-unreads)))
     (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
     (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
     (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable))
+    (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
+    (cond ((= mark gnus-ticked-mark)
+          (push article gnus-newsgroup-marked))
+         ((= mark gnus-dormant-mark)
+          (push article gnus-newsgroup-dormant))
+         (t     
+          (push article gnus-newsgroup-unreads)))
     (setq gnus-newsgroup-reads
          (delq (assq article gnus-newsgroup-reads)
-               gnus-newsgroup-reads))
-    (if (= mark gnus-ticked-mark)
-       (setq gnus-newsgroup-marked (cons article gnus-newsgroup-marked)))
-    (if (= mark gnus-dormant-mark)
-       (setq gnus-newsgroup-dormant (cons article gnus-newsgroup-dormant)))))
+               gnus-newsgroup-reads))))
 
 (defalias 'gnus-summary-mark-as-unread-forward 
   'gnus-summary-tick-article-forward)
@@ -10614,10 +10737,8 @@ The difference between N and the number of marks cleared is returned."
 
 (defun gnus-summary-mark-unread-as-read ()
   "Intended to be used by `gnus-summary-mark-article-hook'."
-  (or (memq gnus-current-article gnus-newsgroup-marked)
-      (memq gnus-current-article gnus-newsgroup-dormant)
-      (memq gnus-current-article gnus-newsgroup-expirable)
-      (gnus-summary-mark-article gnus-current-article gnus-read-mark)))
+  (when (memq gnus-current-article gnus-newsgroup-unreads)
+    (gnus-summary-mark-article gnus-current-article gnus-read-mark)))
 
 (defun gnus-summary-mark-region-as-read (point mark all)
   "Mark all unread articles between point and mark as read.
@@ -10625,22 +10746,18 @@ If given a prefix, mark all articles between point and mark as read,
 even ticked and dormant ones."
   (interactive "r\nP")
   (save-excursion
-    (goto-char point)
-    (beginning-of-line)
-    (while (and 
-           (< (point) mark)
-           (progn
-             (and
-              (or all
-                  (and
-                   (not (memq (gnus-summary-article-number)
-                              gnus-newsgroup-marked))
-                   (not (memq (gnus-summary-article-number)
-                              gnus-newsgroup-dormant))))
-              (gnus-summary-mark-article
-               (gnus-summary-article-number) gnus-del-mark))
-             t)
-           (gnus-summary-find-next)))))
+    (let (article)
+      (goto-char point)
+      (beginning-of-line)
+      (while (and 
+             (< (point) mark)
+             (progn
+               (when (or all 
+                         (memq (setq article (gnus-summary-article-number))
+                               gnus-newsgroup-unreads))
+                 (gnus-summary-mark-article article gnus-del-mark))
+               t)
+             (gnus-summary-find-next))))))
 
 (defun gnus-summary-mark-below (score mark)
   "Mark articles with score less than SCORE with MARK."
@@ -10721,7 +10838,7 @@ even ticked and dormant ones."
   "Mark all articles not marked as unread in this newsgroup as read.
 If prefix argument ALL is non-nil, all articles are marked as read.
 If QUIETLY is non-nil, no questions will be asked.
-If TO-HERE is non-nil, it should be a point in the buffer. All
+If TO-HERE is non-nil, it should be a point in the buffer.  All
 articles before this point will be marked as read.
 The number of articles marked as read is returned."
   (interactive "P")
@@ -10738,10 +10855,10 @@ The number of articles marked as read is returned."
                   (not gnus-newsgroup-adaptive)
                   (not gnus-newsgroup-auto-expire))
              (progn
-               (and all (setq gnus-newsgroup-marked nil
-                              gnus-newsgroup-dormant nil))
-               (setq gnus-newsgroup-unreads 
-                     (append gnus-newsgroup-marked gnus-newsgroup-dormant)))
+               (when all
+                 (setq gnus-newsgroup-marked nil
+                       gnus-newsgroup-dormant nil))
+               (setq gnus-newsgroup-unreads nil))
            ;; We actually mark all articles as canceled, which we
            ;; have to do when using auto-expiry or adaptive scoring. 
            (gnus-summary-show-all-threads)
@@ -10750,10 +10867,9 @@ The number of articles marked as read is returned."
                        (if to-here (< (point) to-here) t)
                        (gnus-summary-mark-article-as-read gnus-catchup-mark)
                        (gnus-summary-find-next (not all)))))
-           (or to-here
-               (setq gnus-newsgroup-unreads
-                     (append gnus-newsgroup-marked
-                             gnus-newsgroup-dormant)))))
+           (unless to-here
+             (setq gnus-newsgroup-unreads nil))
+           (gnus-set-mode-line 'summary)))
     (let ((method (gnus-find-method-for-group gnus-newsgroup-name)))
       (if (and (not to-here) (eq 'nnvirtual (car method)))
          (nnvirtual-catchup-group
@@ -10766,10 +10882,10 @@ If ALL is non-nil, also mark ticked and dormant articles as read."
   (interactive "P")
   (gnus-set-global-variables)
   (save-excursion
-    (and (gnus-summary-find-prev)
-        (progn
-          (gnus-summary-catchup all t (point))
-          (gnus-set-mode-line 'summary))))
+    (let ((beg (point)))
+      ;; We check that there are unread articles.
+      (when (or all (gnus-summary-find-prev))
+       (gnus-summary-catchup all t beg))))
   (gnus-summary-position-point))
 
 (defun gnus-summary-catchup-all (&optional quietly)
@@ -11100,30 +11216,28 @@ Argument REVERSE means reverse order."
         'gnus-thread-sort-by-score)
    (not reverse)))
 
-(defvar gnus-summary-already-sorted nil)
 (defun gnus-summary-sort (predicate reverse)
-  ;; Sort summary buffer by PREDICATE.  REVERSE means reverse order. 
-  (if gnus-summary-already-sorted
-      ()
-    (let (buffer-read-only)
-      (if (not gnus-show-threads)
-         ;; We do untreaded sorting...
-         (progn
-           (goto-char (point-min))
-           (sort-subr reverse 'forward-line 'end-of-line (car predicate)))
-       ;; ... or we do threaded sorting.
-       (let ((gnus-thread-sort-functions (list (cdr predicate)))
-             (gnus-summary-prepare-hook nil)
-             (gnus-summary-already-sorted nil))
-         ;; We do that by simply regenerating the threads.
-         (gnus-summary-prepare)
-         (and gnus-show-threads
-              gnus-thread-hide-subtree
-              (gnus-summary-hide-all-threads))
-         ;; If in async mode, we send some info to the backend.
-         (and gnus-newsgroup-async
-              (gnus-request-asynchronous 
-               gnus-newsgroup-name gnus-newsgroup-data)))))))
+  "Sort summary buffer by PREDICATE.  REVERSE means reverse order. 
+PREDICATE is a cons of `(unthreaded-func . threaded-func)'."
+  (let (buffer-read-only)
+    (if (not gnus-show-threads)
+       ;; We do untreaded sorting...
+       (progn
+         (goto-char (point-min))
+         (sort-subr reverse 'forward-line 'end-of-line (car predicate))
+         (gnus-data-compute-positions))
+      ;; ... or we do threaded sorting.
+      (let ((gnus-thread-sort-functions (list (cdr predicate)))
+           (gnus-summary-prepare-hook nil))
+       ;; We do that by simply regenerating the threads.
+       (gnus-summary-prepare)
+       ;; Hide subthreads if needed.
+       (when gnus-thread-hide-subtree
+         (gnus-summary-hide-all-threads))))
+    ;; If in async mode, we send some info to the backend.
+    (when gnus-newsgroup-async
+      (gnus-request-asynchronous 
+       gnus-newsgroup-name gnus-newsgroup-data))))
   
 (defun gnus-sortable-date (date)
   "Make sortable string by string-lessp from DATE.
@@ -11252,41 +11366,47 @@ save those articles instead."
 
 (defun gnus-read-save-file-name (prompt default-name)
   (let ((methods gnus-split-methods)
-       split-name)
-    (if (not gnus-split-methods)
-       ()
+       split-name method)
+    ;; Let the split methods have their say.
+    (when gnus-split-methods
       (save-excursion
-       (set-buffer gnus-article-buffer)
+       (set-buffer gnus-original-article-buffer)
        (gnus-narrow-to-headers)
        (while methods
          (goto-char (point-min))
-         (and (condition-case () 
-                  (re-search-forward (car (car methods)) nil t)
-                (error nil))
-              (setq split-name (cons (nth 1 (car methods)) split-name)))
-         (setq methods (cdr methods)))
+         (setq method (pop methods))
+         (when (cond ((stringp (car method))
+                      (condition-case () 
+                          (re-search-forward (car method) nil t)
+                        (error nil)))
+                     ((and (symbolp (car method))
+                           (fboundp (car method)))
+                      (funcall (car method)))
+                     ((consp (car method))
+                      (eval (car method))))
+           (setq split-name (cons (nth 1 methods) split-name))))
        (widen)))
-    (cond ((null split-name)
-          (read-file-name
-           (concat prompt " (default "
-                   (file-name-nondirectory default-name) ") ")
-           (file-name-directory default-name)
-           default-name))
-         ((= 1 (length split-name))
-          (read-file-name
-           (concat prompt " (default " (car split-name) ") ")
-           gnus-article-save-directory
-           (concat gnus-article-save-directory (car split-name))))
-         (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 "")
-                        (car (car split-name))
-                      result)))))))
+    (cond
+     ;; No split name was found
+     ((null split-name)
+      (read-file-name
+       (concat prompt " (default " (file-name-nondirectory default-name) ") ")
+       (file-name-directory default-name)
+       default-name))
+     ;; A single split name was found
+     ((= 1 (length split-name))
+      (read-file-name
+       (concat prompt " (default " (car split-name) ") ")
+       gnus-article-save-directory
+       (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 "")
+                   (car (car split-name))
+                 result)))))))
 
 (defun gnus-summary-save-in-rmail (&optional filename)
   "Append this article to Rmail file.
@@ -11306,7 +11426,7 @@ is initialized from the SAVEDIR environment variable."
                    "Save in rmail file:" default-name))))
     (gnus-make-directory (file-name-directory filename))
     (gnus-eval-in-buffer-window 
-     gnus-article-buffer
+     gnus-original-article-buffer
      (save-excursion
        (save-restriction
         (widen)
@@ -11336,11 +11456,11 @@ is initialized from the SAVEDIR environment variable."
                                 (file-name-directory default-name))))
     (gnus-make-directory (file-name-directory filename))
     (gnus-eval-in-buffer-window 
-     gnus-article-buffer
+     gnus-original-article-buffer
      (save-excursion
        (save-restriction
         (widen)
-        (if (and (file-readable-p filename) (rmail-file-p filename))
+        (if (and (file-readable-p filename) (mail-file-babyl-p filename))
             (gnus-output-to-rmail filename)
           (rmail-output filename 1 t t)))))
     ;; Remember the directory name to save articles.
@@ -11680,6 +11800,7 @@ The following commands are available:
          (set-buffer (get-buffer-create gnus-original-article-buffer))
          (buffer-disable-undo (current-buffer))
          (setq major-mode 'gnus-original-article-mode)
+         (setq buffer-read-only t)
          (gnus-add-current-to-buffer-list))
 
        (setq group (or group gnus-newsgroup-name))
@@ -11739,11 +11860,19 @@ The following commands are available:
               (numberp article)
               (gnus-cache-request-article article group))
          'article)
-        ;; Get the article from the backend.
+        ;; Get the article and put into the article buffer.
         ((or (stringp article) (numberp article))
-         (erase-buffer)
          (let ((gnus-override-method 
-                (and (stringp article) gnus-refer-article-method)))
+                (and (stringp article) gnus-refer-article-method))
+               (buffer-read-only nil))
+           (erase-buffer)
+           ;; There may be some overlays that we have to kill...
+           (insert "i")
+           (let ((overlays (overlays-at (point-min))))
+             (while overlays
+               (delete-overlay (car overlays))
+               (setq overlays (cdr overlays))))
+           (erase-buffer)        
            (if (gnus-request-article article group (current-buffer))
                (progn
                  (and gnus-keep-backlog 
@@ -11755,6 +11884,13 @@ The following commands are available:
     (setq gnus-original-article (cons group article))
     (let (buffer-read-only)
       (erase-buffer)
+      ;; There may be some overlays that we have to kill...
+      (insert "i")
+      (let ((overlays (and (fboundp 'overlays-at)
+                          (overlays-at (point-min)))))
+       (while overlays
+         (delete-overlay (pop overlays))))
+      (erase-buffer)
       (insert-buffer-substring gnus-original-article-buffer))))
 
 (defun gnus-read-header (id)
@@ -12073,42 +12209,58 @@ Provided for backwards compatability."
   (interactive (list 'force))
   (save-excursion
     (set-buffer gnus-article-buffer)
-    ;; delete old process
-    (and (process-status "gnus-x-face")
-        (delete-process "gnus-x-face"))
+    ;; Delete the old process, if any.
+    (when (process-status "gnus-x-face")
+      (delete-process "gnus-x-face"))
     (let ((inhibit-point-motion-hooks t)
          (case-fold-search nil)
          from)
       (save-restriction
-       (goto-char (point-min))
-       (search-forward "\n\n")
-       (narrow-to-region (point-min) (point))
-       (goto-char (point-min))
+       (gnus-narrow-to-headers)
        (setq from (mail-fetch-field "from"))
-       (if (not (and gnus-article-x-face-command
-                     (or force
-                         (not gnus-article-x-face-too-ugly)
-                         (and gnus-article-x-face-too-ugly from
-                              (not (string-match gnus-article-x-face-too-ugly
-                                                 from))))
-                     (progn
-                       (goto-char (point-min))
-                       (re-search-forward "^X-Face: " nil t))))
-           nil
+       (goto-char (point-min))
+       (when (and gnus-article-x-face-command 
+                  (or force
+                      ;; Check whether this face is censored.
+                      (not gnus-article-x-face-too-ugly)
+                      (and gnus-article-x-face-too-ugly from
+                           (not (string-match gnus-article-x-face-too-ugly 
+                                              from))))
+                  ;; Has to be present.
+                  (re-search-forward "^X-Face: " nil t))
+         ;; We now have the area of the buffer where the X-Face is stored.
          (let ((beg (point))
                (end (1- (re-search-forward "^\\($\\|[^ \t]\\)" nil t))))
+           ;; We display the face.
            (if (symbolp gnus-article-x-face-command)
-               (and (or (fboundp gnus-article-x-face-command)
-                        (error "%s is not a function"
-                               gnus-article-x-face-command))
-                    (funcall gnus-article-x-face-command beg end))
+               ;; The command is a lisp function, so we call it.
+               (if (fboundp gnus-article-x-face-command)
+                   (funcall gnus-article-x-face-command beg end)
+                 (error "%s is not a function" gnus-article-x-face-command))
+             ;; The command is a string, so we interpret the command
+             ;; as a, well, command, and fork it off.
              (let ((process-connection-type nil))
                (process-kill-without-query
-                (start-process "gnus-x-face" nil "sh" "-c"
-                               gnus-article-x-face-command))
+                (start-process 
+                 "gnus-x-face" nil "sh" "-c" gnus-article-x-face-command))
                (process-send-region "gnus-x-face" beg end)
                (process-send-eof "gnus-x-face")))))))))
 
+(defun gnus-headers-decode-quoted-printable ()
+  "Hack to remove QP encoding from headers."
+  (let ((case-fold-search t)
+       string)
+    (goto-char (point-min))
+    (while (re-search-forward "=?iso-8859-1?q?\\([^ \t\n]*\\)?=" nil t)
+      (replace-match (setq string (match-string 1)) t t)
+      (narrow-to-region 
+       (match-beginning 0) (+ (match-beginning 0) (length string)))
+      (goto-char (point-min))
+      (while (search-forward "_" nil t)
+       (replace-match " "))
+      (gnus-mime-decode-quoted-printable (point-min) (point-max))
+      (widen))))
+       
 (defun gnus-article-de-quoted-unreadable (&optional force)
   "Do a naive translation of a quoted-printable-encoded article.
 This is in no way, shape or form meant as a replacement for real MIME
@@ -12122,28 +12274,28 @@ or not."
     (let ((case-fold-search t)
          (buffer-read-only nil)
          (type (gnus-fetch-field "content-transfer-encoding")))
-      (if (or force (and type (string-match "quoted-printable" type)))
-         (progn
-           (goto-char (point-min))
-           (search-forward "\n\n" nil 'move)
-           (gnus-mime-decode-quoted-printable (point) (point-max)))))))
+      (when (or force
+               (and type (string-match "quoted-printable" type)))
+       (goto-char (point-min))
+       (search-forward "\n\n" nil 'move)
+       (gnus-mime-decode-quoted-printable (point) (point-max))
+       (gnus-headers-decode-quoted-printable)))))
 
 (defun gnus-mime-decode-quoted-printable (from to)
   ;; Decode quoted-printable from region between FROM and TO.
-  (save-excursion
-    (goto-char from)
-    (while (search-forward "=" to t)
-      (cond ((eq (following-char) ?\n)
-            (delete-char -1)
-            (delete-char 1))
-           ((looking-at "[0-9A-F][0-9A-F]")
-            (delete-char -1)
-            (insert (hexl-hex-string-to-integer
-                     (buffer-substring (point) (+ 2 (point)))))
-            (delete-char 2))
-           ((looking-at "=")
-            (delete-char 1))
-           ((gnus-message 3 "Malformed MIME quoted-printable message"))))))
+  (goto-char from)
+  (while (search-forward "=" to t)
+    (cond ((eq (following-char) ?\n)
+          (delete-char -1)
+          (delete-char 1))
+         ((looking-at "[0-9A-F][0-9A-F]")
+          (delete-char -1)
+          (insert (hexl-hex-string-to-integer
+                   (buffer-substring (point) (+ 2 (point)))))
+          (delete-char 2))
+         ((looking-at "=")
+          (delete-char 1))
+         ((gnus-message 3 "Malformed MIME quoted-printable message")))))
 
 (defun gnus-article-hide-pgp ()
   "Hide any PGP headers and signatures in the current article."
@@ -12177,12 +12329,13 @@ or not."
        (widen)))))
 
 (defvar gnus-article-time-units
-  (list (cons 'year (* 365.25 24 60 60))
-       (cons 'week (* 7 24 60 60))
-       (cons 'day (* 24 60 60))
-       (cons 'hour (* 60 60))
-       (cons 'minute 60)
-       (cons 'second 1)))
+  `((year . ,(* 365.25 24 60 60))
+    (week . ,(* 7 24 60 60))
+    (day . ,(* 24 60 60))
+    (hour . ,(* 60 60))
+    (minute . 60)
+    (second . 1))
+  "Mapping from time units to seconds.")
 
 (defun gnus-article-date-ut (&optional type)
   "Convert DATE date to universal time in the current article.
@@ -12191,73 +12344,84 @@ how much time has lapsed since DATE."
   (interactive (list 'ut))
   (let ((date (mail-header-date (or gnus-current-headers 
                                    (gnus-summary-article-header) "")))
-       (date-regexp "^Date: \\|^X-Sent: "))
-    (if (or (not date)
-           (string= date ""))
-       ()
+       (date-regexp "^Date: \\|^X-Sent: ")
+       (inhibit-point-motion-hooks t))
+    (when (and date (not (string= date "")))
       (save-excursion
-       (set-buffer gnus-article-buffer)
-       (let ((buffer-read-only nil))
-         (goto-char (point-min))
-         (if (and (re-search-forward date-regexp nil t)
-                  (progn 
-                    (beginning-of-line)
-                    (looking-at date-regexp)))
-             (delete-region (gnus-point-at-bol)
-                            (progn (end-of-line) (1+ (point))))
-           (goto-char (point-min))
-           (goto-char (- (search-forward "\n\n") 2)))
-         (insert
-          (cond 
-           ((eq type 'local)
-            (concat "Date: " (condition-case ()
-                                 (timezone-make-date-arpa-standard date)
-                               (error date))
-                    "\n"))
-           ((eq type 'ut)
-            (concat "Date: "
-                    (condition-case ()
-                        (timezone-make-date-arpa-standard date nil "UT")
-                      (error date))
-                    "\n"))
-           ((eq type 'original)
-            (concat "Date: " date "\n"))
-           ((eq type 'lapsed)
-            ;; If the date is seriously mangled, the timezone
-            ;; functions are liable to bug out, so we condition-case
-            ;; the entire thing.  
-            (let* ((real-sec (condition-case ()
-                                 (- (gnus-seconds-since-epoch 
-                                     (timezone-make-date-arpa-standard
-                                      (current-time-string) 
-                                      (current-time-zone) "UT"))
-                                    (gnus-seconds-since-epoch 
-                                     (timezone-make-date-arpa-standard 
-                                      date nil "UT")))
-                               (error 0)))
-                   (sec (abs real-sec))
-                   num prev)
-              (if (zerop sec)
-                  "X-Sent: Now\n"
-                (concat
-                 "X-Sent: "
-                 (mapconcat 
-                  (lambda (unit)
-                    (if (zerop (setq num (ffloor (/ sec (cdr unit)))))
-                        ""
-                      (setq sec (- sec (* num (cdr unit))))
-                      (prog1
-                          (concat (if prev ", " "") (int-to-string 
-                                                     (floor num))
-                                  " " (symbol-name (car unit))
-                                  (if (> num 1) "s" ""))
-                        (setq prev t))))
-                  gnus-article-time-units "")
-                 (if (> real-sec 0)
-                     " ago\n"
-                   " in the future\n")))))
-           (t
-            (error "Unknown conversion type: %s" type)))))))))
+       (save-restriction
+         (set-buffer gnus-article-buffer)
+         (gnus-narrow-to-headers)
+         (let ((buffer-read-only nil))
+           ;; Delete any old Date headers.
+           (when (zerop (nnheader-remove-header date-regexp t))
+             (goto-char (point-max)))
+           (insert
+            (cond 
+             ;; Convert to the local timezone.  We have to slap a
+             ;; `condition-case' round the calls to the timezone
+             ;; functions since they aren't particularly resistant to
+             ;; buggy dates.
+             ((eq type 'local)
+              (concat "Date: " (condition-case ()
+                                   (timezone-make-date-arpa-standard date)
+                                 (error date))
+                      "\n"))
+             ;; Convert to Universal Time.
+             ((eq type 'ut)
+              (concat "Date: "
+                      (condition-case ()
+                          (timezone-make-date-arpa-standard date nil "UT")
+                        (error date))
+                      "\n"))
+             ;; Get the original date from the article.
+             ((eq type 'original)
+              (concat "Date: " date "\n"))
+             ;; Do an X-Sent lapsed format.
+             ((eq type 'lapsed)
+              ;; If the date is seriously mangled, the timezone
+              ;; functions are liable to bug out, so we condition-case
+              ;; the entire thing.  
+              (let* ((real-sec (condition-case ()
+                                   (- (gnus-seconds-since-epoch 
+                                       (timezone-make-date-arpa-standard
+                                        (current-time-string) 
+                                        (current-time-zone) "UT"))
+                                      (gnus-seconds-since-epoch 
+                                       (timezone-make-date-arpa-standard 
+                                        date nil "UT")))
+                                 (error 0)))
+                     (sec (abs real-sec))
+                     num prev)
+                (if (zerop sec)
+                    "X-Sent: Now\n"
+                  (concat
+                   "X-Sent: "
+                   ;; This is a bit convoluted, but basically we go
+                   ;; through the time units for years, weeks, etc,
+                   ;; and divide things to see whether that results
+                   ;; in positive answers.
+                   (mapconcat 
+                    (lambda (unit)
+                      (if (zerop (setq num (ffloor (/ sec (cdr unit)))))
+                          ;; The (remaining) seconds are too few to
+                          ;; be divided into this time unit.
+                          "" 
+                        ;; It's big enough, so we output it.
+                        (setq sec (- sec (* num (cdr unit))))
+                        (prog1
+                            (concat (if prev ", " "") (int-to-string 
+                                                       (floor num))
+                                    " " (symbol-name (car unit))
+                                    (if (> num 1) "s" ""))
+                          (setq prev t))))
+                    gnus-article-time-units "")
+                   ;; If dates are odd, then it might appear like the
+                   ;; article was sent in the future.
+                   (if (> real-sec 0)
+                       " ago\n"
+                     " in the future\n")))))
+             (t
+              (error "Unknown conversion type: %s" type))))))))))
 
 (defun gnus-article-date-local ()
   "Convert the current article date to the local timezone."
@@ -12420,7 +12584,7 @@ Intended to be used with gnus-article-prepare-hook."
 
 (defun gnus-article-next-page (&optional lines)
   "Show next page of current article.
-If end of article, return non-nil. Otherwise return nil.
+If end of article, return non-nil.  Otherwise return nil.
 Argument LINES specifies lines to be scrolled up."
   (interactive "P")
   (move-to-window-line -1)
@@ -12464,8 +12628,7 @@ Argument LINES specifies lines to be scrolled down."
   (interactive)
   (search-forward ">" nil t)           ;Move point to end of "<....>".
   (if (re-search-backward "\\(<[^<> \t\n]+>\\)" nil t)
-      (let ((message-id
-            (buffer-substring (match-beginning 1) (match-end 1))))
+      (let ((message-id (match-string 1)))
        (set-buffer gnus-summary-buffer)
        (gnus-summary-refer-article message-id))
     (error "No references around point")))
@@ -12513,7 +12676,7 @@ Argument LINES specifies lines to be scrolled down."
   "Run batched scoring.
 Usage: emacs -batch -l gnus -f gnus-batch-score <newsgroups> ...
 Newsgroups is a list of strings in Bnews format.  If you want to score
-the comp hierarchy, you'd say \"comp.all\". If you would not like to
+the comp hierarchy, you'd say \"comp.all\".  If you would not like to
 score the alt hierarchy, you'd say \"!alt.all\"."
   (interactive)
   (let* ((yes-and-no
@@ -12545,7 +12708,7 @@ score the alt hierarchy, you'd say \"!alt.all\"."
               (if yes (string-match yes group) t)
               (or (null no) (not (string-match no group))))
          (progn
-           (gnus-summary-read-group group nil t)
+           (gnus-summary-read-group group nil t nil t)
            (and (eq (current-buffer) (get-buffer gnus-summary-buffer))
                 (gnus-summary-exit))))
       (setq newsrc (cdr newsrc)))
@@ -12627,7 +12790,7 @@ If NEWSGROUP is nil, return the global kill file name instead."
                         (file-name-nondirectory dribble-file))))
       (gnus-add-current-to-buffer-list)
       (erase-buffer)
-      (set-visited-file-name dribble-file)
+      (setq buffer-file-name dribble-file)
       (buffer-disable-undo (current-buffer))
       (bury-buffer (current-buffer))
       (set-buffer-modified-p nil)
@@ -12641,7 +12804,7 @@ If NEWSGROUP is nil, return the global kill file name instead."
              (if (not (zerop (buffer-size)))
                  (set-buffer-modified-p t))
              (if (gnus-y-or-n-p 
-                  "Auto-save file exists. Do you want to read it? ")
+                  "Auto-save file exists.  Do you want to read it? ")
                  (setq gnus-dribble-eval-file t))))))))
 
 (defun gnus-dribble-eval-file ()
@@ -12739,7 +12902,7 @@ If CONFIRM is non-nil, the user will be asked for an NNTP server."
        (gnus-open-server gnus-select-method)
        (gnus-y-or-n-p
        (format
-        "%s open error: '%s'. Continue? "
+        "%s open error: '%s'.  Continue? "
         (nth 1 gnus-select-method)
         (gnus-status-message gnus-select-method)))
        (progn
@@ -12880,35 +13043,7 @@ is returned insted of the status string."
     (funcall (gnus-get-function method 'request-body) 
             article (gnus-group-real-name group) (nth 1 method))))
 
-;; Fix by Sudish Joseph <joseph@cis.ohio-state.edu>.
-(defun gnus-request-post-buffer (post group subject header artbuf
-                                     info follow-to respect-poster)
-  (let* ((info (or info (and group (nth 2 (gnus-gethash 
-                                          group gnus-newsrc-hashtb)))))
-        (method
-         (if (and gnus-post-method
-                  ;; Fix by Sudish Joseph <joseph@cis.ohio-state.edu>.
-                  (memq 'post (assoc
-                               (format "%s" (car (gnus-find-method-for-group
-                                                  gnus-newsgroup-name)))
-                               gnus-valid-select-methods)))
-             gnus-post-method
-           (gnus-find-method-for-group gnus-newsgroup-name))))
-    (or (gnus-check-server method)
-       (error "Can't open server %s:%s" (car method) (nth 1 method)))
-    (let ((mail-self-blind nil)
-         (mail-archive-file-name nil))
-      (funcall (gnus-get-function method 'request-post-buffer) 
-              post group subject header artbuf info follow-to
-              respect-poster))))
-
 (defun gnus-request-post (method &optional force)
-  (and (stringp method)
-       (setq method (gnus-server-to-method method)))
-  (and (not force) gnus-post-method
-       (memq 'post (assoc (format "%s" (car method))
-                         gnus-valid-select-methods))
-       (setq method gnus-post-method))
   (funcall (gnus-get-function method 'request-post) 
           (nth 1 method)))
 
@@ -12919,7 +13054,7 @@ is returned insted of the status string."
 
 (defun gnus-request-update-info (info method)
   (funcall (gnus-get-function method 'request-update-info) 
-          (gnus-group-real-name (car info)) info (nth 1 method)))
+          (gnus-group-real-name (gnus-info-group info)) info (nth 1 method)))
 
 (defun gnus-request-expire-articles (articles group &optional force)
   (let ((method (gnus-find-method-for-group group)))
@@ -12962,31 +13097,68 @@ is returned insted of the status string."
             (gnus-group-real-name group) 
             (gnus-group-real-name new-name) (nth 1 method))))
 
+(defun gnus-post-method (group force-group-method)
+  "Return the posting method based on GROUP and FORCE."
+  (let ((group-method (if (stringp group)
+                         (gnus-find-method-for-group group)
+                       group)))
+    (cond 
+     ;; We want this group's method.
+     (force-group-method group-method)
+     ;; Override normal method.
+     ((and gnus-post-method
+          (gnus-method-option-p group-method 'post))
+      gnus-post-method)
+     ;; Perhaps this is a mail group?
+     ((gnus-member-of-valid 'post group)
+      group-method)
+     ;; Use the normal select method.
+     (t gnus-select-method))))
+
 (defun gnus-member-of-valid (symbol group)
   "Find out if GROUP has SYMBOL as part of its \"valid\" spec."
   (memq symbol (assoc
                (format "%s" (car (gnus-find-method-for-group group)))
                gnus-valid-select-methods)))
 
-(defun gnus-secondary-method-p (method)
-  "Return whether METHOD is a secondary select method."
-  (let ((methods gnus-secondary-select-methods)
-       (gmethod (gnus-server-get-method nil method)))
-    (while (and methods
-               (not (equal (gnus-server-get-method nil (car methods)) 
-                           gmethod)))
-      (setq methods (cdr methods)))
-    methods))
+(defun gnus-method-option-p (method option)
+  "Return non-nil if select METHOD has OPTION as a parameter."
+  (memq 'post (assoc (format "%s" (car method))
+                    gnus-valid-select-methods)))
+
+
+(defmacro gnus-server-equal (ss1 ss2)
+  "Say whether two servers are equal."
+  `(let ((s1 ,ss1)
+        (s2 ,ss2))
+     (or (equal s1 s2)
+        (and (= (length s1) (length s2))
+             (progn
+               (while (and s1 (member (car s1) s2))
+                 (setq s1 (cdr s1)))
+               (null s1))))))
+
+(defun gnus-server-extend-method (group method)
+  ;; This function "extends" a virtual server.  If the server is
+  ;; "hello", and the select method is ("hello" (my-var "something")) 
+  ;; in the group "alt.alt", this will result in a new virtual server
+  ;; called "helly+alt.alt".
+  (let ((entry
+        (gnus-copy-sequence 
+         (if (equal (car method) "native") gnus-select-method
+           (cdr (assoc (car method) gnus-server-alist))))))
+    (setcar (cdr entry) (concat (nth 1 entry) "+" group))
+    (nconc entry (cdr method))))
 
 (defun gnus-find-method-for-group (group &optional info)
   "Find the select method that GROUP uses."
   (or gnus-override-method
       (and (not group)
           gnus-select-method)
-      (let ((info (or info (nth 2 (gnus-gethash group gnus-newsrc-hashtb))))
+      (let ((info (or info (gnus-get-info group)))
            method)
        (if (or (not info)
-               (not (setq method (nth 4 info))))
+               (not (setq method (gnus-info-method info))))
            (setq method gnus-select-method)
          (setq method
                (cond ((stringp method)
@@ -13033,7 +13205,7 @@ is returned insted of the status string."
 ;; of unread articles in "alt.misc". The cdr of this entry is the
 ;; element *before* "alt.misc" in gnus-newsrc-alist, which makes is
 ;; trivial to remove or add new elements into gnus-newsrc-alist
-;; without scanning the entire list. So, to get the actual information
+;; without scanning the entire list.  So, to get the actual information
 ;; of "alt.misc", you'd say something like 
 ;; (nth 2 (gnus-gethash "alt.misc" gnus-newsrc-hashtb))
 ;;
@@ -13068,7 +13240,7 @@ If LEVEL is non-nil, the news will be set up at level LEVEL."
 
     ;; Read the active file and create `gnus-active-hashtb'.
     ;; If `gnus-read-active-file' is nil, then we just create an empty
-    ;; hash table. The partial filling out of the hash table will be
+    ;; hash table.  The partial filling out of the hash table will be
     ;; done in `gnus-get-unread-articles'.
     (and gnus-read-active-file 
         (not level)
@@ -13161,7 +13333,7 @@ The `-n' option line from .newsrc is respected."
     'ignore)
    ;; Then we go through the list that was retrieved from the .newsrc
    ;; file.  This list has elements on the form 
-   ;; `(REGEXP . {ignore,subscribe})'. The first match found (the list
+   ;; `(REGEXP . {ignore,subscribe})'.  The first match found (the list
    ;; is in the reverse order of the options line) is returned.
    (t
     (let ((regs gnus-newsrc-options-n))
@@ -13275,13 +13447,13 @@ The `-n' option line from .newsrc is respected."
    gnus-level-default-subscribed gnus-level-killed previous t))
 
 ;; `gnus-group-change-level' is the fundamental function for changing
-;; subscription levels of newsgroups. This might mean just changing
+;; subscription levels of newsgroups.  This might mean just changing
 ;; from level 1 to 2, which is pretty trivial, from 2 to 6 or back
 ;; again, which subscribes/unsubscribes a group, which is equally
-;; trivial. Changing from 1-7 to 8-9 means that you kill a group, and
+;; trivial.  Changing from 1-7 to 8-9 means that you kill a group, and
 ;; from 8-9 to 1-7 means that you remove the group from the list of
 ;; killed (or zombie) groups and add them to the (kinda) subscribed
-;; groups. And last but not least, moving from 8 to 9 and 9 to 8,
+;; groups.  And last but not least, moving from 8 to 9 and 9 to 8,
 ;; which is trivial.
 ;; ENTRY can either be a string (newsgroup name) or a list (if
 ;; FROMKILLED is t, it's a list on the format (NUM INFO-LIST),
@@ -13314,13 +13486,14 @@ The `-n' option line from .newsrc is respected."
        ;; subscribed. 
        ()                              ; Do nothing. 
 
-      (gnus-dribble-enter
-       (format "(gnus-group-change-level %S %S %S %S %S)" 
-              group level oldlevel (car (nth 2 previous)) fromkilled))
+      (or (gnus-ephemeral-group-p group)
+         (gnus-dribble-enter
+          (format "(gnus-group-change-level %S %S %S %S %S)" 
+                  group level oldlevel (car (nth 2 previous)) fromkilled)))
     
       ;; Then we remove the newgroup from any old structures, if needed.
       ;; If the group was killed, we remove it from the killed or zombie
-      ;; list. If not, and it is in fact going to be killed, we remove
+      ;; list.  If not, and it is in fact going to be killed, we remove
       ;; it from the newsrc hash table and assoc.
       (cond ((>= oldlevel gnus-level-zombie)
             (if (= oldlevel gnus-level-zombie)
@@ -13338,17 +13511,17 @@ The `-n' option line from .newsrc is respected."
                   (setcdr (cdr entry) (cdr (cdr (cdr entry))))))))
 
       ;; Finally we enter (if needed) the list where it is supposed to
-      ;; go, and change the subscription level. If it is to be killed,
+      ;; go, and change the subscription level.  If it is to be killed,
       ;; we enter it into the killed or zombie list.
       (cond ((>= level gnus-level-zombie)
             ;; Remove from the hash table.
             (gnus-sethash group nil gnus-newsrc-hashtb)
-            (or (gnus-group-foreign-p group)
-                ;; We do not enter foreign groups into the list of dead
-                ;; groups.  
-                (if (= level gnus-level-zombie)
-                    (setq gnus-zombie-list (cons group gnus-zombie-list))
-                  (setq gnus-killed-list (cons group gnus-killed-list)))))
+            ;; We do not enter foreign groups into the list of dead
+            ;; groups.  
+            (unless (gnus-group-foreign-p group)
+              (if (= level gnus-level-zombie)
+                  (setq gnus-zombie-list (cons group gnus-zombie-list))
+                (setq gnus-killed-list (cons group gnus-killed-list)))))
            (t
             ;; If the list is to be entered into the newsrc assoc, and
             ;; it was killed, we have to create an entry in the newsrc
@@ -13362,7 +13535,7 @@ The `-n' option line from .newsrc is respected."
                     (setq active (gnus-gethash group gnus-active-hashtb))
                     (setq num 
                           (if active (- (1+ (cdr active)) (car active)) t))
-                    ;; Check whether the group is foreign. If so, the
+                    ;; Check whether the group is foreign.  If so, the
                     ;; foreign select method has to be entered into the
                     ;; info. 
                     (let ((method (gnus-group-method-name group)))
@@ -13394,7 +13567,7 @@ The `-n' option line from .newsrc is respected."
               (setcar (cdr (car (cdr (cdr entry)))) level)))))))
 
 (defun gnus-kill-newsgroup (newsgroup)
-  "Obsolete function. Kills a newsgroup."
+  "Obsolete function.  Kills a newsgroup."
   (gnus-group-change-level
    (gnus-gethash newsgroup gnus-newsrc-hashtb) gnus-level-killed))
 
@@ -13428,7 +13601,7 @@ newsgroup."
             (setq gnus-killed-list (delete (car bogus) gnus-killed-list))))
       (setq bogus (cdr bogus)))
     ;; Then we remove all bogus groups from the list of killed and
-    ;; zombie groups. They are are removed without confirmation.
+    ;; zombie groups.  They are are removed without confirmation.
     (let ((dead-lists '(gnus-killed-list gnus-zombie-list))
          killed)
       (while dead-lists
@@ -13474,15 +13647,15 @@ newsgroup."
 
     (while newsrc
       (setq info (car newsrc)
-           group (car info)
+           group (gnus-info-group info)
            active (gnus-gethash group gnus-active-hashtb))
 
-      ;; Check newsgroups. If the user doesn't want to check them, or
+      ;; 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
+      ;; newsgroup to t.  This means that Gnus thinks that there are
       ;; unread articles, but it has no idea how many.
-      (if (and (setq method (nth 4 info))
+      (if (and (setq method (gnus-info-method info))
               (not (gnus-server-equal
                     gnus-select-method
                     (prog1
@@ -13493,24 +13666,26 @@ newsgroup."
                       ;; reasonable efficient. 
                       (and (fboundp (intern (format "%s-request-update-info"
                                                     (car fmethod))))
-                           (<= (nth 1 info) foreign-level)
+                           (<= (gnus-info-level info) foreign-level)
                            (gnus-request-update-info info method)))))
               (not (gnus-secondary-method-p method)))
-         ;; These groups are foreign. Check the level.
-         (if (<= (nth 1 info) foreign-level)
-             (setq active (gnus-activate-group (car info) 'scan)))
+         ;; These groups are foreign.  Check the level.
+         (if (<= (gnus-info-level info) foreign-level)
+             (setq active (gnus-activate-group (gnus-info-group info) 'scan)))
 
        ;; These groups are native or secondary. 
-       (if (<= (nth 1 info) level)
+       (if (<= (gnus-info-level info) level)
            (progn
              (if (and update (not method))
                  (progn
                    ;; Allow updating of native groups as well, even
                    ;; though that's pretty unlikely.
                    (gnus-request-update-info info gnus-select-method)
-                   (setq active (gnus-activate-group (car info) 'scan)))
+                   (setq active (gnus-activate-group 
+                                 (gnus-info-group info) 'scan)))
                (or gnus-read-active-file
-                   (setq active (gnus-activate-group (car info) 'scan)))))))
+                   (setq active (gnus-activate-group 
+                                 (gnus-info-group info) 'scan)))))))
       
       (if active
          (gnus-get-unread-articles-in-group info active)
@@ -13523,7 +13698,7 @@ newsgroup."
 
     (gnus-message 5 "Checking new news...done")))
 
-;; Create a hash table out of the newsrc alist. The `car's of the
+;; 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)
@@ -13559,12 +13734,12 @@ newsgroup."
        (setq list (cdr list))))))
 
 (defun gnus-get-unread-articles-in-group (info active)
-  (let* ((range (nth 2 info))
+  (let* ((range (gnus-info-read info))
         (num 0)
-        (marked (nth 3 info)))
+        (marked (gnus-info-marks info)))
     ;; If a cache is present, we may have to alter the active info.
     (and gnus-use-cache
-        (gnus-cache-possibly-alter-active (car info) active))
+        (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.
@@ -13582,7 +13757,7 @@ newsgroup."
       ;; Compute number of unread articles.
       (setq num (max 0 (- (cdr active) (- (1+ (cdr range)) (car range))))))
      (t
-      ;; The read list is a list of ranges. Fix them according to
+      ;; The read list is a list of ranges.  Fix them according to
       ;; the active hash table.
       ;; First peel off any elements that are below the lower
       ;; active limit. 
@@ -13629,30 +13804,10 @@ newsgroup."
                                (car (car range))))))
        (setq range (cdr range)))
       (setq num (max 0 (- (cdr active) num)))))
-    (and info
-        (progn
-          (and (assq 'tick marked)
-               (inline (gnus-remove-illegal-marked-articles
-                        (assq 'tick marked) (nth 2 info))))
-          (and (assq 'dormant marked)
-               (inline (gnus-remove-illegal-marked-articles
-                        (assq 'dormant marked) (nth 2 info))))
-          (setcar
-           (gnus-gethash (car info) gnus-newsrc-hashtb) 
-           (setq num (max 0 (- num (length (cdr (assq 'tick marked)))
-                               (length (cdr (assq 'dormant marked)))))))))
+    ;; Set the number of unread articles.
+    (setcar (gnus-gethash (gnus-info-group info) gnus-newsrc-hashtb) num)
     num))
 
-(defun gnus-remove-illegal-marked-articles (marked ranges)
-  (let ((m (cdr marked)))
-    ;; Make sure that all ticked articles are a subset of the unread
-    ;; articles. 
-    (while m
-      (if (gnus-member-of-range (car m) ranges)
-         (setcdr marked (cdr m))
-       (setq marked m))
-      (setq m (cdr m)))))
-
 (defun gnus-activate-group (group &optional scan)
   ;; Check whether a group has been activated or not.
   ;; If SCAN, request a scan of that group as well.
@@ -13696,16 +13851,16 @@ Returns whether the updating was successful."
                     (gnus-gethash group gnus-active-hashtb)))
         (entry (gnus-gethash group gnus-newsrc-hashtb))
         (info (nth 2 entry))
-        (marked (nth 3 info))
+        (marked (gnus-info-marks info))
         (prev 1)
         (unread (sort (copy-sequence unread) (function <)))
         read)
     (if (or (not info) (not active))
        ;; There is no info on this group if it was, in fact,
-       ;; killed. Gnus stores no information on killed groups, so
+       ;; killed.  Gnus stores no information on killed groups, so
        ;; there's nothing to be done. 
        ;; One could store the information somewhere temporarily,
-       ;; perhaps... Hmmm... 
+       ;; perhaps...  Hmmm... 
        ()
       ;; Remove any negative articles numbers.
       (while (and unread (< (car unread) 0))
@@ -13729,8 +13884,8 @@ Returns whether the updating was successful."
       (if (<= prev (cdr active))
          (setq read (cons (cons prev (cdr active)) read)))
       ;; Enter this list into the group info.
-      (setcar (cdr (cdr info)) 
-             (if (> (length read) 1) (nreverse read) read))
+      (gnus-info-set-read 
+       info (if (> (length read) 1) (nreverse read) read))
       ;; Enter the list of ticked articles.
       (gnus-set-marked-articles 
        info ticked
@@ -13750,16 +13905,15 @@ Returns whether the updating was successful."
   (let* ((info (nth 2 (or (gnus-gethash group gnus-newsrc-hashtb)
                          (gnus-gethash (gnus-group-real-name group)
                                        gnus-newsrc-hashtb))))
-        (ranges (nth 2 info))
-        news)
+        (ranges (gnus-info-read info))
+        news article)
     (while articles
-      (and (gnus-member-of-range (car articles) ranges)
-          (setq news (cons (car articles) news)))
-      (setq articles (cdr articles)))
-    (if (not news)
-       ()
-      (setcar (nthcdr 2 info)
-             (gnus-remove-from-range (nth 2 info) (nreverse news)))
+      (when (gnus-member-of-range 
+            (setq article (pop articles)) ranges)
+       (setq news (cons article news))))
+    (when news
+      (gnus-info-set-read 
+       info (gnus-remove-from-range (gnus-info-read info) (nreverse news)))
       (gnus-group-update-group group t))))
 
 ;; Enter all dead groups into the hashtb.
@@ -14002,7 +14156,7 @@ If FORCE is non-nil, the .newsrc file is read."
   (let* ((newsrc-file gnus-current-startup-file)
         (quick-file (concat newsrc-file ".el")))
     (save-excursion
-      ;; We always load the .newsrc.eld file. If always contains
+      ;; We always load the .newsrc.eld file.  If always contains
       ;; much information that can not be gotten from the .newsrc
       ;; file (ticked articles, killed groups, foreign methods, etc.)
       (gnus-read-newsrc-el-file quick-file)
@@ -14012,9 +14166,9 @@ If FORCE is non-nil, the .newsrc file is read."
                   (file-newer-than-file-p newsrc-file 
                                           (concat quick-file "d")))
              (not gnus-newsrc-alist))
-         ;; We read the .newsrc file. Note that if there if a
+         ;; We read the .newsrc file.  Note that if there if a
          ;; .newsrc.eld file exists, it has already been read, and
-         ;; the `gnus-newsrc-hashtb' has been created. While reading
+         ;; the `gnus-newsrc-hashtb' has been created.  While reading
          ;; the .newsrc file, Gnus will only use the information it
          ;; can find there for changing the data already read -
          ;; ie. reading the .newsrc file will not trash the data
@@ -14069,13 +14223,13 @@ If FORCE is non-nil, the .newsrc file is read."
       (setq gnus-newsrc-alist nil)
       (while newsrc
        (setq group (car newsrc))
-       (let ((info (nth 2 (gnus-gethash (car group) gnus-newsrc-hashtb))))
+       (let ((info (gnus-get-info (car group))))
          (if info
              (progn
-               (setcar (nthcdr 2 info) (cdr (cdr group)))
-               (setcar (cdr info)
-                       (if (nth 1 group) gnus-level-default-subscribed 
-                         gnus-level-default-unsubscribed))
+               (gnus-info-set-read info (cdr (cdr group)))
+               (gnus-info-set-level
+                info (if (nth 1 group) gnus-level-default-subscribed 
+                       gnus-level-default-unsubscribed))
                (setq gnus-newsrc-alist (cons info gnus-newsrc-alist)))
            (setq gnus-newsrc-alist
                  (cons 
@@ -14086,8 +14240,8 @@ If FORCE is non-nil, the .newsrc file is read."
                               (cdr (cdr group))))
                   gnus-newsrc-alist)))
          (if (setq m (assoc (car group) marked))
-             (setcdr (cdr (cdr info))
-                     (cons (list (cons 'tick (cdr m))) nil))))
+             (gnus-info-set-marks 
+              info (cons (list (cons 'tick (cdr m))) nil))))
        (setq newsrc (cdr newsrc)))
       (setq newsrc killed)
       (while newsrc
@@ -14220,7 +14374,7 @@ If FORCE is non-nil, the .newsrc file is read."
            (cond 
             ((looking-at "[0-9]+")
              ;; We narrow and read a number instead of buffer-substring/
-             ;; string-to-int because it's faster. narrow/widen is
+             ;; string-to-int because it's faster.  narrow/widen is
              ;; faster than save-restriction/narrow, and save-restriction
              ;; produces a garbage object.
              (setq num1 (progn
@@ -14234,7 +14388,7 @@ If FORCE is non-nil, the .newsrc file is read."
                    (forward-char 1)
                    (if (not (looking-at "[0-9]+"))
                        ;; This is a buggy line, by we pretend that
-                       ;; it's kinda OK. Perhaps the user should be
+                       ;; it's kinda OK.  Perhaps the user should be
                        ;; dinged? 
                        (setq reads (cons num1 reads))
                      (setq reads 
@@ -14269,7 +14423,7 @@ If FORCE is non-nil, the .newsrc file is read."
                    (ding)
                    (sit-for 1)))
              nil))
-         ;; Skip past ", ". Spaces are illegal in these ranges, but
+         ;; Skip past ", ".  Spaces are illegal in these ranges, but
          ;; we allow them, because it's a common mistake to put a
          ;; space after the comma.
          (skip-chars-forward ", "))
@@ -14277,18 +14431,17 @@ If FORCE is non-nil, the .newsrc file is read."
        ;; We have already read .newsrc.eld, so we gently update the
        ;; data in the hash table with the information we have just
        ;; read. 
-       (if (not group)
-           ()
-         (let ((info (nth 2 (gnus-gethash group gnus-newsrc-hashtb)))
+       (when group
+         (let ((info (gnus-get-info group))
                level)
            (if info
                ;; There is an entry for this file in the alist.
                (progn
-                 (setcar (nthcdr 2 info) (nreverse reads))
+                 (gnus-info-set-read info (nreverse reads))
                  ;; We update the level very gently.  In fact, we
                  ;; only change it if there's been a status change
                  ;; from subscribed to unsubscribed, or vice versa.
-                 (setq level (nth 1 info))
+                 (setq level (gnus-info-level info))
                  (cond ((and (<= level gnus-level-subscribed)
                              (not subscribed))
                         (setq level (if reads
@@ -14296,7 +14449,7 @@ If FORCE is non-nil, the .newsrc file is read."
                                       (1+ gnus-level-default-unsubscribed))))
                        ((and (> level gnus-level-subscribed) subscribed)
                         (setq level gnus-level-default-subscribed)))
-                 (setcar (cdr info) level))
+                 (gnus-info-set-level info level))
              ;; This is a new group.
              (setq info (list group 
                               (if subscribed
@@ -14314,8 +14467,8 @@ If FORCE is non-nil, the .newsrc file is read."
        ()
       ;; We now have two newsrc lists - `newsrc', which is what we
       ;; have read from .newsrc, and `gnus-newsrc-alist', which is
-      ;; what we've read from .newsrc.eld. We have to merge these
-      ;; lists. We do this by "attaching" any (foreign) groups in the
+      ;; what we've read from .newsrc.eld.  We have to merge these
+      ;; lists.  We do this by "attaching" any (foreign) groups in the
       ;; gnus-newsrc-alist to the (native) group that precedes them. 
       (let ((rc (cdr gnus-newsrc-alist))
            (prev gnus-newsrc-alist)
@@ -14344,13 +14497,13 @@ If FORCE is non-nil, the .newsrc file is read."
 ;;  (regexp2 . subscribe)...)
 ;; When handling new newsgroups, groups that match a `ignore' regexp
 ;; will be ignored, and groups that match a `subscribe' regexp will be
-;; subscribed. A line like
+;; subscribed.  A line like
 ;; options -n !all rec.all
 ;; will lead to a list that looks like
 ;; (("^rec\\..+" . subscribe) 
 ;;  ("^.+" . ignore))
 ;; So all "rec.*" groups will be subscribed, while all the other
-;; groups will be ignored. Note that "options -n !all rec.all" is very
+;; groups will be ignored.  Note that "options -n !all rec.all" is very
 ;; different from "options -n rec.all !all". 
 (defun gnus-newsrc-parse-options (options)
   (let (out eol)
@@ -14384,7 +14537,7 @@ If FORCE is non-nil, the .newsrc file is read."
        (while (re-search-forward "[^ \t,\n]+" eol t)
          (if (= (char-after (match-beginning 0)) ?!)
              ;; If the word begins with a bang (!), this is a "not"
-             ;; spec. We put this spec (minus the bang) and the
+             ;; spec.  We put this spec (minus the bang) and the
              ;; symbol `ignore' into the list.
              (setq out (cons (cons (concat 
                                     "^" (buffer-substring 
@@ -14392,13 +14545,10 @@ If FORCE is non-nil, the .newsrc file is read."
                                          (match-end 0)))
                                    'ignore) out))
            ;; There was no bang, so this is a "yes" spec.
-           (setq out (cons (cons (concat 
-                                  "^" (buffer-substring (match-beginning 0)
-                                                        (match-end 0)))
+           (setq out (cons (cons (concat "^" (match-string 0))
                                  'subscribe) out)))))
     
       (setq gnus-newsrc-options-n out))))
-              
 
 (defun gnus-save-newsrc-file ()
   "Save .newsrc file."
@@ -14427,6 +14577,8 @@ If FORCE is non-nil, the .newsrc file is read."
                                   gnus-current-startup-file)))
               ;; Quickly loadable .newsrc.
               (set-buffer (get-buffer-create " *Gnus-newsrc*"))
+              (make-local-variable 'version-control)
+              (setq version-control 'never)
               (setq buffer-file-name 
                     (concat gnus-current-startup-file ".eld"))
               (gnus-add-current-to-buffer-list)
@@ -14479,11 +14631,13 @@ If FORCE is non-nil, the .newsrc file is read."
       ;; Write subscribed and unsubscribed.
       (while newsrc
        (setq info (car newsrc))
-       (if (not (nth 4 info))          ;Don't write foreign groups to .newsrc.
+       (if (not (gnus-info-method info))
+           ;; Don't write foreign groups to .newsrc.
            (progn
-             (insert (car info) (if (> (nth 1 info) gnus-level-subscribed)
-                                    "!" ":"))
-             (if (setq ranges (nth 2 info))
+             (insert (gnus-info-group info)
+                     (if (> (nth 1 info) gnus-level-subscribed)
+                         "!" ":"))
+             (if (setq ranges (gnus-info-read info))
                  (progn
                    (insert " ")
                    (if (not (listp (cdr ranges)))
@@ -14503,9 +14657,11 @@ If FORCE is non-nil, the .newsrc file is read."
                        (if ranges (insert ","))))))
              (insert "\n")))
        (setq newsrc (cdr newsrc)))
+      (make-local-variable 'version-control)
+      (setq version-control 'never)
       ;; It has been reported that sometime the modtime on the .newsrc
-      ;; file seems to be off. We really do want to overwrite it, so
-      ;; we clear the modtime here before saving. It's a bit odd,
+      ;; file seems to be off.  We really do want to overwrite it, so
+      ;; we clear the modtime here before saving.  It's a bit odd,
       ;; though... 
       ;; sometimes the modtime clear isn't sufficient.  most brute force:
       ;; delete the silly thing entirely first.  but this fails to provide
@@ -14623,7 +14779,7 @@ If FORCE is non-nil, the .newsrc file is read."
                          (read nntp-server-buffer))
                      (error 0)))
              (skip-chars-forward " \t")
-             ;; ... which leads to this line being effectively ignored.
+             ;; ...  which leads to this line being effectively ignored.
              (and (symbolp group)
                   (set group (buffer-substring 
                               (point) (progn (end-of-line) (point)))))
@@ -14632,667 +14788,13 @@ If FORCE is non-nil, the .newsrc file is read."
        t)))))
 
 (defun gnus-group-get-description (group)
-  ;; Get the description of a group by sending XGTITLE to the server.
-  (and (gnus-request-group-description group)
-       (save-excursion
-        (set-buffer nntp-server-buffer)
-        (goto-char (point-min))
-        (and (looking-at "[^ \t]+[ \t]+\\(.*\\)")
-             (buffer-substring (match-beginning 1) (match-end 1))))))
-
-;;;
-;;; Server
-;;;
-
-(defvar gnus-server-mode-hook nil
-  "Hook run in `gnus-server-mode' buffers.")
-
-(defconst gnus-server-line-format "     {%(%h:%w%)} %s\n"
-  "Format of server lines.
-It works along the same lines as a normal formatting string,
-with some simple extensions.")
-
-(defvar gnus-server-mode-line-format "Gnus  List of servers"
-  "The format specification for the server mode line.")
-
-(defconst gnus-server-line-format-alist
-  (` ((?h how ?s)
-      (?n name ?s)
-      (?w where ?s)
-      (?s status ?s)))) 
-
-(defconst gnus-server-mode-line-format-alist 
-  (` ((?S news-server ?s)
-      (?M news-method ?s)
-      (?u user-defined ?s))))
-
-(defvar gnus-server-line-format-spec nil)
-(defvar gnus-server-mode-line-format-spec nil)
-(defvar gnus-server-killed-servers nil)
-
-(defvar gnus-server-mode-map nil)
-(put 'gnus-server-mode 'mode-class 'special)
-
-(if gnus-server-mode-map
-    nil
-  (setq gnus-server-mode-map (make-sparse-keymap))
-  (suppress-keymap gnus-server-mode-map)
-  (define-key gnus-server-mode-map " " 'gnus-server-read-server)
-  (define-key gnus-server-mode-map "\r" 'gnus-server-read-server)
-  (define-key gnus-server-mode-map gnus-mouse-2 'gnus-server-pick-server)
-  (define-key gnus-server-mode-map "q" 'gnus-server-exit)
-  (define-key gnus-server-mode-map "l" 'gnus-server-list-servers)
-  (define-key gnus-server-mode-map "k" 'gnus-server-kill-server)
-  (define-key gnus-server-mode-map "y" 'gnus-server-yank-server)
-  (define-key gnus-server-mode-map "c" 'gnus-server-copy-server)
-  (define-key gnus-server-mode-map "a" 'gnus-server-add-server)
-  (define-key gnus-server-mode-map "e" 'gnus-server-edit-server)
-
-  (define-key gnus-server-mode-map "O" 'gnus-server-open-server)
-  (define-key gnus-server-mode-map "C" 'gnus-server-close-server)
-  (define-key gnus-server-mode-map "D" 'gnus-server-deny-server)
-  (define-key gnus-server-mode-map "R" 'gnus-server-remove-denials)
-  )
-
-(defun gnus-server-mode ()
-  "Major mode for listing and editing servers.
-
-All normal editing commands are switched off.
-\\<gnus-server-mode-map>
-
-For more in-depth information on this mode, read the manual (`\\[gnus-info-find-node]'). 
-
-The following commands are available:
-
-\\{gnus-server-mode-map}"
-  (interactive)
-  (if (gnus-visual-p 'server-menu 'menu) (gnus-server-make-menu-bar))
-  (kill-all-local-variables)
-  (setq mode-line-modified "-- ")
-  (make-local-variable 'mode-line-format)
-  (setq mode-line-format (copy-sequence mode-line-format))
-  (and (equal (nth 3 mode-line-format) "   ")
-       (setcar (nthcdr 3 mode-line-format) ""))
-  (setq major-mode 'gnus-server-mode)
-  (setq mode-name "Server")
-                                       ;  (gnus-group-set-mode-line)
-  (setq mode-line-process nil)
-  (use-local-map gnus-server-mode-map)
-  (buffer-disable-undo (current-buffer))
-  (setq truncate-lines t)
-  (setq buffer-read-only t)
-  (run-hooks 'gnus-server-mode-hook))
-
-(defun gnus-server-insert-server-line (sformat name method)
-  (let* ((sformat (or sformat gnus-server-line-format-spec))
-        (how (car method))
-        (where (nth 1 method))
-        (elem (assoc method gnus-opened-servers))
-        (status (cond ((eq (nth 1 elem) 'denied)
-                       "(denied)")
-                      ((gnus-server-opened method)
-                       "(open)")
-                      (t
-                       "(closed)")))
-        b)
-    (beginning-of-line)
-    (setq b (point))
-    ;; Insert the text.
-    (insert (eval sformat))
-    (add-text-properties b (1+ b) (list 'gnus-server (intern name)))))
-
-(defun gnus-server-setup-buffer ()
-  (if (get-buffer gnus-server-buffer)
-      ()
+  "Get the description of a group by sending XGTITLE to the server."
+  (when (gnus-request-group-description group)
     (save-excursion
-      (set-buffer (get-buffer-create gnus-server-buffer))
-      (gnus-server-mode)
-      (and gnus-carpal (gnus-carpal-setup-buffer 'server)))))
-
-(defun gnus-server-prepare ()
-  (setq gnus-server-mode-line-format-spec 
-       (gnus-parse-format gnus-server-mode-line-format 
-                          gnus-server-mode-line-format-alist))
-  (setq gnus-server-line-format-spec 
-       (gnus-parse-format gnus-server-line-format 
-                          gnus-server-line-format-alist))
-  (let ((alist gnus-server-alist)
-       (buffer-read-only nil)
-       (opened gnus-opened-servers)
-       done)
-    (erase-buffer)
-    ;; First we do the real list of servers.
-    (while alist
-      (gnus-server-insert-server-line nil (car (car alist)) (cdr (car alist)))
-      (and (assoc (cdr (car alist)) gnus-opened-servers)
-          (setq done (cons (cdr (car alist)) done)))
-      (setq alist (cdr alist)))
-    ;; Then we insert the list of servers that have been opened in
-    ;; this session.
-    (while opened 
-      (or (member (car (car opened)) done)
-         (gnus-server-insert-server-line 
-          nil (format "%s:%s" (car (car (car opened))) 
-                      (nth 1 (car (car opened))))
-          (car (car opened))))
-      (setq opened (cdr opened))))
-  (goto-char (point-min))
-  (gnus-server-position-point))
-
-(defun gnus-server-server-name ()
-  (let ((server (get-text-property (gnus-point-at-bol) 'gnus-server)))
-    (and server (symbol-name server))))
-
-(defalias 'gnus-server-position-point 'gnus-goto-colon)
-
-(defconst gnus-server-edit-buffer "*Gnus edit server*")
-
-(defun gnus-server-update-server (server)
-  (save-excursion
-    (set-buffer gnus-server-buffer)
-    (let ((buffer-read-only nil)
-         (info (cdr (assoc server gnus-server-alist))))
-      (gnus-dribble-enter 
-       (concat "(gnus-server-set-info \"" server "\" '"
-              (prin1-to-string info) ")"))
-      ;; Buffer may be narrowed.
-      (save-restriction
-       (widen)
-       (if (gnus-server-goto-server server)
-           (delete-region (progn (beginning-of-line) (point))
-                          (progn (forward-line 1) (point))))
-       (let ((entry (assoc server gnus-server-alist)))
-         (gnus-server-insert-server-line nil (car entry) (cdr entry))
-         (gnus-server-position-point))))))
-
-(defun gnus-server-set-info (server info)
-  ;; Enter a select method into the virtual server alist.
-  (gnus-dribble-enter 
-   (concat "(gnus-server-set-info \"" server "\" '"
-          (prin1-to-string info) ")"))
-  (let* ((server (nth 1 info))
-        (entry (assoc server gnus-server-alist)))
-    (if entry (setcdr entry info)
-      (setq gnus-server-alist
-           (nconc gnus-server-alist (list (cons server info)))))))
-
-(defun gnus-server-to-method (server)
-  ;; Map virtual server names to select methods.
-  (or (and (equal server "native") gnus-select-method)
-      (cdr (assoc server gnus-server-alist))))
-
-(defun gnus-server-extend-method (group method)
-  ;; This function "extends" a virtual server.  If the server is
-  ;; "hello", and the select method is ("hello" (my-var "something")) 
-  ;; in the group "alt.alt", this will result in a new virtual server
-  ;; called "helly+alt.alt".
-  (let ((entry
-        (gnus-copy-sequence 
-         (if (equal (car method) "native") gnus-select-method
-           (cdr (assoc (car method) gnus-server-alist))))))
-    (setcar (cdr entry) (concat (nth 1 entry) "+" group))
-    (nconc entry (cdr method))))
-
-(defun gnus-server-get-method (group method)
-  ;; Input either a server name, and extended server name, or a
-  ;; select method, and return a select method. 
-  (cond ((stringp method)
-        (gnus-server-to-method method))
-       ((and (stringp (car method)) group)
-        (gnus-server-extend-method group method))
-       (t
-        (gnus-server-add-address method))))
-
-(defun gnus-server-add-address (method)
-  (let ((method-name (symbol-name (car method))))
-    (if (and (memq 'address (assoc method-name gnus-valid-select-methods))
-            (not (assq (intern (concat method-name "-address")) method)))
-       (append method (list (list (intern (concat method-name "-address"))
-                                  (nth 1 method))))
-      method)))
-
-(defun gnus-server-equal (s1 s2)
-  (or (equal s1 s2)
-      (and (= (length s1) (length s2))
-          (progn
-            (while (and s1 (member (car s1) s2))
-              (setq s1 (cdr s1)))
-            (null s1)))))
-
-;;; Interactive server functions.
-
-(defun gnus-server-kill-server (server)
-  "Kill the server on the current line."
-  (interactive (list (gnus-server-server-name)))
-  (or (gnus-server-goto-server server)
-      (if server (error "No such server: %s" server)
-       (error "No server on the current line")))
-  (gnus-dribble-enter "")
-  (let ((buffer-read-only nil))
-    (delete-region (progn (beginning-of-line) (point))
-                  (progn (forward-line 1) (point))))
-  (setq gnus-server-killed-servers 
-       (cons (assoc server gnus-server-alist) gnus-server-killed-servers))
-  (setq gnus-server-alist (delq (car gnus-server-killed-servers)
-                               gnus-server-alist))
-  (gnus-server-position-point))
-
-(defun gnus-server-yank-server ()
-  "Yank the previously killed server."
-  (interactive)
-  (or gnus-server-killed-servers
-      (error "No killed servers to be yanked"))
-  (let ((alist gnus-server-alist)
-       (server (gnus-server-server-name))
-       (killed (car gnus-server-killed-servers)))
-    (if (not server) 
-       (setq gnus-server-alist (nconc gnus-server-alist (list killed)))
-      (if (string= server (car (car gnus-server-alist)))
-         (setq gnus-server-alist (cons killed gnus-server-alist))
-       (while (and (cdr alist)
-                   (not (string= server (car (car (cdr alist))))))
-         (setq alist (cdr alist)))
-       (setcdr alist (cons killed (cdr alist)))
-       (if alist
-           (setcdr alist (cons killed (cdr alist)))
-         (setq gnus-server-alist (list killed)))))
-    (gnus-server-update-server (car killed))
-    (setq gnus-server-killed-servers (cdr gnus-server-killed-servers))
-    (gnus-server-position-point)))
-
-(defun gnus-server-exit ()
-  "Return to the group buffer."
-  (interactive)
-  (kill-buffer (current-buffer))
-  (switch-to-buffer gnus-group-buffer))
-
-(defun gnus-server-list-servers ()
-  "List all available servers."
-  (interactive)
-  (let ((cur (gnus-server-server-name)))
-    (gnus-server-prepare)
-    (if cur (gnus-server-goto-server cur)
-      (goto-char (point-max))
-      (forward-line -1))
-    (gnus-server-position-point)))
-
-(defun gnus-opened-servers-remove (method)
-  "Remove METHOD from the list of opened servers."
-  (setq gnus-opened-servers (delq (assoc method gnus-opened-servers)
-                                 gnus-opened-servers)))
-
-(defun gnus-server-open-server (server)
-  "Force an open of SERVER."
-  (interactive (list (gnus-server-server-name)))
-  (let ((method (gnus-server-to-method server)))
-    (or method (error "No such server: %s" server))
-    (gnus-opened-servers-remove method)
-    (prog1
-       (or (gnus-open-server method)
-           (progn (message "Couldn't open %s" server) nil))
-      (gnus-server-update-server server)
-      (gnus-server-position-point))))
-
-(defun gnus-server-close-server (server)
-  "Close SERVER."
-  (interactive (list (gnus-server-server-name)))
-  (let ((method (gnus-server-to-method server)))
-    (or method (error "No such server: %s" server))
-    (gnus-opened-servers-remove method)
-    (prog1
-       (gnus-close-server method)
-      (gnus-server-update-server server)
-      (gnus-server-position-point))))
-
-(defun gnus-server-deny-server (server)
-  "Make sure SERVER will never be attempted opened."
-  (interactive (list (gnus-server-server-name)))
-  (let ((method (gnus-server-to-method server)))
-    (or method (error "No such server: %s" server))
-    (gnus-opened-servers-remove method)
-    (setq gnus-opened-servers
-         (cons (list method 'denied) gnus-opened-servers)))
-  (gnus-server-update-server server)
-  (gnus-server-position-point))
-
-(defun gnus-server-remove-denials ()
-  "Remove all marks as to whether Gnus could open servers or not."
-  (interactive)
-  (setq gnus-opened-servers nil)
-  (gnus-server-list-servers))
-
-(defun gnus-server-copy-server (from to)
-  (interactive
-   (list
-    (or (gnus-server-server-name)
-       (error "No server on the current line"))
-    (read-string "Copy to: ")))
-  (or from (error "No server on current line"))
-  (or (and to (not (string= to ""))) (error "No name to copy to"))
-  (and (assoc to gnus-server-alist) (error "%s already exists" to))
-  (or (assoc from gnus-server-alist) 
-      (error "%s: no such server" from))
-  (let ((to-entry (gnus-copy-sequence (assoc from gnus-server-alist))))
-    (setcar to-entry to)
-    (setcar (nthcdr 2 to-entry) to)
-    (setq gnus-server-killed-servers 
-         (cons to-entry gnus-server-killed-servers))
-    (gnus-server-yank-server)))
-
-(defun gnus-server-add-server (how where)
-  (interactive 
-   (list (intern (completing-read "Server method: "
-                                 gnus-valid-select-methods nil t))
-        (read-string "Server name: ")))
-  (setq gnus-server-killed-servers 
-       (cons (list where how where) gnus-server-killed-servers))
-  (gnus-server-yank-server))
-
-(defun gnus-server-goto-server (server)
-  "Jump to a server line."
-  (interactive
-   (list (completing-read "Goto server: " gnus-server-alist nil t)))
-  (let ((to (text-property-any (point-min) (point-max) 
-                              'gnus-server (intern server))))
-    (and to
-        (progn
-          (goto-char to) 
-          (gnus-server-position-point)))))
-
-(defun gnus-server-edit-server (server)
-  "Edit the server on the current line."
-  (interactive (list (gnus-server-server-name)))
-  (or server
-      (error "No server on current line"))
-  (let ((winconf (current-window-configuration)))
-    (get-buffer-create gnus-server-edit-buffer)
-    (gnus-configure-windows 'edit-server)
-    (gnus-add-current-to-buffer-list)
-    (emacs-lisp-mode)
-    (make-local-variable 'gnus-prev-winconf)
-    (setq gnus-prev-winconf winconf)
-    (use-local-map (copy-keymap (current-local-map)))
-    (let ((done-func '(lambda () 
-                       "Exit editing mode and update the information."
-                       (interactive)
-                       (gnus-server-edit-server-done 'group))))
-      (setcar (cdr (nth 4 done-func)) server)
-      (local-set-key "\C-c\C-c" done-func))
-    (erase-buffer)
-    (insert ";; Type `C-c C-c' after you have edited the server.\n\n")
-    (insert (pp-to-string (cdr (assoc server gnus-server-alist))))))
-
-(defun gnus-server-edit-server-done (server)
-  (interactive)
-  (set-buffer (get-buffer-create gnus-server-edit-buffer))
-  (goto-char (point-min))
-  (let ((form (read (current-buffer)))
-       (winconf gnus-prev-winconf))
-    (gnus-server-set-info server form)
-    (kill-buffer (current-buffer))
-    (and winconf (set-window-configuration winconf))
-    (set-buffer gnus-server-buffer)
-    (gnus-server-update-server (gnus-server-server-name))
-    (gnus-server-list-servers)
-    (gnus-server-position-point)))
-
-(defun gnus-server-read-server (server)
-  "Browse a server."
-  (interactive (list (gnus-server-server-name)))
-  (gnus-browse-foreign-server (gnus-server-to-method server) (current-buffer)))
-
-(defun gnus-mouse-pick-server (e)
-  (interactive "e")
-  (mouse-set-point e)
-  (gnus-server-read-server (gnus-server-server-name)))
-
-;;;
-;;; entry points into gnus-score.el
-;;;
-
-;;; Finding score files. 
-
-(defvar gnus-global-score-files nil
-  "*List of global score files and directories.
-Set this variable if you want to use people's score files.  One entry
-for each score file or each score file directory.  Gnus will decide
-by itself what score files are applicable to which group.
-
-Say you want to use the single score file
-\"/ftp.ifi.uio.no@ftp:/pub/larsi/ding/score/soc.motss.SCORE\" and all
-score files in the \"/ftp.some-where:/pub/score\" directory.
-
- (setq gnus-global-score-files
-       '(\"/ftp.ifi.uio.no:/pub/larsi/ding/score/soc.motss.SCORE\"
-         \"/ftp.some-where:/pub/score\"))")
-
-(defun gnus-score-score-files (group)
-  "Return a list of all possible score files."
-  ;; Search and set any global score files.
-  (and gnus-global-score-files 
-       (or gnus-internal-global-score-files
-          (gnus-score-search-global-directories gnus-global-score-files)))
-  ;; Fix the kill-file dir variable.
-  (setq gnus-kill-files-directory 
-       (file-name-as-directory
-        (or gnus-kill-files-directory "~/News/")))
-  ;; If we can't read it, there are no score files.
-  (if (not (file-exists-p (expand-file-name gnus-kill-files-directory)))
-      (setq gnus-score-file-list nil)
-    (if (gnus-use-long-file-name 'not-score)
-       ;; We want long file names.
-       (if (or (not gnus-score-file-list)
-               (not (car gnus-score-file-list))
-               (gnus-file-newer-than gnus-kill-files-directory
-                                     (car gnus-score-file-list)))
-           (setq gnus-score-file-list 
-                 (cons (nth 5 (file-attributes gnus-kill-files-directory))
-                       (nreverse 
-                        (directory-files 
-                         gnus-kill-files-directory t 
-                         (gnus-score-file-regexp))))))
-      ;; We do not use long file names, so we have to do some
-      ;; directory traversing.  
-      (let ((mdir (length (expand-file-name gnus-kill-files-directory)))
-           (suffixes (list gnus-score-file-suffix gnus-adaptive-file-suffix))
-           dir files suffix)
-       (while suffixes
-         (setq dir (expand-file-name
-                    (concat gnus-kill-files-directory
-                            (gnus-replace-chars-in-string group ?. ?/))))
-         (setq dir (gnus-replace-chars-in-string dir ?: ?/))
-         (setq suffix (car suffixes)
-               suffixes (cdr suffixes))
-         (if (file-exists-p (concat dir "/" suffix))
-             (setq files (cons (concat dir "/" suffix) files)))
-         (while (>= (1+ (length dir)) mdir)
-           (and (file-exists-p (concat dir "/all/" suffix))
-                (setq files (cons (concat dir "/all/" suffix) files)))
-           (string-match "/[^/]*$" dir)
-           (setq dir (substring dir 0 (match-beginning 0)))))
-       (setq gnus-score-file-list 
-             (cons nil (nreverse files)))))
-    (cdr gnus-score-file-list)))
-
-(defun gnus-score-file-regexp ()
-  (concat "\\(" gnus-score-file-suffix 
-         "\\|" gnus-adaptive-file-suffix "\\)$"))
-       
-(defun gnus-score-find-bnews (group)
-  "Return a list of score files for GROUP.
-The score files are those files in the ~/News directory which matches
-GROUP using BNews sys file syntax."
-  (let* ((sfiles (append (gnus-score-score-files group)
-                        gnus-internal-global-score-files))
-        (kill-dir (file-name-as-directory 
-                   (expand-file-name gnus-kill-files-directory)))
-        (klen (length kill-dir))
-        ofiles not-match regexp)
-    (save-excursion
-      (set-buffer (get-buffer-create "*gnus score files*"))
-      (buffer-disable-undo (current-buffer))
-      ;; Go through all score file names and create regexp with them
-      ;; as the source.  
-      (while sfiles
-       (erase-buffer)
-       (insert (car sfiles))
-       (goto-char (point-min))
-       ;; First remove the suffix itself.
-       (re-search-forward (concat "." (gnus-score-file-regexp)))
-       (replace-match "" t t) 
-       (goto-char (point-min))
-       (if (looking-at (regexp-quote kill-dir))
-           ;; If the file name was just "SCORE", `klen' is one character
-           ;; too much.
-           (delete-char (min (1- (point-max)) klen))
-         (goto-char (point-max))
-         (search-backward "/")
-         (delete-region (1+ (point)) (point-min)))
-       ;; If short file names were used, we have to translate slashes.
-       (goto-char (point-min))
-       (while (re-search-forward "[/:]" nil t)
-         (replace-match "." t t))
-       ;; Cludge to get rid of "nntp+" problems.
-       (goto-char (point-min))
-       (and (looking-at "nn[a-z]+\\+")
-            (progn
-              (search-forward "+")
-              (forward-char -1)
-              (insert "\\")))
-       ;; Translate "all" to ".*".
-       (while (search-forward "all" nil t)
-         (replace-match ".*" t t))
-       (goto-char (point-min))
-       ;; Deal with "not."s.
-       (if (looking-at "not.")
-           (progn
-             (setq not-match t)
-             (setq regexp (buffer-substring 5 (point-max))))
-         (setq regexp (buffer-substring 1 (point-max)))
-         (setq not-match nil))
-       ;; Finally - if this resulting regexp matches the group name,
-       ;; we add this score file to the list of score files
-       ;; applicable to this group.
-       (if (or (and not-match
-                    (not (string-match regexp group)))
-               (and (not not-match)
-                    (string-match regexp group)))
-           (setq ofiles (cons (car sfiles) ofiles)))
-       (setq sfiles (cdr sfiles)))
-      (kill-buffer (current-buffer))
-      ;; Slight kludge here - the last score file returned should be
-      ;; the local score file, whether it exists or not. This is so
-      ;; that any score commands the user enters will go to the right
-      ;; file, and not end up in some global score file.
-      (let ((localscore (gnus-score-file-name group)))
-       (setq ofiles (cons localscore (delete localscore ofiles))))
-      (nreverse ofiles))))
-
-(defun gnus-score-find-single (group)
-  "Return list containing the score file for GROUP."
-  (list (gnus-score-file-name group gnus-adaptive-file-suffix)
-       (gnus-score-file-name group)))
-
-(defun gnus-score-find-hierarchical (group)
-  "Return list of score files for GROUP.
-This includes the score file for the group and all its parents."
-  (let ((all (copy-sequence '(nil)))
-       (start 0))
-    (while (string-match "\\." group (1+ start))
-      (setq start (match-beginning 0))
-      (setq all (cons (substring group 0 start) all)))
-    (setq all (cons group all))
-    (nconc
-     (mapcar (lambda (newsgroup)
-              (gnus-score-file-name newsgroup gnus-adaptive-file-suffix))
-            (setq all (nreverse all)))
-     (mapcar 'gnus-score-file-name all))))
-
-(defvar gnus-score-file-alist-cache nil)
-
-(defun gnus-score-find-alist (group)
-  "Return list of score files for GROUP.
-The list is determined from the variable gnus-score-file-alist."
-  (let ((alist gnus-score-file-multiple-match-alist)
-       score-files)
-    ;; if this group has been seen before, return the cached entry
-    (if (setq score-files (assoc group gnus-score-file-alist-cache))
-       (cdr score-files)               ;ensures caching groups with no matches
-      ;; handle the multiple match alist
-      (while alist
-       (and (string-match (car (car alist)) group)
-            (setq score-files
-                  (nconc score-files (copy-sequence (cdr (car alist))))))
-       (setq alist (cdr alist)))
-      (setq alist gnus-score-file-single-match-alist)
-      ;; handle the single match alist
-      (while alist
-       (and (string-match (car (car alist)) group)
-            ;; progn used just in case ("regexp") has no files
-            ;; and score-files is still nil. -sj
-            ;; this can be construed as a "stop searching here" feature :>
-            ;; and used to simplify regexps in the single-alist 
-            (progn
-              (setq score-files
-                    (nconc score-files (copy-sequence (cdr (car alist)))))
-              (setq alist nil)))
-       (setq alist (cdr alist)))
-      ;; cache the score files
-      (setq gnus-score-file-alist-cache
-           (cons (cons group score-files) gnus-score-file-alist-cache))
-      score-files)))
-
-(defun gnus-possibly-score-headers (&optional trace)
-  (let ((func gnus-score-find-score-files-function)
-       score-files)
-    (and func 
-        (not (listp func))
-        (setq func (list func)))
-    ;; Go through all the functions for finding score files (or actual
-    ;; scores) and add them to a list.
-    (and func (setq score-files (gnus-score-find-alist gnus-newsgroup-name)))
-    (while func
-      (and (symbolp (car func))
-          (fboundp (car func))
-          (setq score-files 
-                (nconc score-files (funcall (car func) gnus-newsgroup-name))))
-      (setq func (cdr func)))
-    (if score-files (gnus-score-headers score-files trace))))
-
-(defun gnus-score-file-name (newsgroup &optional suffix)
-  "Return the name of a score file for NEWSGROUP."
-  (let ((suffix (or suffix gnus-score-file-suffix)))
-    (cond 
-     ((or (null newsgroup)
-         (string-equal newsgroup ""))
-      ;; The global score file is placed at top of the directory.
-      (expand-file-name 
-       suffix (or gnus-kill-files-directory "~/News")))
-     ((gnus-use-long-file-name 'not-score)
-      ;; Append ".SCORE" to newsgroup name.
-      (expand-file-name (concat (gnus-newsgroup-saveable-name newsgroup)
-                               "." suffix)
-                       (or gnus-kill-files-directory "~/News")))
-     (t
-      ;; Place "SCORE" under the hierarchical directory.
-      (expand-file-name (concat (gnus-newsgroup-directory-form newsgroup)
-                               "/" suffix)
-                       (or gnus-kill-files-directory "~/News"))))))
-
-(defun gnus-score-search-global-directories (files)
-  "Scan all global score directories for score files."
-  ;; Set the variable `gnus-internal-global-score-files' to all
-  ;; available global score files.
-  (interactive (list gnus-global-score-files))
-  (let (out)
-    (while files
-      (if (string-match "/$" (car files))
-         (setq out (nconc (directory-files 
-                           (car files) t
-                           (concat (gnus-score-file-regexp) "$"))))
-       (setq out (cons (car files) out)))
-      (setq files (cdr files)))
-    (setq gnus-internal-global-score-files out)))
+      (set-buffer nntp-server-buffer)
+      (goto-char (point-min))
+      (when (looking-at "[^ \t]+[ \t]+\\(.*\\)")
+       (match-string 1)))))
 
 ;;;
 ;;; Buffering of read articles.
@@ -15366,7 +14868,6 @@ The list is determined from the variable gnus-score-file-alist."
                 (1+ beg) 'gnus-backlog (current-buffer) (point-max)))))
       (erase-buffer)
       (insert-buffer-substring gnus-backlog-buffer beg end))))
-                                             
 
 ;; Allow redefinition of Gnus functions.
 
index f2b7997..56428db 100644 (file)
@@ -45,7 +45,7 @@ Possible values:
        (, (concat "^" rmail-unix-mail-delimiter))
        nil "^$" nil nil nil)
       (babyl "\^_\^L *\n" "\^_" "^[0-9].*\n" "^$" nil nil
-            "\\*\\*\\* EOOH \\*\\*\\*\n\\(^.+\n\\)*")
+            "^$")
       (digest
        "^------------------------------*[\n \t]+"
        "^------------------------------*[\n \t]+"
index daa8e8b..aa87f54 100644 (file)
@@ -364,18 +364,28 @@ The buffer is not selected, just returned to the caller."
        ;; without inserting extra newline.
        (fill-region-as-paragraph begin (1+ (point))))))
 
-(defun nnheader-remove-header (header &optional is-regexp)
+(defun nnheader-remove-header (header &optional is-regexp first)
+  "Remove HEADER.
+If FIRST, only remove the first instance if the header.
+Return the number of headers removed."
   (goto-char (point-min))
   (let ((regexp (if is-regexp header (concat "^" header ":")))
-       (case-fold-search t))
-    (while (re-search-forward regexp nil t)
+       (number 0)
+       (case-fold-search t)
+       last)
+    (while (and (re-search-forward regexp nil t)
+               (not last))
+      (incf number)
+      (when first
+       (setq last t))
       (delete-region
        (match-beginning 0) 
        ;; There might be a continuation header, so we have to search
        ;; until we find a new non-continuation line.
        (if (re-search-forward "^[^ \t]" nil t)
           (match-beginning 0)
-        (point-max))))))
+        (point-max))))
+    number))
 
 (defun nnheader-set-temp-buffer (name)
   (set-buffer (get-buffer-create name))
index 7ddb1c8..483e681 100644 (file)
@@ -69,6 +69,11 @@ If nil, the first match found will be used.")
 directory.  You may need to set this variable if other programs are putting
 new mail into folder numbers that Gnus has marked as expired.")
 
+(defvar nnmail-use-long-file-names nil
+  "*If non-nil the mail backends will use long file and directory names.
+If nil, groups like \"mail.misc\" will end up in directories like
+\"mail/misc/\".")
+
 (defvar nnmail-expiry-wait 7
   "*Articles that are older than `nnmail-expiry-wait' days will be expired.")
 
@@ -244,10 +249,15 @@ perfomed.")
       (progn (insert-file-contents file) t)
     (file-error nil)))
 
-(defun nnmail-article-pathname (group mail-dir)
+(defun nnmail-group-pathname (group mail-dir)
   "Make pathname for GROUP."
-  (concat (file-name-as-directory (expand-file-name mail-dir))
-         (nnmail-replace-chars-in-string group ?. ?/) "/"))
+  (let ((mail-dir (file-name-as-directory (expand-file-name mail-dir))))
+    ;; If this directory exists, we use it directly.
+    (if (or nnmail-use-long-file-names 
+           (file-directory-p (concat mail-dir group)))
+       (concat mail-dir group "/")
+      ;; If not, we translate dots into slashes.
+      (concat mail-dir (nnmail-replace-chars-in-string group ?. ?/) "/"))))
 
 (defun nnmail-replace-chars-in-string (string from to)
   "Replace characters in STRING from FROM to TO."
@@ -286,7 +296,7 @@ perfomed.")
     ;; We create the directory the tofile is to reside in if it
     ;; doesn't exist.
     (or (file-exists-p (file-name-directory tofile))
-       (make-directory tofile 'parents))
+       (make-directory (file-name-directory tofile) 'parents))
     ;; If getting from mail spool directory,
     ;; use movemail to move rather than just renaming,
     ;; so as to interlock with the mailer.
@@ -329,9 +339,10 @@ perfomed.")
               (save-excursion
                 (setq errors (generate-new-buffer " *nnmail loss*"))
                 (buffer-disable-undo errors)
-                (call-process
-                 (expand-file-name nnmail-movemail-program exec-directory)
-                 nil errors nil inbox tofile)
+                (let ((default-directory "/"))
+                  (call-process
+                   (expand-file-name nnmail-movemail-program exec-directory)
+                   nil errors nil inbox tofile))
                 (if (not (buffer-modified-p errors))
                     ;; No output => movemail won
                     nil
@@ -354,7 +365,6 @@ perfomed.")
         (kill-buffer errors))
     tofile))
 
-
 (defun nnmail-get-active ()
   "Returns an assoc of group names and active ranges.
 nn*-request-list should have been called before calling this function."
@@ -365,27 +375,11 @@ nn*-request-list should have been called before calling this function."
       (goto-char (point-min))
       (while (re-search-forward 
              "^\\([^ \t]+\\)[ \t]+\\([0-9]+\\)[ \t]+\\([0-9]+\\)" nil t)
-       (setq group-assoc
-             (cons (list (buffer-substring (match-beginning 1) 
-                                           (match-end 1))
-                         (cons (string-to-int 
-                                (buffer-substring (match-beginning 3)
-                                                  (match-end 3)))
-                               (string-to-int 
-                                (buffer-substring (match-beginning 2)
-                                                  (match-end 2)))))
-                   group-assoc))))
-
-    ;;    ;; In addition, add all groups mentioned in `nnmail-split-methods'.
-    ;;    (let ((methods (and (not (symbolp nnmail-split-methods))
-    ;;                 nnmail-split-methods)))
-    ;;      (while methods
-    ;; (if (not (assoc (car (car methods)) group-assoc))
-    ;;     (setq group-assoc
-    ;;           (cons (list (car (car methods)) (cons 1 0)) 
-    ;;                 group-assoc)))
-    ;; (setq methods (cdr methods)))
-    
+       ;; We create an alist with `(GROUP (LOW . HIGH))' elements.
+       (push (list (match-string 1)
+                   (cons (string-to-int (match-string 3))
+                         (string-to-int (match-string 2))))
+             group-assoc)))
     group-assoc))
 
 (defun nnmail-save-active (group-assoc file-name)
@@ -452,25 +446,23 @@ FUNC will be called with the buffer narrowed to each mail."
            ;; Find the Message-ID header.
            (save-excursion
              (if (re-search-backward "^Message-ID:[ \t]*\\(<[^>]*>\\)" nil t)
-                 (setq message-id (buffer-substring (match-beginning 1)
-                                                    (match-end 1)))
+                 (setq message-id (match-string 1))
                ;; There is no Message-ID here, so we create one.
                (forward-line -1)
                (insert "Message-ID: " (setq message-id (nnmail-message-id))
                        "\n")))
            ;; Look for a Content-Length header.
            (if (not (save-excursion
-                      (and (re-search-backward 
-                            "^Content-Length: \\([0-9]+\\)" start t)
-                           (setq content-length (string-to-int
-                                                 (buffer-substring 
-                                                  (match-beginning 1)
-                                                  (match-end 1))))
-                           ;; We destroy the header, since none of
-                           ;; the backends ever use it, and we do not
-                           ;; want to confuse other mailers by having
-                           ;; a (possibly) faulty header.
-                           (progn (insert "X-") t))))
+                      (when (re-search-backward 
+                             "^Content-Length: \\([0-9]+\\)" start t)
+                        (setq content-length 
+                              (string-to-int (match-string 1)))
+                        ;; We destroy the header, since none of
+                        ;; the backends ever use it, and we do not
+                        ;; want to confuse other mailers by having
+                        ;; a (possibly) faulty header.
+                        (insert "X-") 
+                        t)))
                (setq do-search t)
              (if (or (= (+ (point) content-length) (point-max))
                      (save-excursion
index a801778..7e430c6 100644 (file)
         (string-to-int (file-name-nondirectory file)))))
 
 (defun nnmh-request-group (group &optional server dont-check)
-  (let ((pathname (nnmh-article-pathname group nnmh-directory))
+  (let ((pathname (nnmail-group-pathname group nnmh-directory))
        dir)
     (if (file-directory-p pathname)
        (progn
       (setq article (concat nnmh-current-directory 
                            (int-to-string (car articles))))
       (if (setq mod-time (nth 5 (file-attributes article)))
-         (if (and (or (not nnmail-keep-last-article)
-                      (not max-article)
-                      (not (= (car articles) max-article)))
-                  (not (equal mod-time '(0 0)))
+         (if (and (nnmh-deletable-article-p newsgroup (car articles))
                   (or force
-                      (setq is-old
-                            (> (nnmail-days-between
-                                (current-time-string)
-                                (current-time-string mod-time))
-                               days))))
+                      (and (not (equal mod-time '(0 0)))
+                           (setq is-old
+                                 (> (nnmail-days-between
+                                     (current-time-string)
+                                     (current-time-string mod-time))
+                                    days)))))
              (progn
                (and gnus-verbose-backends 
                     (message "Deleting article %s in %s..." 
   (let ((buf (get-buffer-create " *nnmh move*"))
        result)
     (and 
+     (nnmh-deletable-article-p group article)
      (nnmh-request-article article group server)
      (save-excursion
        (set-buffer buf)
             (rename-file 
              (directory-file-name nnmh-current-directory)
              (directory-file-name 
-              (nnmail-article-pathname new-name nnmh-directory)))
+              (nnmail-group-pathname new-name nnmh-directory)))
             t)
         (error nil))
        ;; That went ok, so we change the internal structures.
 
 (defun nnmh-possibly-change-directory (newsgroup)
   (if newsgroup
-      (let ((pathname (nnmh-article-pathname newsgroup nnmh-directory)))
+      (let ((pathname (nnmail-group-pathname newsgroup nnmh-directory)))
        (if (file-directory-p pathname)
            (setq nnmh-current-directory pathname)
          (error "No such newsgroup: %s" newsgroup)))))
 
 (defun nnmh-possibly-create-directory (group)
   (let (dir dirs)
-    (setq dir (nnmh-article-pathname group nnmh-directory))
+    (setq dir (nnmail-group-pathname group nnmh-directory))
     (while (not (file-directory-p dir))
       (setq dirs (cons dir dirs))
       (setq dir (file-name-directory (directory-file-name dir))))
          first)
       (while ga
        (nnmh-possibly-create-directory (car (car ga)))
-       (let ((file (concat (nnmh-article-pathname 
+       (let ((file (concat (nnmail-group-pathname 
                             (car (car ga)) nnmh-directory) 
                            (int-to-string (cdr (car ga))))))
          (if first
          (setq nnmh-group-alist (cons (list group active) nnmh-group-alist))))
     (setcdr active (1+ (cdr active)))
     (while (file-exists-p
-           (concat (nnmh-article-pathname group nnmh-directory)
+           (concat (nnmail-group-pathname group nnmh-directory)
                    (int-to-string (cdr active))))
       (setcdr active (1+ (cdr active))))
     (cdr active)))
 
-(defun nnmh-article-pathname (group mail-dir)
-  "Make pathname for GROUP."
-  (let ((mail-dir (file-name-as-directory (expand-file-name mail-dir))))
-    (if (file-directory-p (concat mail-dir group))
-       (concat mail-dir group "/")
-      (concat mail-dir (nnmail-replace-chars-in-string group ?. ?/) "/"))))
-
 (defun nnmh-update-gnus-unreads (group)
   ;; Go through the .nnmh-articles file and compare with the actual
   ;; articles in this folder. The articles that are "new" will be
       (write-region (point-min) (point-max) nnmh-file nil 'nomesg)
       (kill-buffer (current-buffer)))))
 
+(defun nnmh-deletable-article-p (group article)
+  "Say whether ARTICLE in GROUP can be deleted."
+  (or (not nnmail-keep-last-article)
+      (not (eq (cdr (nth 1 (assoc group nnmh-group-alist))) article))))
+
 (provide 'nnmh)
 
 ;;; nnmh.el ends here
index b35c045..651af4a 100644 (file)
@@ -182,7 +182,7 @@ all. This may very well take some time.")
               (concat 
                (if (numberp id)
                    nnml-current-directory
-                 (nnmail-article-pathname (car group-num) nnml-directory))
+                 (nnmail-group-pathname (car group-num) nnml-directory))
                (int-to-string number))))
         (nntp-server-buffer (or buffer nntp-server-buffer)))
     (and file
@@ -277,9 +277,7 @@ all. This may very well take some time.")
       (setq article (concat nnml-current-directory 
                            (int-to-string (car articles))))
       (if (setq mod-time (nth 5 (file-attributes article)))
-         (if (and (or (not nnmail-keep-last-article)
-                      (not max-article)
-                      (not (= (car articles) max-article)))
+         (if (and (nnml-deletable-article-p newsgroup (car articles))
                   (or force
                       (and (not (equal mod-time '(0 0)))
                            (setq is-old
@@ -314,6 +312,7 @@ all. This may very well take some time.")
   (let ((buf (get-buffer-create " *nnml move*"))
        result)
     (and 
+     (nnml-deletable-article-p group article)
      (nnml-request-article article group server)
      (save-excursion
        (set-buffer buf)
@@ -431,7 +430,7 @@ all. This may very well take some time.")
             (rename-file 
              (directory-file-name nnml-current-directory)
              (directory-file-name 
-              (nnmail-article-pathname new-name nnml-directory)))
+              (nnmail-group-pathname new-name nnml-directory)))
             t)
         (error nil))
        ;; That went ok, so we change the internal structures.
@@ -446,6 +445,11 @@ all. This may very well take some time.")
 \f
 ;;; Internal functions.
 
+(defun nnml-deletable-article-p (group article)
+  "Say whether ARTICLE in GROUP can be deleted."
+  (or (not nnmail-keep-last-article)
+      (not (eq (cdr (nth 1 (assoc group nnml-group-alist))) article))))
+
 ;; Find an article number in the current group given the Message-ID. 
 (defun nnml-find-group-number (id)
   (save-excursion
@@ -471,7 +475,7 @@ all. This may very well take some time.")
 (defun nnml-find-id (group id)
   (erase-buffer)
   (insert-file-contents 
-   (concat (nnmail-article-pathname group nnml-directory)
+   (concat (nnmail-group-pathname group nnml-directory)
           nnml-nov-file-name))
   (let (number found)
     (while (and (not found) 
@@ -520,7 +524,7 @@ all. This may very well take some time.")
 
 (defun nnml-possibly-change-directory (newsgroup &optional force)
   (if newsgroup
-      (let ((pathname (nnmail-article-pathname newsgroup nnml-directory)))
+      (let ((pathname (nnmail-group-pathname newsgroup nnml-directory)))
        (and (or force (file-directory-p pathname))
             (setq nnml-current-directory pathname
                   nnml-current-group newsgroup)))
@@ -528,7 +532,7 @@ all. This may very well take some time.")
 
 (defun nnml-possibly-create-directory (group)
   (let (dir dirs)
-    (setq dir (nnmail-article-pathname group nnml-directory))
+    (setq dir (nnmail-group-pathname group nnml-directory))
     (while (not (file-directory-p dir))
       (setq dirs (cons dir dirs))
       (setq dir (file-name-directory (directory-file-name dir))))
@@ -554,7 +558,7 @@ all. This may very well take some time.")
          first)
       (while ga
        (nnml-possibly-create-directory (car (car ga)))
-       (let ((file (concat (nnmail-article-pathname 
+       (let ((file (concat (nnmail-group-pathname 
                             (car (car ga)) nnml-directory)
                            (int-to-string (cdr (car ga))))))
          (if first
@@ -587,7 +591,7 @@ all. This may very well take some time.")
          (setq nnml-group-alist (cons (list group active) nnml-group-alist))))
     (setcdr active (1+ (cdr active)))
     (while (file-exists-p
-           (concat (nnmail-article-pathname group nnml-directory)
+           (concat (nnmail-group-pathname group nnml-directory)
                    (int-to-string (cdr active))))
       (setcdr active (1+ (cdr active))))
     (cdr active)))
@@ -600,7 +604,7 @@ all. This may very well take some time.")
     (insert (int-to-string article) line)))
 
 (defsubst nnml-header-value ()
-  (buffer-substring (match-end 0) (save-excursion (end-of-line) (point))))
+  (buffer-substring (match-end 0) (progn (end-of-line) (point))))
 
 (defun nnml-make-nov-line (chars)
   "Create a nov from the current headers."
@@ -630,7 +634,8 @@ all. This may very well take some time.")
             ((eq char ?f)
              (setq from (nnml-header-value)))
             ((eq char ?x)
-             (setq xref (nnml-header-value)))
+             (setq xref (buffer-substring (match-beginning 0) 
+                                          (progn (end-of-line) (point)))))
             ((eq char ?l)
              (setq lines (nnml-header-value)))
             ((eq char ?d)
@@ -658,13 +663,14 @@ all. This may very well take some time.")
                                (lambda (time) (int-to-string time))
                                (current-time) "-")))
                (or references "")
-               (or chars 0) (or lines "0") (or xref ""))))))
+               (or chars 0) (or lines "0") 
+               (or xref ""))))))
 
 (defun nnml-open-nov (group)
   (or (cdr (assoc group nnml-nov-buffer-alist))
       (let ((buffer (find-file-noselect 
-                    (concat (nnmail-article-pathname 
-                             group nnml-directory) nnml-nov-file-name))))
+                    (concat (nnmail-group-pathname group nnml-directory)
+                            nnml-nov-file-name))))
        (save-excursion
          (set-buffer buffer)
          (buffer-disable-undo (current-buffer)))
@@ -687,7 +693,7 @@ all. This may very well take some time.")
 
 ;;;###autoload
 (defun nnml-generate-nov-databases (dir)
-  "Generate nov databases in all nnml mail newsgroups."
+  "Generate nov databases in all nnml directories."
   (interactive 
    (progn   
      (setq nnml-group-alist nil)
@@ -734,18 +740,19 @@ all. This may very well take some time.")
          (while files
            (erase-buffer)
            (insert-file-contents (concat dir "/" (int-to-string (car files))))
-           (goto-char (point-min))
-           (narrow-to-region 1 (save-excursion (search-forward "\n\n" nil t)
-                                               (setq chars (- (point-max) 
-                                                              (point)))
-                                               (point)))
-           (if (not (= 0 chars))       ; none of them empty files...
-               (progn
-                 (setq nov-line (nnml-make-nov-line chars))
-                 (save-excursion
-                   (set-buffer nov-buffer)
-                   (goto-char (point-max))
-                   (insert (int-to-string (car files)) nov-line))))
+           (narrow-to-region 
+            (goto-char (point-min))
+            (save-excursion
+              (search-forward "\n\n" nil t)
+              (setq chars (- (point-max) (point)))
+              (point)))
+           (when (and (not (= 0 chars))        ; none of them empty files...
+                      (not (= (point-min) (point-max))))
+             (setq nov-line (nnml-make-nov-line chars))
+             (save-excursion
+               (set-buffer nov-buffer)
+               (goto-char (point-max))
+               (insert (int-to-string (car files)) nov-line)))
            (widen)
            (setq files (cdr files)))
          (save-excursion
index 8978897..d33e465 100644 (file)
 (require 'nnmail)
 (require 'gnus-soup)
 (require 'gnus-msg)
+(eval-when-compile (require 'cl))
 
 (defvar nnsoup-directory "~/SOUP/"
-  "*SOUP packet directory directory.")
+  "*SOUP packet directory.")
 
 (defvar nnsoup-replies-directory (concat nnsoup-directory "replies/")
   "*Directory where outgoing packets will be composed.")
@@ -99,6 +100,7 @@ The SOUP packet file name will be inserted at the %s.")
          (use-nov t)
          useful-areas this-area-seq)
       (if (stringp (car sequence))
+         ;; We don't support fetching by Message-ID.
          'headers
        ;; We go through all the areas and find which files the
        ;; articles in SEQUENCE come from.
@@ -106,24 +108,23 @@ The SOUP packet file name will be inserted at the %s.")
          ;; Peel off areas that are below sequence.
          (while (and areas (< (cdr (car (car areas))) (car sequence)))
            (setq areas (cdr areas)))
-         (if (not areas)
-             ()
+         (when areas
            ;; This is a useful area.
-           (setq useful-areas (cons (car areas) useful-areas)
-                 this-area-seq nil)
+           (push (car areas) useful-areas)
+           (setq this-area-seq nil)
            ;; We take note whether this MSG has a corresponding IDX
            ;; for later use.
-           (if (or (= (gnus-soup-encoding-index 
-                       (gnus-soup-area-encoding (nth 1 (car areas)))) ?n)
-                   (not (file-exists-p
-                         (nnsoup-file
-                          (gnus-soup-area-prefix (nth 1 (car areas)))))))
-               (setq use-nov nil))
-           ;; We assing the portion of `sequence' that is relevant to
+           (when (or (= (gnus-soup-encoding-index 
+                         (gnus-soup-area-encoding (nth 1 (car areas)))) ?n)
+                     (not (file-exists-p
+                           (nnsoup-file
+                            (gnus-soup-area-prefix (nth 1 (car areas)))))))
+             (setq use-nov nil))
+           ;; We assign the portion of `sequence' that is relevant to
            ;; this MSG packet to this packet.
            (while (and sequence (<= (car sequence) (cdr (car (car areas)))))
-             (setq this-area-seq (cons (car sequence) this-area-seq)
-                   sequence (cdr sequence)))
+             (push (car sequence) this-area-seq)
+             (setq sequence (cdr sequence)))
            (setcar useful-areas (cons (nreverse this-area-seq)
                                       (car useful-areas)))))
 
@@ -137,22 +138,25 @@ The SOUP packet file name will be inserted at the %s.")
        ;; what lines are relevant.  If some of the IDX files are
        ;; missing, we must return HEADs for all the articles.
        (if use-nov
-           (while useful-areas
-             (goto-char (point-max))
-             (let ((b (point))
-                   (number (car (nth 1 (car useful-areas)))))
-               (insert-buffer-substring
-                (nnsoup-index-buffer
-                 (gnus-soup-area-prefix
-                  (nth 2 (car useful-areas)))))
-               (goto-char b)
-               ;; We have to remove the index number entires and
-               ;; insert article numbers instead.
-               (while (looking-at "[0-9]+")
-                 (replace-match (int-to-string number) t t)
-                 (setq number (1+ number))
-                 (forward-line 1)))
-             (setq useful-areas (cdr useful-areas)))
+           ;; We have IDX files for all areas.
+           (progn
+             (while useful-areas
+               (goto-char (point-max))
+               (let ((b (point))
+                     (number (car (nth 1 (car useful-areas)))))
+                 (insert-buffer-substring
+                  (nnsoup-index-buffer
+                   (gnus-soup-area-prefix
+                    (nth 2 (car useful-areas)))))
+                 (goto-char b)
+                 ;; We have to remove the index number entires and
+                 ;; insert article numbers instead.
+                 (while (looking-at "[0-9]+")
+                   (replace-match (int-to-string number) t t)
+                   (incf number)
+                   (forward-line 1)))
+               (setq useful-areas (cdr useful-areas)))
+             'nov)
          ;; We insert HEADs.
          (while useful-areas
            (setq articles (car (car useful-areas))
@@ -170,11 +174,10 @@ The SOUP packet file name will be inserted at the %s.")
          ;; Fold continuation lines.
          (goto-char (point-min))
          (while (re-search-forward "\\(\r?\n[ \t]+\\)+" nil t)
-           (replace-match " " t t)))
-       (if use-nov 'nov 'headers)))))
+           (replace-match " " t t))
+         'headers)))))
 
 (defun nnsoup-open-server (server &optional defs)
-  (nnsoup-set-variables)
   (nnheader-init-server-buffer)
   (if (equal server nnsoup-current-server)
       t
@@ -195,6 +198,7 @@ The SOUP packet file name will be inserted at the %s.")
 (defun nnsoup-request-close ()
   (nnsoup-write-active-file)
   (nnsoup-write-replies)
+  (gnus-soup-save-areas)
   (while nnsoup-buffers
     (and (car nnsoup-buffers)
         (buffer-name (car nnsoup-buffers))
@@ -284,6 +288,43 @@ The SOUP packet file name will be inserted at the %s.")
   (nnsoup-store-reply "mail")
   t)
 
+(defun nnsoup-request-expire-articles (articles group &optional server force)
+  (nnsoup-possibly-change-group group)
+  (let* ((days (or (and nnmail-expiry-wait-function
+                       (funcall nnmail-expiry-wait-function group))
+                  nnmail-expiry-wait))
+        (total-infolist (assoc group nnsoup-group-alist))
+        (infolist (cdr total-infolist))
+        info range-list mod-time prefix)
+    (while infolist
+      (setq info (pop infolist)
+           range-list (gnus-uncompress-range (car info))
+           prefix (gnus-soup-area-prefix (nth 1 info)))
+      (when ;; All the articles in this file are marked for expiry.
+         (and (gnus-sublist-p articles range-list)
+              ;; This file is old enough.  We have to check for 
+              ;; `(0 0)', since that's what ange-ftp files reply with.
+              (or force
+                  (and (not (equal
+                             (setq mod-time (nth 5 (nnsoup-file prefix)))
+                             '(0 0)))
+                       (> (nnmail-days-between
+                           (current-time-string)
+                           (current-time-string mod-time))
+                          days))))
+       ;; Ok, we delete this file.
+       (when (condition-case nil
+                 (and
+                  (delete-file (nnsoup-file prefix))
+                  (delete-file (nnsoup-file prefix) t)
+                  t)
+               (error nil))
+         (setcdr total-infolist (delq info total-infolist))
+         (setq articles (gnus-sorted-complement articles range-list)))))
+    (nnsoup-write-active-file)
+    ;; Return the articles that weren't expired.
+    articles))
+
 \f
 ;;; Internal functions
 
@@ -299,14 +340,15 @@ The SOUP packet file name will be inserted at the %s.")
        (error nil))))
 
 (defun nnsoup-write-active-file ()
-  (save-excursion
-    (set-buffer (get-buffer-create " *nnsoup work*"))
-    (buffer-disable-undo (current-buffer))
-    (erase-buffer)
-    (insert (format "(setq nnsoup-group-alist '%S)\n" nnsoup-group-alist))
-    (write-region (point-min) (point-max) nnsoup-active-file
-                 nil 'silent)
-    (kill-buffer (current-buffer))))
+  (when nnsoup-group-alist
+    (save-excursion
+      (set-buffer (get-buffer-create " *nnsoup work*"))
+      (buffer-disable-undo (current-buffer))
+      (erase-buffer)
+      (insert (format "(setq nnsoup-group-alist '%S)\n" nnsoup-group-alist))
+      (write-region (point-min) (point-max) nnsoup-active-file
+                   nil 'silent)
+      (kill-buffer (current-buffer)))))
 
 (defun nnsoup-read-areas ()
   (save-excursion
@@ -365,6 +407,7 @@ The SOUP packet file name will be inserted at the %s.")
     (or (get-buffer buffer-name)       ; File aready loaded.
        (save-excursion                 ; Load the file.
          (set-buffer (get-buffer-create buffer-name))
+         (buffer-disable-undo (current-buffer))
          (setq nnsoup-buffers (cons (current-buffer) nnsoup-buffers))
          (insert-file-contents (concat nnsoup-directory file))
          (current-buffer)))))
@@ -452,25 +495,37 @@ The SOUP packet file name will be inserted at the %s.")
    (t
     (error "Unknown format: %c" format))))
 
+;;;###autoload
 (defun nnsoup-pack-replies ()
   "Make an outbound package of SOUP replies."
   (interactive)
+  ;; Write all data buffers.
+  (gnus-soup-save-areas)
+  ;; Write the active file.
   (nnsoup-write-active-file)
+  ;; Write the REPLIES file.
   (nnsoup-write-replies)
+  ;; Pack all these files into a SOUP packet.
   (gnus-soup-pack nnsoup-replies-directory nnsoup-packer))
 
 (defun nnsoup-write-replies ()
-  (gnus-soup-write-replies nnsoup-replies-directory nnsoup-replies-list))
+  "Write the REPLIES file."
+  (when nnsoup-replies-list
+    (gnus-soup-write-replies nnsoup-replies-directory nnsoup-replies-list)
+    (setq nnsoup-replies-list nil)))
 
 (defun nnsoup-article-to-area (article group)
+  "Return the area that ARTICLE in GROUP is located in."
   (let ((areas (cdr (assoc group nnsoup-group-alist))))
     (while (and areas (< (cdr (car (car areas))) article))
       (setq areas (cdr areas)))
     (and areas (car areas))))
 
+;;;###autoload
 (defun nnsoup-set-variables ()
+  "Use the SOUP methods for posting news and mailing mail."
+  (interactive)
   (setq gnus-inews-article-function 'nnsoup-request-post)
-  (setq gnus-mail-send-method 'nnsoup-request-mail)
   (setq send-mail-function 'nnsoup-request-mail))
 
 (defun nnsoup-store-reply (kind)
@@ -527,10 +582,10 @@ The SOUP packet file name will be inserted at the %s.")
       (kill-buffer tembuf))))
 
 (defun nnsoup-kind-to-prefix (kind)
-  (or nnsoup-replies-list
-      (setq nnsoup-replies-list
-           (gnus-soup-parse-replies 
-            (concat nnsoup-replies-directory "REPLIES"))))
+  (unless nnsoup-replies-list
+    (setq nnsoup-replies-list
+         (gnus-soup-parse-replies 
+          (concat nnsoup-replies-directory "REPLIES"))))
   (let ((replies nnsoup-replies-list))
     (while (and replies 
                (not (string= kind (gnus-soup-reply-kind (car replies)))))
index 231031c..b2337a7 100644 (file)
@@ -505,16 +505,11 @@ Newsgroup must be selected before calling this function."
         (ttime (mapcar (lambda (ti) (and ti (string-to-int ti)))
                        (timezone-parse-time
                         (aref (timezone-parse-date date) 3))))
-        (edate (mapcar (lambda (ti) (and ti (string-to-int ti)))
-                       (timezone-parse-date "Jan 1 12:00:00 1970")))
-        (tday (- (timezone-absolute-from-gregorian 
-                  (nth 1 tdate) (nth 2 tdate) (nth 0 tdate))
-                 (timezone-absolute-from-gregorian 
-                  (nth 1 edate) (nth 2 edate) (nth 0 edate)))))
-    (+ (nth 2 ttime)
-       (* (nth 1 ttime) 60)
-       (* 1.0 (nth 0 ttime) 60 60)
-       (* 1.0 tday 60 60 24))))
+        (unix (encode-time (nth 2 ttime) (nth 1 ttime) (nth 0 ttime)
+                           (nth 2 tdate) (nth 1 tdate) (nth 0 tdate) 
+                           (nth 4 tdate))))
+    (+ (* (car unix) 65536.0)
+       (car (cdr unix)))))
 
 (provide 'nnspool)
 
index 5de09e8..257005b 100644 (file)
@@ -1,3 +1,41 @@
+Mon Nov 13 00:14:30 1995  Lars Ingebrigtsen  <lars@eyesore.no>
+
+       * gnus.texi (Various File Formats): New.
+       (Active File Format): New.
+       (Newsgroups File Format): New.
+       (nndoc): Addition.
+       (Group Score): New.
+       (SOUP Replies): New.
+       (nnsoup): New.
+       (SOUP Commands): New.
+       (@sc{soup}): New.
+       (Saving Articles): Addition.
+
+Sun Nov 12 13:17:53 1995  Lars Ingebrigtsen  <lars@eyesore.no>
+
+       * gnus.texi (Various Summary Stuff): Addition.
+       (Score Variables): Addition.
+       (Process/Prefix): Addition.
+       (Selecting a Group): Change.
+       (Reading Mail): Addition.
+
+Thu Nov  9 21:30:44 1995  Lars Ingebrigtsen  <lars@eyesore.no>
+
+       * gnus.texi (Posting Server): New.
+       (nnspool): Addition.
+
+Mon Nov  6 12:58:11 1995  Lars Ingebrigtsen  <lars@eyesore.no>
+
+       * gnus.texi (Group Topics): Addition.
+
+Tue Oct 31 22:04:28 1995  Lars Ingebrigtsen  <lars@eyesore.no>
+
+       * gnus.texi (Group Topics): Change.
+
+Mon Oct 30 19:40:54 1995  Lars Ingebrigtsen  <lars@eyesore.no>
+
+       * gnus.texi (Score Variables): Addition.
+
 Thu Oct 26 14:56:41 1995  Lars Ingebrigtsen  <lars@eyesore.no>
 
        * gnus.texi (Limiting): Change.
index 608155d..d662dd7 100644 (file)
@@ -150,11 +150,11 @@ newsgroups that have hundreds (or thousands) of new articles each day?
 
 Gnus offer no real solutions to these questions, but I would very much
 like to see Gnus being used as a testing ground for new methods of
-reading and fetching news. Expanding on Umeda-san's wise decision to
+reading and fetching news.  Expanding on Umeda-san's wise decision to
 separate the newsreader from the backends, Gnus now offers a simple
 interface for anybody who wants to write new backends for fetching mail
-and news from different sources. I have added hooks for customizations
-everywhere I can imagine useful. By doing so, I'm inviting every one of
+and news from different sources.  I have added hooks for customizations
+everywhere I can imagine useful.  By doing so, I'm inviting every one of
 you to explore and invent new ways of reading news.
 
 May Gnus never be complete. @kbd{C-u 100 M-x hail-emacs}. 
@@ -344,7 +344,7 @@ wrong show.
 Of course, GNUS was written by Masanobu UMEDA.
 @item 
 Many excellent functions, especially dealing with scoring and
-highlighting (as well as the soon-to-come @sc{soup} support) was written
+highlighting (as well as the @sc{soup} support) was written
 by Per Abrahamsen.
 @item
 Innumerable bug fixes were written by Sudish Joseph.
@@ -607,7 +607,7 @@ The top part of an article, where administration information (etc.) is
 put. 
 @item body
 @cindex body
-The rest of an article. Everything that is not in the head is in the
+The rest of an article.  Everything that is not in the head is in the
 body. 
 @item header
 @cindex header
@@ -783,7 +783,7 @@ will happen whether the server doesn't actually exist (i.e., you have
 given the wrong address) or the server has just momentarily taken ill
 for some reason or other.  
 
-If Gnus says "nntp server on <your server> can't be opened. Continue?",
+If Gnus says "nntp server on <your server> can't be opened.  Continue?",
 you do not want to continue unless you have some foreign groups that you
 want to read.  Even if you don't, Gnus will let you continue, but you'll
 find it difficult to actually do anything in the group buffer.  But,
@@ -865,11 +865,12 @@ Subscribe all new groups hierarchically.
 @vindex gnus-subscribe-interactively
 Subscribe new groups interactively.  This means that Gnus will ask
 you about @strong{all} new groups.
+
 @item gnus-subscribe-zombies
 @vindex gnus-subscribe-zombies
-Make all new groups zombies.  You can browse the zombies later and
-either kill them all off properly, or subscribe to them.  This is the
-default.
+Make all new groups zombies.  You can browse the zombies later (with
+@kbd{A z}) and either kill them all off properly, or subscribe to them.
+This is the default.
 @end table
 
 @vindex gnus-subscribe-hierarchical-interactive
@@ -993,8 +994,8 @@ file being whatever that one is with a @samp{.eld} appended.
 files, while @code{gnus-save-quick-newsrc-hook} is called just before
 saving the @file{.newsrc.eld} file, and
 @code{gnus-save-standard-newsrc-hook} is called just before saving the
-@file{.newsrc} file.  The latter two are commonly used to tern version
-control on or off.
+@file{.newsrc} file.  The latter two are commonly used to turn version
+control on or off.  Version control is off by default when saving.
 
 @node Auto Save
 @section Auto Save
@@ -1009,7 +1010,7 @@ Emacs way.  If your Emacs should crash before you have saved the
 this file.
 
 If Gnus detects this file at startup, it will ask the user whether to
-read it. The auto save file is deleted whenever the real startup file is
+read it.  The auto save file is deleted whenever the real startup file is
 saved.
 
 @vindex gnus-use-dribble-file
@@ -1118,10 +1119,12 @@ long as Gnus is active.
 * Selecting a Group::      Actually reading news.
 * Subscription Commands::  Unsubscribing, killing, subscribing.
 * Group Levels::           Levels? What are those, then?
+* Group Score::            A mechanism for finding out what groups you like.
 * Marking Groups::         You can mark groups for later processing.
 * Foreign Groups::         How to create foreign groups.
 * Group Parameters::       Each group may have different parameters set.
 * Listing Groups::         Gnus can list various subsets of the groups.
+* Sorting Groups::         Re-arrange the group order.
 * Group Maintenance::      Maintaining a tidy @file{.newsrc} file.
 * Browse Foreign Server::  You can browse a server.  See what if has to offer.
 * Exiting Gnus::           Stop reading news and get some work done.
@@ -1373,11 +1376,26 @@ the @samp{n} oldest articles will be fetched.  If it is positive, the
 
 @vindex gnus-select-group-hook
 @vindex gnus-auto-select-first
-If @code{gnus-auto-select-first} is non-@code{nil}, the first unread
-article in the group will be displayed when you enter the group.  If you
-want to prevent automatic selection in some group (say, in a binary
-group with Huge articles) you can set this variable to @code{nil} in
-@code{gnus-select-group-hook}, which is called when a group is selected.
+@code{gnus-auto-select-first} control whether any articles are selected
+automatically when entering a group.  
+
+@table @code
+@item nil
+Don't select any articles when entering the group.  Just display the
+full summary buffer.
+
+@item t
+Select the first unread article when entering the group.  
+
+@item best
+Select the most high-scored article in the group when entering the
+group. 
+@end table
+        
+If you want to prevent automatic selection in some group (say, in a
+binary group with Huge articles) you can set this variable to @code{nil}
+in @code{gnus-select-group-hook}, which is called when a group is
+selected.
 
 @findex gnus-thread-sort-by-total-score
 @findex gnus-thread-sort-by-date
@@ -1414,6 +1432,7 @@ The function in the @code{gnus-thread-score-function} variable (default
 functions might be @code{max}, @code{min}, or squared means, or whatever
 tickles you fancy.
 
+
 @node Subscription Commands
 @section Subscription Commands
 @cindex subscribing
@@ -1528,6 +1547,35 @@ If @code{gnus-group-use-permament-levels} is non-@code{nil}, once you
 give a level prefix to @kbd{g} or @kbd{l}, all subsequent commands will
 use this level as the "work" level.
 
+
+@node Group Score
+@section Group Score
+@cindex group score
+
+You would normally keep important groups on high levels, but that scheme
+is somewhat restrictive.  Don't you wish you could have Gnus sort the
+group buffer according to how often you read groups, perhaps?  Within
+reason?  
+
+This is what @dfn{group score} is for.  You can assign a score to each
+group.  You can then sort the group buffer based on this score.
+Alternatively, you can sort on score and then level.  (Taken together,
+the level and the score is called the @dfn{rank} of the group.  A group
+that is on level 4 and has a score of 1 has a higher rank than a group
+on level 5 that has a score of 300.  (The level is the most significant
+part and the score is the least significant part.)
+
+@findex gnus-summary-bubble-group
+If you want groups you read often to get higher scores than groups you
+read seldom you can add the @code{gnus-summary-bubble-group} function to
+the @code{gnus-summary-exit-hook} hook.  This will result (after
+sorting) in a bubbling sort of action.  If you want to see that in
+action after each summary exit, you can add
+@code{gnus-group-sort-groups-by-rank} or
+@code{gnus-group-sort-groups-by-score} to the same hook, but that will
+slow things down somewhat.
+
+
 @node Marking Groups
 @section Marking Groups
 @cindex marking groups
@@ -1704,8 +1752,9 @@ The different methods all have their peculiarities, of course.
 * nnvirtual::        Combining articles from many groups.
 * nnkiboze::         Looking through parts of the newsfeed for articles.
 * nndir::            You can read a directory as if it was a newsgroup.
-* nneething::          Dired? Who needs dired?
+* nneething::        Dired?  Who needs dired?
 * nndoc::            Single files can be the basis of a group.
+* SOUP::             Reading @sc{SOUP} packets "offline".
 * Reading Mail::     Reading your personal mail with Gnus.
 @end menu
 
@@ -1867,7 +1916,9 @@ Anyways, you just specify @code{nnspool} as the method and @samp{""} (or
 anything else) as the address.
 
 If you have access to a local spool, you should probably use that as the
-native select method (@pxref{Finding the News}).
+native select method (@pxref{Finding the News}).  It is normally faster
+than using an @code{nntp} select method, but might not be.  It depends.
+You just have to try to find out what's best at your site.
 
 @table @code
 @item nnspool-inews-program
@@ -1898,7 +1949,7 @@ The path of the active file.
 
 @item nnspool-newsgroups-file
 @vindex nnspool-newsgroups-file
-The path of the group description file.
+The path of the group descriptions file.
 
 @item nnspool-history-file
 @vindex nnspool-history-file
@@ -1971,6 +2022,7 @@ One limitation, however---all groups that are included in a virtual
 group has to be alive (i.e., subscribed or unsubscribed).  Killed or
 zombie groups can't be component groups for @code{nnvirtual} groups.
 
+
 @node nnkiboze
 @subsection nnkiboze
 @cindex @code{nnkiboze}
@@ -1981,9 +2033,10 @@ the news feed".  @code{nnkiboze} is a backend that will do this for you.  Oh
 joy!  Now you can grind any @sc{nntp} server down to a halt with useless
 requests!  Oh happiness!
 
-The address field of the @code{nnkiboze} method is, as with @code{nnvirtual}, a regexp
-to match groups to be "included" in the @code{nnkiboze} group.  There most
-similarities between @code{nnkiboze} and @code{nnvirtual} ends.
+The address field of the @code{nnkiboze} method is, as with
+@code{nnvirtual}, a regexp to match groups to be "included" in the
+@code{nnkiboze} group.  There most similarities between @code{nnkiboze}
+and @code{nnvirtual} ends.
 
 In addition to this regexp detailing component groups, an @code{nnkiboze} group
 must have a score file to say what articles that are to be included in
@@ -2048,36 +2101,36 @@ methods if you feel the need to have a non-read-only @code{nndir}.
 
 From the @code{nndir} backend (which reads a single spool-like
 directory), it's just a hop and a skip to @code{nneething}, which
-pretends that any random directory is a newsgroup. Strange, but true.
+pretends that any random directory is a newsgroup.  Strange, but true.
 
 When @code{nneething} is presented with a directory, it will scan this
-directory and assign article numbers to each file. When you enter such a
-group, @code{nneething} must create "headers" that Gnus can use. After
+directory and assign article numbers to each file.  When you enter such a
+group, @code{nneething} must create "headers" that Gnus can use.  After
 all, Gnus is a newsreader, in case you're forgetting. @code{nneething}
-does this in a two-step process. First, it snoops each file in question.
+does this in a two-step process.  First, it snoops each file in question.
 If the file looks like an article (i.e., the first few lines look like
-headers), it will use this as the head. If this is just some random file
+headers), it will use this as the head.  If this is just some random file
 without a head (eg. a C source file), @code{nneething} will cobble up a
-header out of thin air. It will use file ownership, name and date and do
+header out of thin air.  It will use file ownership, name and date and do
 whatever it can with these elements.
 
 All this should happen automatically for you, and you will be presented
-with something that looks very much like a newsgroup. Totally like a
-newsgroup, to be precise. If you select an article, it will be displayed
+with something that looks very much like a newsgroup.  Totally like a
+newsgroup, to be precise.  If you select an article, it will be displayed
 in the article buffer, just as usual.
 
 If you select a line that represents a directory, Gnus will pop you into
-a new summary buffer for this @code{nneething} group. And so on. You can
+a new summary buffer for this @code{nneething} group.  And so on.  You can
 traverse the entire disk this way, if you feel like, but remember that
 Gnus is not dired, really, and does not intend to be, either.
 
-There are two overall modes to this action---ephemeral or solid. When
+There are two overall modes to this action---ephemeral or solid.  When
 doing the ephemeral thing (i.e., @kbd{G D} from the group buffer), Gnus
 will not store information on what files you have read, and what files
-are new, and so on. If you create a solid @code{nneething} group the
+are new, and so on.  If you create a solid @code{nneething} group the
 normal way with @kbd{G m}, Gnus will store a mapping table between
 article numbers and file names, and you can treat this group like any
-other groups. When you activate a solid @code{nneething} group, you will
+other groups.  When you activate a solid @code{nneething} group, you will
 be told how many unread articles it contains, etc., etc.
 
 Some variables:
@@ -2090,7 +2143,7 @@ in this directory, which defaults to @file{~/.nneething/}.
 
 @item nneething-exclude-files
 @vindex nneething-exclude-files
-All files that match this regexp will be ignored. Nice to use to exclude
+All files that match this regexp will be ignored.  Nice to use to exclude
 auto-save files and the like, which is what it does by default.
 
 @item nneething-map-file
@@ -2113,6 +2166,16 @@ and @code{digest}.
 it---it will simply, like, let you use the file as the basis for a
 group.  And that's it.
 
+If you have some old archived articles that you want to insert into your
+new & spiffy Gnus mail backend, @code{nndoc} can probably help you with
+that.  Say you have an old @file{RMAIL} file with mail that you now want
+to split into your new @code{nnml} groups.  You look at that file using
+@code{nndoc}, set the process mark on all the articles in the buffer
+(@kbd{M P b}, for instance), and then respool (@kbd{B r}) using
+@code{nnml}.  If all goes well, all the mail in the @file{RMAIL} file is
+now also stored in lots of @code{nnml} directories, and you can delete
+that pesky @file{RMAIL} file.  If you have the guts!  
+
 Virtual server variables:
 
 @table @code
@@ -2121,6 +2184,245 @@ Virtual server variables:
 This should be one of @code{mbox}, @code{babyl} or @code{digest}. 
 @end table
 
+
+@node SOUP
+@subsection @sc{soup}
+@cindex @sc{SOUP}
+@cindex offline
+
+In the PC world people often talk about "offline" newsreaders.  These
+are thingies that are combined reader/news transport monstrosities.
+With built-in modem programs.  Yecchh!  
+
+Of course, us Unix Weenie types of human beans use things like
+@code{uucp} and, like, @code{nntpd} and set up proper news and mail
+transport things like Ghod inteded.  And then we just use normal
+newsreaders.  
+
+However, it can sometimes be convenient to do something a that's a bit
+easier on the brain if you have a very slow modem, and you're not really
+that interested in doing things properly.  
+
+A file format called @sc{soup} has been developed for transporting news
+and mail from servers to home machines and back again.  It can be a bit
+fiddly.
+
+@enumerate
+
+@item
+You log in on the server and create a @sc{soup} packet.  You can either
+use a dedicated @sc{soup} thingie, or you can use Gnus to create the
+packet with the @kbd{O s} command.
+
+@item 
+You transfer the packet home.  Rail, boat, car or modem will do fine.
+
+@item
+You put the packet in your home directory.
+
+@item
+You fire up Gnus using the @code{nnsoup} backend as the native server.
+
+@item
+You read articles and mail and answer and followup to the things you
+want.
+
+@item 
+You do the @kbd{G S r} command to pack these replies into a @sc{soup}
+packet.
+
+@item 
+You transfer this packet to the server.  
+
+@item
+You use Gnus to mail this packet out with the @kbd{G S s} command.
+
+@item
+You then repeat until you die.
+
+@end enumerate
+
+So you basically have a bipartite system---you use @code{nnsoup} for
+reading and Gnus for packing/sending these @sc{soup} packets.
+
+@menu
+* SOUP Commands::     Commands for creating and sending @sc{soup} packets
+* nnsoup::            A backend for reading @sc{soup} packets.
+* SOUP Replies::      How to enable @code{nnsoup} to take over mail and news.
+@end menu
+
+
+@node SOUP Commands
+@subsubsection @sc{soup} Commands
+
+@table @kbd
+@item G s b
+@kindex G s b (Group)
+@findex gnus-group-brew-soup
+Pack all unread articles in the current group
+(@code{gnus-group-brew-soup}).  This command understands the
+process/prefix convention.
+
+@item G s w
+@kindex G s w (Group)
+@findex gnus-soup-save-areas
+Save all data files (@code{gnus-soup-save-areas}).
+
+@item G s s
+@kindex G s s (Group)
+@findex gnus-soup-send-replies
+Send all replies from the replies packet
+(@code{gnus-soup-send-replies}). 
+
+@item G s p
+@kindex G s p (Group)
+@findex gnus-soup-pack-packet
+Pack all files into a @sc{soup} packet (@code{gnus-soup-pack-packet}). 
+
+@item G s r
+@kindex G s r (Group)
+@findex nnsoup-pack-replies
+Pack all replies into a replies packet (@code{nnsoup-pack-replies}). 
+
+@item O s
+@kindex O s (Summary)
+@findex gnus-soup-add-article
+This summary-mode command adds the current article to a @sc{soup} packet
+(@code{gnus-soup-add-article}).  It understands the process/prefix
+convention. 
+
+@end table
+
+
+There are a few variables to customize where Gnus will put all these
+thingies:  
+
+@table @code
+
+@item gnus-soup-directory
+@vindex gnus-soup-directory
+Directory where Gnus will save intermediate files while composing
+@sc{soup} packets.  The default is @file{~/SoupBrew/}. 
+
+@item gnus-soup-replies-directory
+@vindex gnus-soup-replies-directory
+This is what Gnus will use as a temporary directory while sending our
+reply packets.  The default is @file{~/SoupBrew/SoupReplies/}. 
+
+@item gnus-soup-prefix-file
+@vindex gnus-soup-prefix-file
+Name of the file where Gnus stores the last used prefix.  The default is
+@samp{"gnus-prefix"}. 
+
+@item gnus-soup-packer
+@vindex gnus-soup-packer
+A format string command for packing a @sc{soup} packet.  The default is
+@samp{ "tar cf - %s | gzip > $HOME/Soupout%d.tgz"}. 
+
+@item gnus-soup-unpacker
+@vindex gnus-soup-unpacker
+Format string command for unpacking a @sc{soup} packet.  The default is
+@samp{"gunzip -c %s | tar xvf -"}.
+
+@item gnus-soup-packet-directory
+@vindex gnus-soup-packet-directory
+Wehre Gnus will look for reply packets.  The default is @file{~/}. 
+
+@item gnus-soup-packet-regexp
+@vindex gnus-soup-packet-regexp
+Regular expression matching @sc{soup} reply packets in
+@code{gnus-soup-packet-directory}. 
+
+@end table
+
+@node nnsoup
+@subsubsection nnsoup
+@cindex @code{nnsoup}
+
+@code{nnsoup} is the backend for reading @sc{soup} packets.  It will
+read incoming packets, unpack them, and put them in a directory where
+you can read them at leisure.
+
+These are the variables you can use to customize its behavior:
+
+@table @code
+
+@item nnsoup-directory
+@vindex nnsoup-directory
+@code{nnsoup} will move all incoming @sc{soup} packets to this directory
+and unpack them there.  The default is @file{~/SOUP/}.
+
+@item nnsoup-replies-directory 
+@vindex nnsoup-replies-directory 
+All replies will stored in this directory before being packed into a
+reply packet.  The default is @file{~/SOUP/replies/"}.
+
+@item nnsoup-replies-format-type
+@vindex nnsoup-replies-format-type
+The @sc{soup} format of the replies packets.  The default is @samp{?n}
+(rnews), and I don't think you should touch that variable.  I probaly
+shouldn't even have documented it.  Drats!  Too late!
+
+@item nnsoup-replies-index-type
+@vindex nnsoup-replies-index-type
+The index type of the replies packet.  The is @samp{?n}, which means
+"none".  Don't fiddle with this one either!
+
+@item nnsoup-active-file
+@vindex nnsoup-active-file
+Where @code{nnsoup} stores lots of information.  This is not an "active
+file" in the @code{nntp} sense; it's an Emacs Lisp file.  If you lose
+this file or mess it up in any way, you're dead.  The default is
+@file{~/SOUP/active}.
+
+@item nnsoup-packer
+@vindex nnsoup-packer
+Format string command for packing a reply @sc{soup} packet.  The default
+is @samp{"tar cf - %s | gzip > $HOME/Soupin%d.tgz"}. 
+
+@item nnsoup-unpacker
+@vindex nnsoup-unpacker
+Format string command for unpacking incoming @sc{soup} packets.  The
+default is @samp{"gunzip -c %s | tar xvf -"}. 
+
+@item nnsoup-packet-directory
+@vindex nnsoup-packet-directory
+Where @code{nnsoup} will look for incoming packets.  The default is
+@file{~/}.  
+
+@item nnsoup-packet-regexp
+@vindex nnsoup-packet-regexp
+Regular expression matching incoming @sc{soup} packets.  The default is
+@samp{Soupout}. 
+
+@end table
+
+
+@node SOUP Replies
+@subsubsection SOUP Replies
+
+Just using @code{nnsoup} won't mean that your postings and mailings end
+up in @sc{soup} reply packets automagically.  You have to work a bit
+more for that to happen.
+
+@findex nnsoup-set-variables
+The @code{nnsoup-set-variables} command will set the appropriate
+variables to ensure that all your followups and replies end up in the
+@sc{soup} system.
+
+In specific, this is what it does:
+
+@lisp
+(setq gnus-inews-article-function 'nnsoup-request-post)
+(setq send-mail-function 'nnsoup-request-mail)
+@end lisp
+
+And that's it, really.  If you only want news to go into the @sc{soup}
+system you just use the first line.  If you only want mail to be
+@sc{soup}ed you use the second.
+
+
 @node Reading Mail
 @subsection Reading Mail
 @cindex reading mail
@@ -2158,6 +2460,13 @@ mail by themselves.  It is quite likely that Gnus supports POP-mail.
 Set this variable to begin with the string @samp{po:}, and everything
 should go smoothly, even though I have never tested this.
 
+When you use a mail backend, Gnus will slurp all your mail from your
+inbox and plonk it down in your home directory.  Gnus doesn't move any
+mail if you're not using a mail backend---you have to do a lot of magic
+invocations first.  At the time when you have finished drawing the
+pentagram, lightened the candles, and sacrificed the goat, you really
+shouldn't be too suprised when Gnus moves your mail.
+
 @vindex nnmail-use-procmail
 If @code{nnmail-use-procmail} is non-@code{nil}, the mail backends will
 look in @code{nnmail-procmail-directory} for incoming mail.  All the
@@ -2177,23 +2486,29 @@ non-@code{nil}, it will be used instead.
 
 @vindex nnmail-movemail-program
 @code{nnmail-movemail-program} is executed to move mail from the user's
-inbox to her home directory. The default is @samp{"movemail"}.
+inbox to her home directory.  The default is @samp{"movemail"}.
 
 @vindex nnmail-delete-incoming
 If @code{nnmail-delete-incoming} is non-@code{nil}, the mail backends
 will delete the temporary incoming file after splitting mail into the
 proper groups.  This is @code{nil} by default for reasons of security. 
 
+@vindex nnmail-use-long-file-names
+If @code{nnmail-use-long-file-names} is non-@code{nil} the mail backends
+will use long file and directory names.  Groups like @samp{mail.misc}
+will end up in directories like @file{mail.misc/}.  If it is @code{nil},
+the same group will end up in @file{mail/misc/}.
+
 @vindex nnmail-message-id-cache-length
 @vindex nnmail-message-id-cache-file
 @vindex nnmail-delete-duplicates
 @cindex duplicate mails
 If you are a member of a couple of mailing list, you will sometime
-receive two copies of the same mail. This can be quite annoying, so
-@code{nnmail} checks for and discards any duplicates it might find. To
+receive two copies of the same mail.  This can be quite annoying, so
+@code{nnmail} checks for and discards any duplicates it might find.  To
 do this, it keeps a cache of old @code{Message-ID}s -
 @code{nnmail-message-id-cache-file}, which is @file{~/.nnmail-cache} by
-default. The approximate maximum number of @code{Message-ID}s stored
+default.  The approximate maximum number of @code{Message-ID}s stored
 there is controlled by the @code{nnmail-message-id-cache-length}
 variable, which is 1000 by default. (So 1000 @code{Message-ID}s will be
 stored.) If all this sounds scary to you, you can set
@@ -2204,7 +2519,7 @@ Here's a neat feature: If you know that the recipient reads her mail
 with Gnus, and that she has @code{nnmail-delete-duplicates} set to
 @code{t}, you can send her as many insults as you like, just by using a
 @code{Message-ID} of a mail that you know that she's already received.
-Think of all the fun! She'll never see any of it! Whee!
+Think of all the fun!  She'll never see any of it!  Whee!
 
 Gnus gives you all the opportunity you could possibly want for shooting
 yourself in the foot.  Let's say you create a group that will contain
@@ -2256,17 +2571,24 @@ expression should @emph{always} be @samp{""} so that it matches any
 mails that haven't been matched by any of the other regexps.
 
 If you like to tinker with this yourself, you can set this variable to a
-function of your choice. This function will be called without any
+function of your choice.  This function will be called without any
 arguments in a buffer narrowed to the headers of an incoming mail
-message. The function should return a list of groups names that it
+message.  The function should return a list of groups names that it
 thinks should carry this mail message.
 
+Note that the mail backends are free to maul the poor, innocent
+incoming headers all they want to.  They all add @code{Lines} headers;
+some add @code{X-Gnus-Group} headers; most rename the Unix mbox
+@code{From<SPC>} line to something else.
+
 @vindex nnmail-crosspost
 The mail backends all support cross-posting.  If several regexps match,
 the mail will be "cross-posted" to all those groups.
 @code{nnmail-crosspost} says whether to use this mechanism or not.  Note
 that no articles are crossposted to the general (@samp{""}) group. 
 
+
+
 @node Fancy Mail Splitting
 @subsubsection Fancy Mail Splitting
 @cindex mail splitting
@@ -2388,7 +2710,7 @@ Gnus to split the mail the normal way, you could set
 If you use @code{procmail} to split things directory into an @code{nnmh}
 directory (which you shouldn't do), you should set
 @code{nnmail-keep-last-article} to non-@code{nil} to prevent Gnus from
-ever expiring the final article in a mail newsgroup. This is quite,
+ever expiring the final article in a mail newsgroup.  This is quite,
 quite important.
 
 
@@ -2602,7 +2924,8 @@ The active file for the @code{nnml} server.
 
 @item nnml-newsgroups-file
 @vindex nnml-newsgroups-file
-The @code{nnml} group description file.
+The @code{nnml} group descriptions file.  @xref{Newsgroups File
+Format}. 
 
 @item nnml-get-new-mail
 @vindex nnml-get-new-mail
@@ -2679,7 +3002,7 @@ The name of the active file.
 
 @item nnfolder-newsgroups-file
 @vindex nnfolder-newsgroups-file
-The name of the group description file.
+The name of the group descriptions file.  @xref{Newsgroups File Format}.
 
 @item nnfolder-get-new-mail
 @vindex nnfolder-get-new-mail
@@ -2840,39 +3163,18 @@ thing to match on.
 
 @end table
 
-@node Group Maintenance
-@section Group Maintenance
-@cindex bogus groups
-
-@table @kbd
-@item b
-@kindex b (Group)
-@findex gnus-group-check-bogus-groups
-Find bogus groups and delete them
-(@code{gnus-group-check-bogus-groups}).
-@item F
-@kindex F (Group)
-@findex gnus-find-new-newsgroups
-Find new groups and process them (@code{gnus-find-new-newsgroups}).
-@item C-c C-x
-@kindex C-c C-x (Group)
-@findex gnus-group-expire-articles
-Run all expirable articles in the current group through the expiry
-process (if any) (@code{gnus-group-expire-articles}).
 
-@item C-c M-C-x
-@kindex C-c M-C-x (Group)
-@findex gnus-group-expire-all-groups
-Run all articles in all groups through the expiry process
-(@code{gnus-group-expire-all-groups}).
+@node Sorting Groups
+@section Sorting Groups
+@cindex sorting groups
 
-@item C-c C-s
 @kindex C-c C-s (Group)
 @findex gnus-group-sort-groups
 @vindex gnus-group-sort-function
-Sort the groups according to the function given by the
-@code{gnus-group-sort-function} variable
-(@code{gnus-group-sort-groups}).  Available sorting functions include:
+The @kbd{C-c C-s} (@code{gnus-group-srot-groups}) command sorts the
+group buffer according to the function(s) given by the
+@code{gnus-group-sort-function} variable.  Available sorting functions
+include: 
 
 @table @code
 
@@ -2884,6 +3186,15 @@ Sort the group names alphabetically.  This is the default.
 @findex gnus-group-sort-by-level
 Sort by group level.
 
+@item gnus-group-sort-by-score
+@findex gnus-group-sort-by-score
+Sort by group score.
+
+@item gnus-group-sort-by-rank
+@findex gnus-group-sort-by-rank
+Sort by group score and then the group level.  The level and the score
+are, when taken together, the group's @dfn{rank}. 
+
 @item gnus-group-sort-by-unread
 @findex gnus-group-sort-by-unread
 Sort by number of unread articles.
@@ -2892,13 +3203,88 @@ Sort by number of unread articles.
 @findex gnus-group-sort-by-method
 Sort by alphabetically on the select method.
 
+
 @end table
 
 @code{gnus-group-sort-function} can also be a list of sorting
 functions.  In that case, the most significant sort key function must be
 the last one.
+
+
+There are also a number of commands for sorting directly according to
+some sorting criteria:
+
+@table @kbd
+@item G S a
+@kindex G S a (Group)
+@findex gnus-group-sort-groups-by-alphabet
+Sort the group buffer alphabetically by group name
+(@code{gnus-group-sort-groups-by-alphabet}). 
+
+@item G S u
+@kindex G S u (Group)
+@findex gnus-group-sort-groups-by-unread
+Sort the group buffer by the number of unread articles
+(@code{gnus-group-sort-groups-by-unread}).
+
+@item G S l
+@kindex G S l (Group)
+@findex gnus-group-sort-groups-by-level
+Sort the group buffer by group level
+(@code{gnus-group-sort-groups-by-level}). 
+
+@item G S v
+@kindex G S v (Group)
+@findex gnus-group-sort-groups-by-score
+Sort the group buffer by group score
+(@code{gnus-group-sort-groups-by-score}). 
+
+@item G S r
+@kindex G S r (Group)
+@findex gnus-group-sort-groups-by-rank
+Sort the group buffer by group level
+(@code{gnus-group-sort-groups-by-rank}). 
+
+@item G S m
+@kindex G S m (Group)
+@findex gnus-group-sort-groups-by-method
+Sort the group buffer alphabetically by backend name
+(@code{gnus-group-sort-groups-by-method}). 
+
+@end table
+
+
+@node Group Maintenance
+@section Group Maintenance
+@cindex bogus groups
+
+@table @kbd
+@item b
+@kindex b (Group)
+@findex gnus-group-check-bogus-groups
+Find bogus groups and delete them
+(@code{gnus-group-check-bogus-groups}).
+
+@item F
+@kindex F (Group)
+@findex gnus-find-new-newsgroups
+Find new groups and process them (@code{gnus-find-new-newsgroups}).
+
+@item C-c C-x
+@kindex C-c C-x (Group)
+@findex gnus-group-expire-articles
+Run all expirable articles in the current group through the expiry
+process (if any) (@code{gnus-group-expire-articles}).
+
+@item C-c M-C-x
+@kindex C-c M-C-x (Group)
+@findex gnus-group-expire-all-groups
+Run all articles in all groups through the expiry process
+(@code{gnus-group-expire-all-groups}).
+
 @end table
 
+
 @node Browse Foreign Server
 @section Browse Foreign Server
 @cindex foreign servers
@@ -3023,10 +3409,14 @@ them according to topics.  You put your Emacs groups over here, your sex
 groups over there, and the rest (what, two groups or so?) you put in
 some misc section that you never bother with anyway.
 
-To get this @emph{fab} functionality, you set
-@code{gnus-group-prepare-function} to @code{gnus-group-prepare-topics}.
+To get this @emph{fab} functionality:
+
+@lisp
+(setq gnus-group-prepare-function 'gnus-group-prepare-topics)
+@end lisp
+
 Go ahead, just try it.  I'll still be here when you get back.  La de
-dum...  Nice tune, that... la la la...  What, you're back? Yes, and now
+dum...  Nice tune, that...  la la la...  What, you're back? Yes, and now
 press @kbd{l}.  There.  All your groups are now listed under
 @samp{misc}.  Doesn't that make you feel all warm and fuzzy?  Hot and
 bothered?
@@ -3051,7 +3441,7 @@ number, these groups are never shown.
 Whoo, this is complicated.  If @code{gnus-group-topic-topics-only} is
 @code{nil}, all groups and topics will be listed, as you would expect.
 If this variable is non-@code{nil}, only the topics will be listed, and
-the groups will not be listed. This makes the group buffer much shorter,
+the groups will not be listed.  This makes the group buffer much shorter,
 I'm sure you'll agree.  This is all modified on a topic-by-topic basis
 by the @var{show} parameter.   It makes perfect sense, really.
 
@@ -3082,10 +3472,8 @@ If you want to add a group to a topic, you can use the @kbd{G t}
 (@code{gnus-group-add-to-topic}) command.  It understands the
 process/prefix convention (@pxref{Process/Prefix}). 
 
-If you want to add a group to a topic, you can use the @kbd{G t}
-(@code{gnus-group-add-to-topic}) command.  It understands the
-process/prefix convention (@pxref{Process/Prefix}). 
-
+@kbd{A t} (@code{gnus-topic-toggle-topic} toggles between the normal
+flat group buffer display and the topic folded display.
 
 @node Misc Group Stuff
 @section Misc Group Stuff
@@ -3157,7 +3545,8 @@ List all groups that have names or descriptions that match a regexp
 @item a
 @kindex a (Group)
 @findex gnus-group-post-news
-Post an article to a group (@code{gnus-group-post-news}).
+Post an article to a group (@code{gnus-group-post-news}).  The current
+group name will be used as the default.
 @item m
 @kindex m (Group)
 @findex gnus-group-mail
@@ -3272,11 +3661,11 @@ Full @code{From} line.
 @item n
 The name (from the @code{From} header).
 @item a
-The name (from the @code{From} header). This differs from the @code{n}
+The name (from the @code{From} header).  This differs from the @code{n}
 spec in that it uses @code{gnus-extract-address-components}, which is
 slower, but may be more thorough.
 @item A
-The address (from the @code{From} header). This works the same way as
+The address (from the @code{From} header).  This works the same way as
 the @code{a} spec.
 @item L
 Number of lines in the article.
@@ -3374,7 +3763,7 @@ either as @samp{<%U(+%u) more>} if there are both unread and unselected
 articles, and just as @samp{<%U more>} if there are just unread articles
 and no unselected ones.
 @item g
-Shortish group name. For instance, @samp{rec.arts.anime} will be
+Shortish group name.  For instance, @samp{rec.arts.anime} will be
 shortened to @samp{r.a.anime}. 
 @item S
 Subject of the current article.
@@ -3643,6 +4032,7 @@ server.
 @menu 
 * Mail::                 Mailing & replying.
 * Post::                 Posting and following up.
+* Posting Server::       What server should you post via?
 * Mail & Post::          Mailing and posting at the same time.
 * Posting Styles::       An easier way to configure some key elements.
 * Drafts::               Postponing messages and rejected messages.
@@ -3917,7 +4307,7 @@ This optional header will be filled out with the Gnus version numbers.
 @end table
 
 In addition, you can enter conses into this list.  The car of this cons
-should be a symbol. This symbol's name is the name of the header, and
+should be a symbol.  This symbol's name is the name of the header, and
 the cdr can either be a string to be entered verbatim as the value of
 this header, or it can be a function to be called.  This function should
 return a string to be inserted.  For instance, if you want to insert
@@ -3932,11 +4322,6 @@ the cdr of this cons will only be inserted if it is non-@code{nil}.
 Other variables for customizing outgoing articles:
 
 @table @code
-@item gnus-post-method
-@vindex gnus-post-method
-If non-@code{nil}, Gnus will use this method instead of the default
-select method when posting.
-
 @item nntp-news-default-headers
 @vindex nntp-news-default-headers
 If non-@code{nil}, this variable will override
@@ -4011,7 +4396,7 @@ signature.  Nice if you use different signatures in different groups.
 
 @item gnus-post-prepare-hook
 @vindex gnus-post-prepare-hook
-This hook is called after a post buffer has been prepared. If you want
+This hook is called after a post buffer has been prepared.  If you want
 to insert a signature at this point, you could put
 @code{gnus-inews-insert-signature} into this hook.
 
@@ -4100,6 +4485,32 @@ something only moderators should include.
 @end table
 
 
+@node Posting Server
+@subsection Posting Server
+
+When you press those magical @kbd{C-c C-c} keys to ship off your latest
+(extremely intelligent, of course) article, where does it go?
+
+Thank you for asking.  I hate you.
+
+@vindex gnus-post-method
+
+It can be quite complicated.  Normally, Gnus will use the same native
+server.  However.  If your native server doesn't allow posting, just
+reading, you probably want to use some other server to post your
+(extremely intelligent and fabulously interesting) articles.  You can
+then set the @code{gnus-post-method} to some other method:
+
+@lisp
+(setq gnus-post-method '(nnspool ""))
+@end lisp
+
+Now, if you've done this, and then this server rejects your article, or
+this server is down, what do you do then?  To override this variable you
+can use a prefix to the @kbd{C-c C-c} command to force using the
+"current" server for posting.
+
+
 @node Mail & Post
 @subsection Mail & Post
 
@@ -4194,7 +4605,7 @@ the other Gnus variables if it is non-@code{nil}.
 
 Here are two example values of this variable: @samp{"larsi@@ifi.uio.no
 (Lars Magne Ingebrigtsen)"} and @samp{"Lars Magne Ingebrigtsen
-<larsi@@ifi.uio.no>"}. The latter version is recommended in news (and is
+<larsi@@ifi.uio.no>"}.  The latter version is recommended in news (and is
 probably illegal in mail), but the name has to be quoted if it contains
 non-alpha-numerical characters---@samp{"\"Lars M. Ingebrigtsen\"
 <larsi@@ifi.uio.no>"}.
@@ -4227,7 +4638,7 @@ of using the variable described above.
 @vindex gnus-outgoing-message-group 
 All outgoing messages will be put in this group.  If you want to store
 all your outgoing mail and articles in the group @samp{nnml:archive},
-you set this variable to that value. This variable can also be a list of
+you set this variable to that value.  This variable can also be a list of
 group names.
 
 If you want to have greater control over what group to put each
@@ -4804,7 +5215,7 @@ with that mark (@code{gnus-summary-limit-to-marks}).
 
 @item / n
 @kindex / n (Summary)
-@findex 
+@findex gnus-summary-limit-to-articles
 Limit the summary buffer to the current article
 (@code{gnus-summary-limit-to-articles}).  Uses the process/prefix
 convention (@pxref{Process/Prefix}).
@@ -5094,9 +5505,9 @@ that have subjects that are fuzzily equal will be included.
 @cindex asynchronous article fetching
 
 If you read your news from an @sc{nntp} server that's far away, the
-network latencies may make reading articles a chore. You have to wait
+network latencies may make reading articles a chore.  You have to wait
 for a while after pressing @kbd{n} to go to the next article before the
-article appears. Why can't Gnus just go ahead and fetch the article
+article appears.  Why can't Gnus just go ahead and fetch the article
 while you are reading the previous one? Why not, indeed.
 
 First, some caveats.  There are some pitfalls to using asynchronous
@@ -5119,7 +5530,7 @@ loaded than if you didn't use article pre-fetch.  The server itself will
 also become more loaded---both with the extra article requests, and the
 extra connection.
 
-Ok, so now you know that you shouldn't really use this thing... unless
+Ok, so now you know that you shouldn't really use this thing...  unless
 you really want to.
 
 @vindex gnus-asynchronous
@@ -5342,6 +5753,7 @@ considerably.
 
 C'est la vie.
 
+
 @node Process/Prefix
 @section Process/Prefix
 @cindex process/prefix convention
@@ -5369,6 +5781,15 @@ process mark, just perform the operation on the current article.
 Quite simple, really, but it needs to be made clear so that surprises
 are avoided.
 
+@vindex gnus-summary-goto-unread
+One thing that seems to shock & horrify lots of people is that, for
+instance, @kbd{3 d} does exactly the same as @kbd{d} @kbd{d} @kbd{d}.
+Since each @kbd{d} (which marks the current article as read) by default
+goes to the next unread article after marking, this means that @kbd{3 d}
+will mark the next three unread articles as read, no matter what the
+summary buffer looks like.  Set @code{gnus-summary-goto-unread} to
+@code{nil} for a more straightforward action.
+
 @node Saving Articles
 @section Saving Articles
 @cindex saving articles
@@ -5518,29 +5939,25 @@ Generates file names that look like @samp{~/News/alt.andrea-dworkin}.
 
 @vindex gnus-split-methods
 You can have Gnus suggest where to save articles by plonking regexp into
-the @code{gnus-split-methods} alist.  The syntax of this variable is the
-same as @code{nnmail-split-methods}. For instance, if you would like to
+the @code{gnus-split-methods} alist.  For instance, if you would like to
 save articles related to Gnus in the file @file{gnus-stuff}, and articles
 related to VM in @code{vm-stuff}, you could set this variable to something
 like:
 
 @lisp
 (("^Subject:.*gnus\\|^Newsgroups:.*gnus" "gnus-stuff")
- ("^Subject:.*vm\\|^Xref:.*vm" "vm-stuff"))
+ ("^Subject:.*vm\\|^Xref:.*vm" "vm-stuff")
+ (my-choosing-function "../other-dir/my-stuff")
+ ((equal gnus-newsgroup-name "mail.misc") "mail-stuff"))
 @end lisp
 
-@vindex gnus-split-methods
-You can have Gnus suggest where to save articles by plonking regexp into
-the @code{gnus-split-methods} alist.  The syntax of this variable is the
-same as @code{nnmail-split-methods}. For instance, if you would like to
-save articles related to Gnus in the file @file{gnus-stuff}, and articles
-related to VM in @code{vm-stuff}, you could set this variable to something
-like:
-
-@lisp
-(("^Subject:.*gnus\\|^Newsgroups:.*gnus" "gnus-stuff")
- ("^Subject:.*vm\\|^Xref:.*vm" "vm-stuff"))
-@end lisp
+We see that this is a list where each element is a list that has two
+elements---the @dfn{match} and the @dfn{file}.  The match can either be
+a string (in which case it is used as a regexp to match on the article
+head); it can be a symbol (which will be called as a function); or it
+can be a list (which will be @code{eval}ed).  If any of these actions
+have a non-@code{nil} result, the @dfn{file} will be used as a default
+prompt. 
 
 @vindex gnus-use-long-file-name
 Finally, you have the @code{gnus-use-long-file-name} variable.  If it is
@@ -5568,9 +5985,9 @@ a spool, you could
 (setq gnus-default-article-save 'gnus-summary-save-in-file) ; no encoding
 @end lisp
 
-Then just save with @kbd{o}. You'd then read this hierarchy with
+Then just save with @kbd{o}.  You'd then read this hierarchy with
 ephemeral @code{nneething} groups---@kbd{G D} in the group buffer, and
-the toplevel directory as the argument (@file{~/News/}). Then just walk
+the toplevel directory as the argument (@file{~/News/}).  Then just walk
 around to the groups/directories with @code{nneething}.
 
 
@@ -6128,11 +6545,11 @@ Treat quoted-printable (@code{gnus-article-de-quoted-unreadable}).
 @vindex gnus-article-x-face-command
 @vindex gnus-article-x-face-too-ugly
 Look for and display any X-Face headers
-(@code{gnus-article-display-x-face}). The command executed by this
-function is given by the @code{gnus-article-x-face-command} variable. If
+(@code{gnus-article-display-x-face}).  The command executed by this
+function is given by the @code{gnus-article-x-face-command} variable.  If
 this variable is a string, this string will be executed in a sub-shell.
 If it is a function, this function will be called with the face as the
-argument. If the @code{gnus-article-x-face-too-ugly} (which is a regexp)
+argument.  If the @code{gnus-article-x-face-too-ugly} (which is a regexp)
 matches the @code{From} header, the face will not be shown.
 
 @item W b
@@ -6369,7 +6786,7 @@ Expire all expirable articles in the group
 @kindex B M-C-e (Summary)
 @findex gnus-summary-expire-articles-now
 Expunge all the expirable articles in the group
-(@code{gnus-summary-expire-articles-now}). This means that @strong{all}
+(@code{gnus-summary-expire-articles-now}).  This means that @strong{all}
 articles that are eligeble for expiry in the current group will
 disappear forever into that big @file{/dev/null} in the sky.
 
@@ -6438,6 +6855,13 @@ will tell you (@code{gnus-summary-fancy-query}).
 * Really Various Summary Commands::   Those pesky non-conformant commands.
 @end menu
 
+@vindex gnus-summary-generate-hook
+@code{gnus-summary-generate-hook} is called as the last thing before
+doing the threading and the generation of the summary buffer.  It's
+quite convenient for customizing the threading variables based on what
+data the newsgroup has.  This hook is called from the summary buffer
+after most summary buffer variables has been set.
+
 @vindex gnus-summary-prepare-hook
 @code{gnus-summary-prepare-hook} is called after the summary buffer has
 been generated.  You might use it to, for instance, highlight lines or
@@ -6951,7 +7375,7 @@ Gnus will read any @dfn{score files} that apply to the current group
 before generating the summary buffer.
 
 There are several commands in the summary buffer that insert score
-entries based on the current article. You can, for instance, ask Gnus to
+entries based on the current article.  You can, for instance, ask Gnus to
 lower or increase the score of all articles with a certain subject.
 
 There are two sorts of scoring entries: Permanent and temporary.
@@ -7285,13 +7709,20 @@ default.  For instance, if the current group is @samp{gnu.emacs.gnus},
 @samp{all} in the score file names are translated into @samp{.*}, and
 then a regexp match is done.
 
+This means that if you have some score entries that you want to apply to
+all groups, then you put those entries in the @file{all.SCORE} file. 
+
 If @code{gnus-use-long-file-name} is non-@code{nil}, this won't work
-very will. It will find stuff like @file{gnu/all/SCORE}, but will not
+very will.  It will find stuff like @file{gnu/all/SCORE}, but will not
 find files like @file{not/gnu/all/SCORE}. 
 
 @item gnus-score-find-hierarchical
 @findex gnus-score-find-hierarchical
-Apply all score files from all the parent groups.
+Apply all score files from all the parent groups.  This means that you
+can't have score files like @file{all.SCORE} or @file{all.emacs.SCORE},
+but you can have @file{SCORE},  @file{comp.SCORE} and
+@file{comp.emacs.SCORE}. 
+
 @end table
 This variable can also be a list of functions.  In that case, all these
 functions will be called, and all the returned lists of score files will
@@ -7461,7 +7892,7 @@ it.
 @cindex local variables
 The value of this entry should be a list of @code{(VAR VALUE)} pairs.
 Each @var{var} will be made buffer-local to the current summary buffer,
-and set to the value specified. This is a convenient, if somewhat
+and set to the value specified.  This is a convenient, if somewhat
 strange, way of setting variables in some groups if you don't like hooks
 much.
 @end table
@@ -7558,10 +7989,10 @@ is @samp{ADAPT}.
 
 @vindex gnus-score-exact-adapt-limit
 When doing adaptive scoring, substring or fuzzy matching would probably
-give you the best results in most cases. However, if the header one
+give you the best results in most cases.  However, if the header one
 matches is short, the possibility for false positives is great, so if
 the length of the match is less than
-@code{gnus-score-exact-adapt-limit}, exact matching will be used. If
+@code{gnus-score-exact-adapt-limit}, exact matching will be used.  If
 this variable is @code{nil}, exact matching will always be used to avoid
 this problem.
 
@@ -8208,14 +8639,14 @@ mouse highlights will be done if @code{gnus-visual} is @code{nil}.
 @vindex gnus-display-type
 This variable is symbol indicating the display Emacs is running under.
 The symbol should be one of @code{color}, @code{grayscale} or
-@code{mono}. If Gnus guesses this display attribute wrongly, either set
+@code{mono}.  If Gnus guesses this display attribute wrongly, either set
 this variable in your @file{~/.emacs} or set the resource
 @code{Emacs.displayType} in your @file{~/.Xdefaults}.
 
 @item gnus-background-mode 
 @vindex gnus-background-mode 
-This is a symbol indicating the Emacs background brightness. The symbol
-should be one of @code{light} or @code{dark}. If Gnus guesses this
+This is a symbol indicating the Emacs background brightness.  The symbol
+should be one of @code{light} or @code{dark}.  If Gnus guesses this
 frame attribute wrongly, either set this variable in your @file{~/.emacs} or
 set the resource @code{Emacs.backgroundMode} in your @file{~/.Xdefaults}. 
 `gnus-display-type'.
@@ -8383,7 +8814,7 @@ If all else fails, report the problem as a bug.
 @findex gnus-bug
 If you find a bug in Gnus, you can report it with the @kbd{M-x gnus-bug}
 command. @kbd{M-x set-variable RET debug-on-error RET t RET}, and send
-me the backtrace. I will fix bugs, but I can only fix them if you send
+me the backtrace.  I will fix bugs, but I can only fix them if you send
 me a precise description as to how to reproduce the bug.
 
 You really can never be too detailed in a bug report.  Always use the
@@ -8434,19 +8865,19 @@ but at the common table.@*
 @chapter Appendices
 
 @menu
-* A Programmer's Guide to Gnus::   Rilly, rilly technical stuff.
+* A Programmer@'s Guide to Gnus::   Rilly, rilly technical stuff.
 * Emacs for Heathens::             A short intruduction to Emacsian terms.
 * Frequently Asked Questions::     A question-and-answer session.
 @end menu
 
 
-@node A Programmer's Guide to Gnus
-@section A Programmer's Guide to Gnus
+@node A Programmer@'s Guide to Gnus
+@section A Programmer@'s Guide to Gnus
 
 It is my hope that other people will figure out smart stuff that Gnus
 can do, and that other people will write those smart things as well.  To
 facilitate that I thought it would be a good idea to describe the inner
-workings of Gnus. And some of the not-so-inner workings, while I'm at
+workings of Gnus.  And some of the not-so-inner workings, while I'm at
 it.
 
 You can never expect the internals of a program not to change, but I
@@ -8461,6 +8892,7 @@ and general method of operations.
 * Headers::                  How Gnus stores headers internally.
 * Ranges::                   A handy format for storing mucho numbers.
 * Group Info::               The group info format.
+* Various File Formats::     Formats of files that Gnus use.
 @end menu
 
 
@@ -9113,7 +9545,7 @@ second is a more complex one:
 ("no.group" 5 (1 . 54324))
 
 ("nnml:my.mail" 3 ((1 . 5) 9 (20 . 55))
-                ((tick (15 . 19)) (replied 3 6 (19 . 23)))
+                ((tick (15 . 19)) (replied 3 6 (19 . 3)))
                 (nnml "")
                 (auto-expire (to-address "ding@@ifi.uio.no")))
 @end example
@@ -9143,6 +9575,65 @@ Actually that @samp{marks} rule is a fib.  A @samp{marks} is a
 in pseudo-BNF.
 
 
+@node Various File Formats
+@subsection Various File Formats
+
+@menu
+* Active File Format::      Information on articles and groups available.
+* Newsgroups File Format::  Group descriptions.
+@end menu
+
+
+@node Active File Format
+@subsubsection Active File Format
+
+The active file lists all groups that are available on the server in
+question.  It also lists the highest and lowest current article numbers
+in each group.  
+
+Here's an exceprt from a typical active file:
+
+@example
+soc.motss 296030 293865 y
+alt.binaries.pictures.fractals 3922 3913 n
+comp.sources.unix 1605 1593 m
+comp.binaries.ibm.pc 5097 5089 y
+no.general 1000 900 y
+@end example
+
+Here's a pseudo-BNF definition of this file:
+
+@example
+active      = *group-line
+group-line  = group space high-number space low-number space flag <NEWLINE>
+group       = <non-white-space string>
+space       = " "
+high-number = <non-negative integer>
+low-number  = <positive integer>
+flag        = "y" / "n" / "m" / "j" / "x" / "=" group
+@end example
+
+
+@node Newsgroups File Format
+@subsubsection Newsgroups File Format
+
+The newsgroups file lists groups along with their descriptions.  Not all
+groups on the server have to be listed,  and not all groups in the file
+have to exist on the server.  The file is meant purely as information to
+the user.
+
+The format is quite simple; a group name, a tab, and the description.
+Here's the definition:
+
+@example
+newsgroups    = *line
+line          = group tab description <NEWLINE>
+group         = <non-white-space string>
+tab           = <TAB>
+description   = <string>
+@end example
+
+
 @node Emacs for Heathens
 @section Emacs for Heathens