*** empty log message ***
[gnus] / lisp / gnus.el
index fb1a1f5..3c1275a 100644 (file)
@@ -1,4 +1,4 @@
-;;; (ding) Gnus --- a newsreader for GNU Emacs
+;;; gnus.el --- a newsreader for GNU Emacs
 ;; Copyright (C) 1987,88,89,90,93,94,95 Free Software Foundation, Inc.
 
 ;; Author: Masanobu UMEDA <umerin@flab.flab.fujitsu.junet>
@@ -26,7 +26,7 @@
 ;; Although (ding) Gnus looks suspiciously like GNUS, it isn't quite
 ;; the same beast. Most internal structures have been changed. If you
 ;; have written packages that depend on any of the hash tables,
-;; `gnus-newsrc-assoc', `gnus-killed-assoc', marked lists, the .newsrc
+;; `gnus-newsrc-alist', `gnus-killed-assoc', marked lists, the .newsrc
 ;; buffer, or internal knowledge of the `nntp-header-' macros, or
 ;; dependence on the buffers having a certain format, your code will
 ;; fail.
 
 (require 'mail-utils)
 (require 'timezone)
-(require 'rnews)
-(require 'rmail)
-
 (require 'nnheader)
+(require 'gnus-ems)
+
+;; Site dependent variables. These variables should be defined in
+;; paths.el.
+
+(defvar gnus-default-nntp-server nil
+  "Specify a default NNTP server.
+This variable should be defined in paths.el, and should never be set
+by the user.
+If you want to change servers, you should use `gnus-select-method'.
+See the documentation to that variable.")
+
+(defconst gnus-backup-default-subscribed-newsgroups 
+  '("news.announce.newusers" "news.groups.questions" "gnu.emacs.gnus")
+  "Default default new newsgroups the first time Gnus is run.
+Should be set in paths.el, and shouldn't be touched by the user.")
+
+(defvar gnus-local-domain nil
+  "Local domain name without a host name.
+The DOMAINNAME environment variable is used instead if it is defined.
+If the `system-name' function returns the full Internet name, there is
+no need to set this variable.")
+
+(defvar gnus-local-organization nil
+  "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
+return a string.
+In any case, if the string (either in the variable, in the environment
+variable, or returned by the function) is a file name, the contents of
+this file will be used as the organization.")
+
+(defvar gnus-use-generic-from nil
+  "If nil, the full host name will be the system name prepended to the domain name.
+If this is a string, the full host name will be this string.
+If this is non-nil, non-string, the domain name will be used as the
+full host name.")
+
+(defvar gnus-use-generic-path nil
+  "If nil, use the NNTP server name in the Path header.
+If stringp, use this; if non-nil, use no host name (user name only).")
+
 
 ;; Customization variables
 
                  (if (and gnus-default-nntp-server
                           (not (string= gnus-default-nntp-server "")))
                      gnus-default-nntp-server)
-                 (system-name))
-       "nntp")
+                 (system-name)))
   "*Default method for selecting a newsgroup.
 This variable should be a list, where the first element is how the
-news is to be fetched, the second is the address.  An optional third
-element can be included to specify a port number if nntp is used.
+news is to be fetched, the second is the address. 
 
 For instance, if you want to get your news via NNTP from
-\"flab.flab.edu\" on port 23, you could say:
+\"flab.flab.edu\", you could say:
 
-(setq gnus-select-method '(nntp \"flab.flab.edu\" 23))
+(setq gnus-select-method '(nntp \"flab.flab.edu\"))
 
 If you want to use your local spool, say:
 
 (setq gnus-select-method (list 'nnspool (system-name)))
 
-If you use this variable, you must set `gnus-nntp-server' to nil.")
+If you use this variable, you must set `gnus-nntp-server' to nil.
+
+There is a lot more to know about select methods and virtual servers -
+see the manual for details.")
 
 ;; Added by Sudish Joseph <joseph@cis.ohio-state.edu>.
 (defvar gnus-post-method nil
@@ -111,26 +152,12 @@ 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:
 
- (setq gnus-select-method '(nntp \"my.nntp.server\" 899))")
+ (setq gnus-select-method '(nntp \"my.nntp.server\" (nntp-port-number 899)))")
 
 (defvar gnus-startup-file "~/.newsrc"
   "*Your `.newsrc' file.
 `.newsrc-SERVER' will be used instead if that exists.")
 
-(defvar gnus-signature-file "~/.signature"
-  "*Your signature file.
-If the variable is a string that doesn't correspond to a file, the
-string itself is inserted.")
-
-(defvar gnus-signature-function nil
-  "*A function that should return a signature file name.
-The function will be called with the name of the newsgroup being
-posted to.
-If the function returns a string that doesn't correspond to a file, the
-string itself is inserted.
-If the function returns nil, the `gnus-signature-file' variable will
-be used instead.")
-
 (defvar gnus-init-file "~/.gnus"
   "*Your Gnus elisp startup file.
 If a file with the .el or .elc suffixes exist, it will be read
@@ -152,13 +179,6 @@ It should be a list of strings.
 If it is `t', Gnus will not do anything special the first time it is
 started; it'll just use the normal newsgroups subscription methods.")
 
-(defvar gnus-post-prepare-function nil
-  "*Function that is run after a post buffer has been prepared.
-It is called with the name of the newsgroup that is posted to. It
-might be used, for instance, for inserting signatures based on the
-newsgroup name. (In that case, `gnus-signature-file' and
-`mail-signature' should both be set to nil).")
-
 (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
@@ -170,41 +190,17 @@ newsgroups.")
 If Emacs should crash without saving the .newsrc files, complete
 information can be restored from the dribble file.")
 
-(defvar gnus-use-followup-to 'use
-  "*Specifies what to do with Followup-To header.
-If nil, ignore the header. If it is t, use its value, but ignore 
-`poster'. If it is neither nil nor t, which is the default, always use
-the value.") 
-
-(defvar gnus-followup-to-function nil
-  "*A variable that contains a function that returns a followup address.
-The function will be called in the buffer of the article that is being
-followed up. The buffer will be narrowed to the headers of the
-article. To pick header headers, one might use `mail-fetch-field'.  The
-function will be called with the name of the current newsgroup as the
-argument.
-
-Here's an example `gnus-followup-to-function':
-
-(setq gnus-followup-to-function
-      (lambda (group)
-       (cond ((string= group \"mail.list\")
-              (or (mail-fetch-field \"sender\") 
-                  (mail-fetch-field \"from\")))
-             (t
-              (or (mail-fetch-field \"reply-to\") 
-                  (mail-fetch-field \"from\"))))))")
+(defvar gnus-asynchronous nil
+  "*If non-nil, Gnus will supply backends with data needed for async article fetching.")
+
+(defvar gnus-asynchronous-article-function nil
+  "*Function for picking articles to pre-fetch, possibly.")
 
-(defvar gnus-reply-to-function nil
-  "*A variable that contains a function that returns a reply address.
-See the `gnus-followup-to-function' variable for an explanation of how
-this variable is used.
+(defvar gnus-score-file-suffix "SCORE"
+  "*Suffix of the score files.")
 
-This function should return a string that will be used to fill in the
-header.  This function may also return a list.  In that case, every
-list element should be a cons where the first car should be a string
-with the header name, and the cdr should be a string with the header
-value.")
+(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.
@@ -215,31 +211,6 @@ confirmation is required for selecting the newsgroup.")
 (defvar gnus-no-groups-message "No news is horrible news"
   "*Message displayed by Gnus when no groups are available.")
 
-(defvar gnus-author-copy (getenv "AUTHORCOPY")
-  "*Save outgoing articles in this file.
-Initialized from the AUTHORCOPY environment variable.
-
-If this variable begins with the character \"|\", outgoing articles
-will be piped to the named program. It is possible to save an article
-in an MH folder as follows:
-
-\(setq gnus-author-copy \"|/usr/local/lib/mh/rcvstore +Article\")
-
-If the first character is not a pipe, articles are saved using the
-function specified by the `gnus-author-copy-saver' variable.")
-
-(defvar gnus-mail-self-blind nil
-  "*Non-nil means insert a BCC header in all outgoing articles.
-This will result in having a copy of the article mailed to yourself.
-The BCC header is inserted when the post buffer is initialized, so you
-can remove or alter the BCC header to override the default.")
-
-(defvar gnus-author-copy-saver (function rmail-output)
-  "*A function called to save outgoing articles.
-This function will be called with the same of the file to store the
-article in. The default function is `rmail-output' which saves in Unix
-mailbox format.")
-
 (defvar gnus-use-long-file-name (not (memq system-type '(usg-unix-v xenix)))
   "*Non-nil means that the default name of a file to save articles in is the group name.
 If it's nil, the directory form of the group name is used instead.
@@ -258,10 +229,7 @@ Initialized from the SAVEDIR environment variable.")
   "*Name of the directory where kill files will be stored (default \"~/News\").
 Initialized from the SAVEDIR environment variable.")
 
-(defvar gnus-score-expiry-days 7
-  "*Number of days before unused score file entries are expired.")
-
-(defvar gnus-default-article-saver (function gnus-summary-save-in-rmail)
+(defvar gnus-default-article-saver 'gnus-summary-save-in-rmail
   "*A function to save articles in your favorite format.
 The function must be interactively callable (in other words, it must
 be an Emacs command).
@@ -271,7 +239,8 @@ Gnus provides the following functions:
 * gnus-summary-save-in-rmail (Rmail format)
 * gnus-summary-save-in-mail (Unix mail format)
 * gnus-summary-save-in-folder (MH folder)
-* gnus-summary-save-in-file (article format).")
+* gnus-summary-save-in-file (article format).
+* gnus-summary-save-in-vm (use VM's folder format).")
 
 (defvar gnus-rmail-save-name (function gnus-plain-save-name)
   "*A function generating a file name to save articles in Rmail format.
@@ -298,11 +267,20 @@ For instance, if you would like to save articles related to Gnus in
 the file \"gnus-stuff\", and articles related to VM in \"vm-stuff\",
 you could set this variable to something like:
 
- '(("^Subject:.*gnus\\|^Newsgroups:.*gnus" "gnus-stuff")
-   ("^Subject:.*vm\\|^Xref:.*vm" "vm-stuff"))")
+ '((\"^Subject:.*gnus\\|^Newsgroups:.*gnus\" \"gnus-stuff\")
+   (\"^Subject:.*vm\\|^Xref:.*vm\" \"vm-stuff\"))")
 
-(defvar gnus-score-file-suffix "SCORE"
-  "*Suffix of the score files.")
+(defvar gnus-save-score nil
+  "*If non-nil, save group scoring info.")
+
+(defvar gnus-use-adaptive-scoring nil
+  "*If non-nil, use some adaptive scoring scheme.")
+
+(defvar gnus-use-cache nil
+  "*If non-nil, Gnus will cache (some) articles locally.")
+
+(defvar gnus-use-scoring t
+  "*If non-nil, enable scoring.")
 
 (defvar gnus-fetch-old-headers nil
   "*Non-nil means that Gnus will try to build threads by grabbing old headers.
@@ -330,6 +308,13 @@ required.")
   "*Non-nil means that you will never be asked for confirmation about anything.
 And that means *anything*.")
 
+(defvar gnus-verbose 7
+  "*Integer that says how verbose Gnus should be.
+The higher the number, the more messages Gnus will flash to say what
+it's doing.  At zero, Gnus will be totally mute; at five, Gnus will
+display most important messages; and at ten, Gnus will keep on
+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
@@ -386,6 +371,9 @@ This variable will only be used if the value of
 (defvar gnus-summary-goto-unread nil
   "*If non-nil, marking commands will go to the next unread article.")
 
+(defvar gnus-group-goto-unread t
+  "*If non-nil, movement commands will go to the next unread and subscribed group.")
+
 (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
@@ -414,17 +402,43 @@ check for bogus newsgroups with \\<gnus-group-mode-map>\\[gnus-group-check-bogus
 If this variable is nil, Gnus will only know about the groups in your
 `.newsrc' file.
 
-If you set this variable to nil, you probably still want to be told
-about new newsgroups that arrive.  To do that, set
+If this variable is `some', Gnus will try to only read the relevant
+parts of the active file from the server.  Not all servers support
+this, and it might be quite slow with other servers, but this should
+generally be faster than both the t and nil value.
+
+If you set this variable to nil or `some', you probably still want to
+be told about new newsgroups that arrive.  To do that, set
 `gnus-check-new-newsgroups' to `ask-server'.  This may not work
-properly with all servers.") 
+properly with all servers.")
+
+(defvar gnus-level-subscribed 5
+  "*Groups with levels less than or equal to this variable are subscribed.")
+
+(defvar gnus-level-unsubscribed 7
+  "*Groups with levels less than or equal to this variable are unsubscribed.
+Groups with levels less than `gnus-level-subscribed', which should be
+less than this variable, are subscribed.")
+
+(defvar gnus-level-zombie 8
+  "*Groups with this level are zombie groups.")
+
+(defvar gnus-level-killed 9
+  "*Groups with this level are killed.")
+
+(defvar gnus-level-default-subscribed 3
+  "*New subscribed groups will be subscribed at this level.")
+
+(defvar gnus-level-default-unsubscribed 6
+  "*New unsubscribed groups will be unsubscribed at this level.")
 
 (defvar gnus-activate-foreign-newsgroups nil
   "*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
 newsgroups that have a level lower or equal to this number will be
 activated on startup. For instance, if you want to active all
-subscribed newsgroups, but not the rest, you'd set this variable to 5.
+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,
@@ -470,55 +484,16 @@ which is the default, quite fast, and too simplistic solution, and
 `mail-extract-address-components', which works much better, but is
 slower.")
 
-(defvar gnus-score-interactive-default-score 1000
-  "*Scoring commands will raise/lower the score with this number as the default.")
-
-(defvar gnus-save-score nil
-  "*If non-nil, save group scoring info.")
-
-(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-summary-default-score 0
   "*Default article score level.
 If this variable is nil, scoring will be disabled.")
 
-(defvar gnus-group-default-list-level 5
+(defvar gnus-group-default-list-level gnus-level-subscribed
   "*Default listing level.")
 
-(defvar gnus-user-login-name nil
-  "*The login name of the user.
-Got from the function `user-login-name' if undefined.")
-
-(defvar gnus-user-full-name nil
-  "*The full name of the user.
-Got from the NAME environment variable if undefined.")
-
-(defvar gnus-user-from-line nil
-  "*Your full, complete e-mail address.  
-Overrides the other Gnus variables if it is non-nil.
-
-Here are two example values of this variable:
-
- \"Lars Magne Ingebrigtsen <larsi@ifi.uio.no>\"
-
-and
-
- \"larsi@ifi.uio.no (Lars Magne Ingebrigtsen)\"
-
-The first version is recommended, but the name has to be quoted if it
-contains non-alphanumerical characters.")
+(defvar gnus-group-always-list-unread gnus-level-subscribed
+  "*Always list groups less than this variable with unread articles. 
+If nil, use parameter to specify.")
 
 (defvar gnus-show-mime nil
   "*If non-ni, do mime processing of articles.
@@ -549,17 +524,7 @@ from their parents will start separate threads.")
 (defvar gnus-thread-indent-level 4
   "*Number that says how much each sub-thread should be indented.")
 
-;; jwz: nuke newsgroups whose name is all digits - that means that
-;; some loser has let articles get into the root of the news spool,
-;; which is toxic. Lines beginning with whitespace also tend to be
-;; toxic.
-(defvar gnus-ignored-newsgroups
-  (purecopy (mapconcat 'identity
-                      '("^to\\."       ; not "real" groups
-                        "^[0-9. \t]+ " ; all digits in name
-                        "[][\"#'()     ;\\]"   ; bogus characters
-                        )
-                      "\\|"))
+(defvar gnus-ignored-newsgroups ""
   "*A regexp to match uninteresting newsgroups in the active file.
 Any lines in the active file matching this regular expression are
 removed from the newsgroup list before anything else is done to it,
@@ -582,13 +547,6 @@ If it is non-nil, headers that match the regular expressions will
 be placed first in the article buffer in the sequence specified by
 this list.")
 
-(defvar gnus-required-headers
-  '(From Date Newsgroups Subject Message-ID Organization Lines X-Newsreader)
-  "*Headers to be generated or prompted for when posting an article.
-RFC977 and RFC1036 require From, Date, Newsgroups, Subject,
-Message-ID.  Organization, Lines and X-Newsreader are optional.  If
-you want Gnus not to insert some header, remove it from this list.")
-
 (defvar gnus-show-all-headers nil
   "*If non-nil, don't hide any headers.")
 
@@ -618,24 +576,14 @@ newsgroup will be selected without any confirmations.")
 (defvar gnus-auto-select-same nil
   "*If non-nil, select the next article with the same subject.")
 
+(defvar gnus-summary-check-current nil
+  "*If non-nil, consider the current article when moving.
+The \"unread\" movement commands will stay on the same line if the
+current article is unread.")
+
 (defvar gnus-auto-center-summary t
   "*If non-nil, always center the current summary buffer.")
 
-(defvar gnus-auto-mail-to-author nil
-  "*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.")
-
-;; Added by Ethan Bradford <ethanb@ptolemy.astro.washington.edu>.
-(defvar gnus-mail-courtesy-message
-  "*The following message is a courtesy copy of an article\nthat has been posted as well.\n\n"
-  "This is inserted at the start of a mailed copy of a posted message.
-If this variable is nil, no such courtesy message will be added.")
-
 (defvar gnus-break-pages t
   "*If non-nil, do page breaking on articles.
 The page delimiter is specified by the `gnus-page-delimiter'
@@ -649,36 +597,74 @@ beginning of a line.")
 (defvar gnus-use-full-window t
   "*If non-nil, use the entire Emacs screen.")
 
-(defvar gnus-window-configuration
-  '((summary (0 1 0))
-    (newsgroups (1 0 0))
-    (article (0 3 10)))
-  "*Specify window configurations for each action.
-The format of the variable is either a list of (ACTION (G S A)), where
-G, S, and A are the relative height of group, summary, and article
-windows, respectively, or a list of (ACTION FUNCTION), where FUNCTION
-is a function that will be called with ACTION as an argument. ACTION
-can be `summary', `newsgroups', or `article'.")
-
-(defvar gnus-mail-reply-method (function gnus-mail-reply-using-mail)
-  "*Function to compose a reply.
-Two pre-made functions are `gnus-mail-reply-using-mail' (sendmail) and
-`gnus-mail-reply-using-mhe' (MH-E).")
-
-(defvar gnus-mail-forward-method (function gnus-mail-forward-using-mail)
-  "*Function to forward the current message to another user.
-Two pre-made functions are `gnus-mail-forward-using-mail' (sendmail)
-and `gnus-mail-forward-using-mhe' (MH-E).") 
-
-(defvar gnus-mail-other-window-method 'gnus-mail-other-window-using-mail
-  "*Function to compose mail in the other window.
-Two pre-made functions are `gnus-mail-other-window-using-mail'
-(sendmail) and `gnus-mail-other-window-using-mhe' (MH-E).")
-
-(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-window-configuration nil
+  "Obsolete variable.  See `gnus-buffer-configuration'.")
+
+(defvar gnus-buffer-configuration
+  '((group ([group 1.0 point] 
+           (if gnus-carpal [group-carpal 4])))
+    (summary ([summary 1.0 point]
+             (if gnus-carpal [summary-carpal 4])))
+    (article ([summary 0.25 point] 
+             (if gnus-carpal [summary-carpal 4]) 
+             [article 1.0]))
+    (server ([server 1.0 point]
+            (if gnus-carpal [server-carpal 2])))
+    (browse ([browse 1.0 point]
+            (if gnus-carpal [browse-carpal 2])))
+    (group-mail ([mail 1.0 point]))
+    (summary-mail ([mail 1.0 point]))
+    (summary-reply ([article 0.5]
+                   [mail 1.0 point]))
+    (info ([nil 1.0 point]))
+    (summary-faq ([summary 0.25]
+                 [article 1.0 point]))
+    (edit-group ([group 0.5]
+                [edit-group 1.0 point]))
+    (edit-server ([server 0.5]
+                 [edit-server 1.0 point]))
+    (post ([post 1.0 point]))
+    (reply ([article 0.5]
+           [mail 1.0 point]))
+    (mail-forward ([mail 1.0 point]))
+    (post-forward ([post 1.0 point]))
+    (reply-yank ([mail 1.0 point]))
+    (followup ([article 0.5]
+              [post 1.0 point]))
+    (followup-yank ([post 1.0 point])))
+  "Window configuration for all possible Gnus buffers.
+This variable is a list of lists.  Each of these lists has a NAME and
+a RULE.  The NAMEs are commonsense names like `group', which names a
+rule used when displaying the group buffer; `summary', which names a
+rule for what happens when you enter a group and do not display an
+article buffer; and so on.  See the value of this variable for a
+complete list of NAMEs.
+
+Each RULE is a list of vectors.  The first element in this vector is
+the name of the buffer to be displayed; the second element is the
+percentage of the screen this buffer is to occupy (a number in the
+0.0-0.99 range); the optional third element is `point', which should
+be present to denote which buffer point is to go to after making this
+buffer configuration.")
+
+(defvar gnus-window-to-buffer
+  '((group . gnus-group-buffer)
+    (summary . gnus-summary-buffer)
+    (article . gnus-article-buffer)
+    (server . gnus-server-buffer)
+    (browse . "*Gnus Browse Server*")
+    (edit-group . gnus-group-edit-buffer)
+    (edit-server . gnus-server-edit-buffer)
+    (group-carpal . gnus-carpal-group-buffer)
+    (summary-carpal . gnus-carpal-summary-buffer)
+    (server-carpal . gnus-carpal-server-buffer)
+    (browse-carpal . gnus-carpal-browse-buffer)
+    (mail . "*mail*")
+    (post . gnus-post-news-buffer))
+  "Mapping from short symbols to buffer names or buffer variables.")
+
+(defvar gnus-carpal nil
+  "*If non-nil, display clickable icons.")
 
 (defvar gnus-subscribe-newsgroup-method 'gnus-subscribe-zombies
   "*Function called with a group name when new group is detected.
@@ -728,8 +714,8 @@ for the groups to be sorted.  Pre-made functions include
   "*Mark used for ticked articles.")
 (defvar gnus-dormant-mark ??
   "*Mark used for dormant articles.")
-(defvar gnus-dread-mark ?D
-  "*Mark used for read articles.")
+(defvar gnus-del-mark ?D
+  "*Mark used for del'd articles.")
 (defvar gnus-read-mark ?d
   "*Mark used for read articles.")
 (defvar gnus-expirable-mark ?E
@@ -754,6 +740,10 @@ for the groups to be sorted.  Pre-made functions include
   "*Score mark used for articles with high scores.")
 (defvar gnus-score-below-mark ?-
   "*Score mark used for articles with low scores.")
+(defvar gnus-empty-thread-mark ? 
+  "*There is no thread under the article.")
+(defvar gnus-not-empty-thread-mark ?=
+  "*There is a thread under the article.")
 
 (defvar gnus-view-pseudo-asynchronously nil
   "*If non-nil, Gnus will view pseudo-articles asynchronously.")
@@ -763,6 +753,11 @@ for the groups to be sorted.  Pre-made functions include
 If `not-confirm', pseudos will be viewed automatically, and the user
 will not be asked to confirm the command.")
 
+(defvar gnus-view-pseudos-separately t
+  "*If non-nil, one pseudo-article will be created for each file to be viewed.
+If nil, all files that use the same viewing command will be given as a
+list of parameters to that command.")
+
 (defvar gnus-group-line-format "%M%S%5y: %(%g%)\n"
   "*Format of group lines.
 It works along the same lines as a normal formatting string,
@@ -770,7 +765,7 @@ with some simple extensions.
 
 %M    Only marked articles (character, \"*\" or \" \")
 %S    Whether the group is subscribed (character, \"U\", \"K\", \"Z\" or \" \")
-%L    Level of subscribedness (integer, 1-9)
+%L    Level of subscribedness (integer)
 %N    Number of unread articles (integer)
 %I    Number of dormant articles (integer)
 %i    Number of ticked and dormant (integer)
@@ -819,20 +814,27 @@ with some simple extensions.
 %s   Subject if it is at the root of a thread, and \"\" otherwise (string)
 %n   Name of the poster (string)
 %A   Address of the poster (string)
-%L   Number of lines in the article (integer)
-%c   Number of characters in the article (integer)
+%F   Contents of the From: header (string)
+%x   Contents of the Xref: header (string)
 %D   Date of the article (string)
+%d   Date of the article (string) in DD-MMM format
+%M   Message-id of the article (string)
+%r   References of the article (string)
+%c   Number of characters in the article (integer)
+%L   Number of lines in the article (integer)
 %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
-%U   Status of this article (character, \"D\", \"K\", \"-\" or \" \") 
+%R   \"R\" if this article has been replied to, \" \" otherwise (character)
+%U   Status of this article (character, \"D\", \"K\", \"-\" or \" \")
 %[   Opening bracket (character, \"[\" or \"<\")
 %]   Closing bracket (character, \"]\" or \">\")
 %>   Spaces of length thread-level (string)
 %<   Spaces of length (- 20 thread-level) (string)
 %i   Article score (number)
 %z   Article zcore (character)
-%t   Number of articles under the current thread.
+%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
      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
@@ -856,7 +858,7 @@ possible.
 
 This restriction may disappear in later versions of Gnus.")
 
-(defvar gnus-summary-dummy-line-format "*   :                          : %S\n"
+(defvar gnus-summary-dummy-line-format "*  :                          : %S\n"
   "*The format specification for the dummy roots in the summary buffer.
 It works along the same lines as a normal formatting string,
 with some simple extensions.
@@ -875,7 +877,7 @@ with some simple extensions.
 (defvar gnus-valid-select-methods
   '(("nntp" post address prompt-address)
     ("nnspool" post)
-    ("nnvirtual" none virtual prompt-address address
+    ("nnvirtual" none virtual prompt-address) 
     ("nnmbox" mail respool) 
     ("nnml" mail respool)
     ("nnmh" mail respool) 
@@ -902,7 +904,9 @@ If this variable is nil, screen refresh may be quicker.")
 
 ;; Added by Keinonen Kari <kk85613@cs.tut.fi>.
 (defvar gnus-mode-non-string-length 21
-  "*Max length of mode-line non-string contents buffer contents.")
+  "*Max length of mode-line non-string contents.
+If this is nil, Gnus will take space as is needed, leaving the rest
+of the modeline intact.")
 
 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
 (defvar gnus-mouse-face 'highlight
@@ -914,9 +918,6 @@ No mouse highlights will be done if `gnus-visual' is nil.")
 This variable is local to each summary buffer and usually set by the
 score file.")  
 
-(defvar gnus-orphan-score nil
-  "*All orphans get this score added. Set in the score file.")
-
 (defvar gnus-thread-sort-functions '(gnus-thread-sort-by-number)
   "*List of functions used for sorting threads in the summary buffer.
 By default, threads are sorted by article number.
@@ -928,10 +929,7 @@ the primary sort function should be the last.
 Ready-mady functions include `gnus-thread-sort-by-number',
 `gnus-thread-sort-by-author', `gnus-thread-sort-by-subject',
 `gnus-thread-sort-by-date', `gnus-thread-sort-by-score' and
-`gnus-thread-sort-by-total-score' (see `gnus-thread-score-function').
-
-The latter two only work on threads that have been scored prior to
-entering the newsgroup.")
+`gnus-thread-sort-by-total-score' (see `gnus-thread-score-function').")
 
 (defvar gnus-thread-score-function '+
   "*Function used for calculating the total score of a thread.
@@ -941,24 +939,6 @@ subthread and should then return the score of the thread.
 
 Some functions you can use are `+', `max', or `min'.")
 
-(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-options-subscribe nil
   "*All new groups matching this regexp will be subscribed unconditionally.
 Note that this variable deals only with new newsgroups.  This variable
@@ -974,6 +954,8 @@ does not affect old (already subscribed) newsgroups.")
 If non-nil, this should be a regexp that should match all groups in
 which to perform auto-expiry.  This only makes sense for mail groups.")
 
+(defvar gnus-hidden-properties '(invisible t intangible t)
+  "Property list to use for hiding text.")
 
 ;; Hooks.
 
@@ -1023,16 +1005,21 @@ If you want to run a special decoding program like nkf, use this hook.")
 The hook is designed to change the contents of the article
 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
 `gnus-article-treat-overstrike' (turn \"^H_\" into bold characters).")
 (add-hook 'gnus-article-display-hook 'gnus-article-hide-headers-if-wanted)
 (add-hook 'gnus-article-display-hook 'gnus-article-treat-overstrike)
 
-(defconst gnus-article-x-face-command "uncompface | ikon2xbm | xv -"
+(defvar gnus-article-x-face-command
+  "{ 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.") 
 
+(defvar gnus-article-x-face-too-ugly nil
+  "Regexp matching posters whose face shouldn't be shown automatically.")
+
 (defvar gnus-select-group-hook nil
   "*A hook called when a newsgroup is selected.
 
@@ -1075,7 +1062,7 @@ following hook:
                 (gnus-expunge \"X\"))))))")
 
 (defvar gnus-visual-mark-article-hook 
-  (list 'gnus-visual-highlight-selected-summary)
+  (list 'gnus-highlight-selected-summary)
   "*Hook run after selecting an article in the summary buffer.
 It is meant to be used for highlighting the article in some way.  It
 is not run if `gnus-visual' is nil.")
@@ -1085,16 +1072,6 @@ is not run if `gnus-visual' is nil.")
 The default hook (`gnus-inews-insert-signature') inserts a signature
 file specified by the variable `gnus-signature-file'.")
 
-(defvar gnus-inews-article-hook (list 'gnus-inews-do-fcc)
-  "*A hook called before finally posting an article.
-The default hook (`gnus-inews-do-fcc') does FCC processing (ie. saves
-the article to a file).")
-
-(defvar gnus-inews-article-header-hook nil
-  "*A hook called after inserting the headers in an article to be posted.
-The hook is called from the *post-news* buffer, narrowed to the
-headers.")
-
 (defvar gnus-exit-group-hook nil
   "*A hook called when exiting (not quitting) summary mode.")
 
@@ -1107,13 +1084,13 @@ headers.")
 (defvar gnus-save-newsrc-hook nil
   "*A hook called when saving the newsrc file.")
 
-(defvar gnus-visual-summary-update-hook 
-  (list 'gnus-visual-summary-highlight-line)
+(defvar gnus-summary-update-hook 
+  (list 'gnus-summary-highlight-line)
   "*A hook called when a summary line is changed.
 The hook will not be called if `gnus-visual' is nil.
 
-The default function `gnus-visual-summary-highlight-line' will
-highlight the line according to the `gnus-visual-summary-highlight'
+The default function `gnus-summary-highlight-line' will
+highlight the line according to the `gnus-summary-highlight'
 variable.")
 
 (defvar gnus-mark-article-hook (list 'gnus-summary-mark-unread-as-read)
@@ -1121,47 +1098,6 @@ variable.")
 The hook is intended to mark an article as read (or unread)
 automatically when it is selected.")
 
-;; Site dependent variables. These variables should be defined in
-;; paths.el.
-
-(defvar gnus-default-nntp-server nil
-  "*Specify a default NNTP server.
-This variable should be defined in paths.el, and should never be set
-by the user.
-If you want to change servers, you should use `gnus-select-method'.
-See the documentation to that variable.")
-
-(defconst gnus-backup-default-subscribed-newsgroups 
-  '("news.announce.newusers" "news.groups.questions" "gnu.emacs.gnus")
-  "Default default new newsgroups the first time Gnus is run.
-Should be set in paths.el, and shouldn't be touched by the user.")
-
-(defvar gnus-local-domain nil
-  "*Local domain name without a host name.
-The DOMAINNAME environment variable is used instead if it is defined.
-If the `system-name' function returns the full Internet name, there is
-no need to set this variable.")
-
-(defvar gnus-local-organization nil
-  "*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
-return a string.
-In any case, if the string (either in the variable, in the environment
-variable, or returned by the function) is a file name, the contents of
-this file will be used as the organization.")
-
-(defvar gnus-use-generic-from nil
-  "*If nil, the full host name will be the system name prepended to the domain name.
-If this is a string, the full host name will be this string.
-If this is non-nil, non-string, the domain name will be used as the
-full host name.")
-
-(defvar gnus-use-generic-path nil
-  "*If nil, use the NNTP server name in the Path header.
-If stringp, use this; if non-nil, use no host name (user name only).")
-
 \f
 ;; Internal variables
 
@@ -1176,39 +1112,15 @@ If stringp, use this; if non-nil, use no host name (user name only).")
 (defvar gnus-article-reply nil)
 (defvar gnus-override-method nil)
 (defvar gnus-article-check-size nil)
-(defvar gnus-score-file-list nil)
-(defvar gnus-internal-global-score-files nil)
-(defvar gnus-current-score-file nil)
 
 (defvar gnus-current-move-group nil)
 
-(defvar gnus-score-alist nil
-  "Alist containing score information.
-The keys can be symbols or strings.  The following symbols are defined. 
-
-touched: If this alist has been modified.
-mark:    Automatically mark articles below this.
-expunge: Automatically expunge articles below this.
-files:   List of other SCORE files to load when loading this one.
-eval:    Sexp to be evaluated when the score file is loaded.
-
-String entries have the form (HEADER (MATCH TYPE SCORE DATE) ...) 
-where HEADER is the header being scored, MATCH is the string we are
-looking for, TYPE is a flag indicating whether it should use regexp or
-substring matching, SCORE is the score to add and DATE is the date
-of the last succesful match.")
-
-(defvar gnus-score-cache nil)
-(defvar gnus-scores-articles nil)
-(defvar gnus-scores-exclude-files nil)
-(defvar gnus-header-index nil)
-(defvar gnus-score-index nil)
-
 (defvar gnus-newsgroup-dependencies nil)
+(defvar gnus-newsgroup-threads nil)
+(defvar gnus-newsgroup-async nil)
 (defconst gnus-group-edit-buffer "*Gnus edit newsgroup*")
-(defvar gnus-default-subscribe-level 2)
-(defvar gnus-default-unsubscribe-level 6)
-(defvar gnus-default-kill-level 9)
+
+(defvar gnus-newsgroup-adaptive nil)
 
 (defconst gnus-group-line-format-alist
   (list (list ?M 'marked ?c)
@@ -1232,7 +1144,7 @@ of the last succesful match.")
        (list ?u 'user-defined ?s)))
 
 (defconst gnus-summary-line-format-alist 
-  (list (list ?N 'number ?s)
+  (list (list ?N 'number ?d)
        (list ?S 'subject ?s)
        (list ?s 'subject-or-nil ?s)
        (list ?n 'name ?s)
@@ -1240,21 +1152,31 @@ of the last succesful match.")
        (list ?F 'from ?s)
        (list ?x (macroexpand '(header-xref header)) ?s)
        (list ?D (macroexpand '(header-date header)) ?s)
+       (list ?d '(gnus-dd-mmm (header-date header)) ?s)
        (list ?M (macroexpand '(header-id header)) ?s)
        (list ?r (macroexpand '(header-references header)) ?s)
-       (list ?c (macroexpand '(header-chars header)) ?d)
+       (list ?c '(or (header-chars header) 0) ?d)
        (list ?L 'lines ?d)
        (list ?I 'indentation ?s)
-       (list ?T '(if (< level 1) "" (make-string (frame-width) ? )) ?s)
+       (list ?T '(if (= level 0) "" (make-string (frame-width) ? )) ?s)
        (list ?R 'replied ?c)
        (list ?\[ 'opening-bracket ?c)
        (list ?\] 'closing-bracket ?c)
        (list ?\> '(make-string level ? ) ?s)
        (list ?\< '(make-string (max 0 (- 20 level)) ? ) ?s)
-       (list ?i 'score ?s)
+       (list ?i 'score ?d)
        (list ?z 'score-char ?c)
        (list ?U 'unread ?c)
-       (list ?t '(gnus-summary-number-of-articles-in-thread thread) ?d)
+       (list ?t '(gnus-summary-number-of-articles-in-thread 
+                  (or gnus-tmp-adopt-thread 
+                      (if (boundp 'thread) (symbol-value 'thread)
+                        thread nil)))
+                  ?d)
+       (list ?e '(gnus-summary-number-of-articles-in-thread 
+                  (or gnus-tmp-adopt-thread 
+                      (if (boundp 'thread) (symbol-value 'thread)
+                        thread nil)) t)
+                  ?d)
        (list ?u 'user-defined ?s))
   "An alist of format specifications that can appear in summary lines,
 and what variables they correspond with, along with the type of the
@@ -1267,7 +1189,7 @@ variable (string, integer, character, etc).")
 
 (defconst gnus-summary-mode-line-format-alist 
   (list (list ?G 'group-name ?s)
-       (list ?g '(gnus-short-group-name group-name))
+       (list ?g '(gnus-short-group-name group-name) ?s)
        (list ?A 'article-number ?d)
        (list ?Z 'unread-and-unselected ?s)
        (list ?V 'gnus-version ?s)
@@ -1275,7 +1197,7 @@ variable (string, integer, character, etc).")
        (list ?S 'subject ?s)
        (list ?e 'unselected ?d)
        (list ?u 'user-defined ?s)
-       (list ?s 'gnus-current-score-file ?s)))
+       (list ?s '(gnus-current-score-file-nondirectory) ?s)))
 
 (defconst gnus-group-mode-line-format-alist 
   (list (list ?S 'news-server ?s)
@@ -1284,10 +1206,10 @@ variable (string, integer, character, etc).")
 
 (defvar gnus-have-read-active-file nil)
 
-(defconst gnus-maintainer "Lars Magne Ingebrigtsen <larsi@ifi.uio.no>"
+(defconst gnus-maintainer "gnus-bug@ifi.uio.no (The Gnus Bugfixing Girls & Boys)"
   "The mail address of the Gnus maintainer.")
 
-(defconst gnus-version "(ding) Gnus v0.51"
+(defconst gnus-version "(ding) Gnus v0.71"
   "Version number for this version of Gnus.")
 
 (defvar gnus-info-nodes
@@ -1304,6 +1226,8 @@ variable (string, integer, character, etc).")
 (defvar gnus-article-buffer "*Article*")
 (defvar gnus-server-buffer "*Server*")
 
+(defvar gnus-work-buffer " *gnus work*")
+
 (defvar gnus-buffer-list nil
   "Gnus buffers that should be killed on exit.")
 
@@ -1313,7 +1237,7 @@ variable (string, integer, character, etc).")
 (defvar gnus-variable-list
   '(gnus-newsrc-options gnus-newsrc-options-n
     gnus-newsrc-last-checked-date 
-    gnus-newsrc-assoc gnus-server-alist
+    gnus-newsrc-alist gnus-server-alist
     gnus-killed-list gnus-zombie-list)
   "Gnus variables saved in the quick startup file.")
 
@@ -1332,12 +1256,12 @@ It is a list of `(original overload &optional file)'.")
 (defvar gnus-newsrc-last-checked-date nil
   "Date Gnus last asked server for new newsgroups.")
 
-(defvar gnus-newsrc-assoc nil
+(defvar gnus-newsrc-alist nil
   "Assoc list of read articles.
 gnus-newsrc-hashtb should be kept so that both hold the same information.")
 
 (defvar gnus-newsrc-hashtb nil
-  "Hashtable of gnus-newsrc-assoc.")
+  "Hashtable of gnus-newsrc-alist.")
 
 (defvar gnus-killed-list nil
   "List of killed newsgroups.")
@@ -1360,6 +1284,8 @@ gnus-newsrc-hashtb should be kept so that both hold the same information.")
 (defvar gnus-moderated-list nil
   "List of moderated newsgroups.")
 
+(defvar gnus-group-marked nil)
+
 (defvar gnus-current-startup-file nil
   "Startup file for the current host.")
 
@@ -1434,8 +1360,7 @@ gnus-newsrc-hashtb should be kept so that both hold the same information.")
 (defvar gnus-current-kill-article nil)
 
 ;; Save window configuration.
-(defvar gnus-winconf-edit-group nil)
-(defvar gnus-winconf-edit-score nil)
+(defvar gnus-prev-winconf nil)
 
 ;; Format specs
 (defvar gnus-summary-line-format-spec nil)
@@ -1467,73 +1392,179 @@ gnus-newsrc-hashtb should be kept so that both hold the same information.")
     gnus-last-article gnus-article-internal-prepare-hook
     gnus-newsgroup-dependencies gnus-newsgroup-selected-overlay
     gnus-newsgroup-scored gnus-newsgroup-kill-headers
+    gnus-newsgroup-threads gnus-newsgroup-async
     gnus-score-alist gnus-current-score-file gnus-summary-expunge-below 
     gnus-summary-mark-below gnus-newsgroup-active gnus-scores-exclude-files
-    gnus-newsgroup-history gnus-newsgroup-ancient)
+    gnus-newsgroup-history gnus-newsgroup-ancient
+    gnus-newsgroup-adaptive)
   "Variables that are buffer-local to the summary buffers.")
 
+(defconst gnus-bug-message
+  "Sending a bug report to the Gnus Towers.
+========================================
+
+The buffer below is a mail buffer.  When you press `C-c C-c', it will
+be sent to the Gnus Bug Exterminators. 
+
+At the bottom of the buffer you'll see lots of variable settings.
+Please do not delete those.  They will tell the Bug People what your
+environment is, so that it will be easier to locate the bugs.
+
+If you have found a bug that makes Emacs go \"beep\", set
+debug-on-error to t (`M-ESC (setq debug-on-error t)') and include the
+backtrace in your bug report.
+
+Please describe the bug in annoying, painstaking detail.
+
+Thank you for your help in stamping out bugs.
+")
+
 ;;; End of variables.
 
 ;; 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")
+
+  ;; 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")
-  
-  (autoload 'rmail-output "rmailout")
+
+  ;; 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-mh
   (autoload 'gnus-mail-reply-using-mhe "gnus-mh")
   (autoload 'gnus-mail-forward-using-mhe "gnus-mh")
   (autoload 'gnus-mail-other-window-using-mhe "gnus-mh")
   (autoload 'gnus-summary-save-in-folder "gnus-mh")
   (autoload 'gnus-Folder-save-name "gnus-mh")
   (autoload 'gnus-folder-save-name "gnus-mh")
-  
-  (autoload 'gnus-group-make-menu-bar "gnus-visual")
-  (autoload 'gnus-summary-make-menu-bar "gnus-visual")
-  (autoload 'gnus-article-make-menu-bar "gnus-visual")
-  (autoload 'gnus-visual-highlight-selected-summary "gnus-visual")
-  (autoload 'gnus-visual-summary-highlight-line "gnus-visual")
-
-  (autoload 'gnus-uu-mark-by-regexp "gnus-uu")
-  (autoload 'gnus-uu-mark-region "gnus-uu")
-  (autoload 'gnus-uu-mark-thread "gnus-uu")
-  (autoload 'gnus-uu-mark-sparse "gnus-uu")
-  (autoload 'gnus-uu-mark-series "gnus-uu")
-  (autoload 'gnus-uu-mark-all "gnus-uu")
-  (autoload 'gnus-uu-post-news "gnus-uu")
-  (autoload 'gnus-uu-digest-and-forward "gnus-uu")
-
-  (autoload 'gnus-uu-decode-uu "gnus-uu")
-  (autoload 'gnus-uu-decode-uu-and-save "gnus-uu")
-  (autoload 'gnus-uu-decode-unshar "gnus-uu")
-  (autoload 'gnus-uu-decode-unshar-and-save "gnus-uu")
-  (autoload 'gnus-uu-decode-save "gnus-uu")
-  (autoload 'gnus-uu-decode-binhex "gnus-uu")
-  (autoload 'gnus-uu-decode-uu-view "gnus-uu")
-  (autoload 'gnus-uu-decode-uu-and-save-view "gnus-uu")
-  (autoload 'gnus-uu-decode-unshar-view "gnus-uu")
-  (autoload 'gnus-uu-decode-unshar-and-save-view "gnus-uu")
-  (autoload 'gnus-uu-decode-save-view "gnus-uu")
-  (autoload 'gnus-uu-decode-binhex-view "gnus-uu")
 
+  ;; 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-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-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-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-article "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)
+
+  ;; 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-remove-lines-adaptive "gnus-score")
+  (autoload 'gnus-possibly-score-headers "gnus-score")
+
+  ;; 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)
+
+  ;; gnus-msg
+  (autoload 'gnus-summary-send-map "gnus-msg" nil nil 'keymap)
+  (autoload 'gnus-group-post-news "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-reply-using-mail "gnus-msg")
+  (autoload 'gnus-mail-yank-original "gnus-msg")
+  (autoload 'gnus-mail-send-and-exit "gnus-msg")
+  (autoload 'gnus-mail-forward-using-mail "gnus-msg")
+  (autoload 'gnus-mail-other-window-using-mail "gnus-msg")
+  (autoload 'gnus-article-mail-with-original "gnus-msg")
+  (autoload 'gnus-article-mail "gnus-msg")
+
+  ;; gnus-vm
+  (autoload 'gnus-summary-save-in-vm "gnus-vm" nil t)
+  (autoload 'gnus-mail-forward-using-vm "gnus-vm")
+  (autoload 'gnus-mail-reply-using-vm "gnus-vm")
+  (autoload 'gnus-mail-other-window-using-vm "gnus-vm" nil t)
+  (autoload 'gnus-yank-article "gnus-vm" nil t)
 
-  (autoload 'pp "pp")
-  (autoload 'pp-to-string "pp")
-  (autoload 'mail-extract-address-components "mail-extr")
   )
 
 \f
@@ -1544,24 +1575,7 @@ gnus-newsrc-hashtb should be kept so that both hold the same information.")
 (defalias 'gnus-summary-position-cursor 'gnus-goto-colon)
 (defalias 'gnus-group-position-cursor 'gnus-goto-colon)
 
-;; Cruft to make Gnus work under GNU XEmacs.
-(defvar gnus-xemacs nil
-  "Non-nil if Gnus is running under GNU XEmacs.")
-
-(if (not (string-match "XEmacs\\|Lucid" emacs-version))
-    ()
-  (setq gnus-xemacs t)
-  (eval
-   '((or (memq 'underline (list-faces))
-        (make-face 'underline))
-     (or (face-differs-from-default-p 'underline)
-        (set-face-underline-p 'underline t))
-     
-     (defun set-text-properties (start end props &optional buffer)
-       (if props
-          (put-text-property start end (car props) (cadr props) buffer)
-        (remove-text-properties start end ()))))))
-
+;;; Various macros and substs.
 
 (defmacro gnus-eval-in-buffer-window (buffer &rest forms)
   "Pop to BUFFER, evaluate FORMS, and then returns to original window."
@@ -1572,13 +1586,6 @@ gnus-newsrc-hashtb should be kept so that both hold the same information.")
             (,@ forms))
         (select-window GnusStartBufferWindow)))))
 
-(defun gnus-make-hashtable (&optional hashsize)
-  "Make a hash table (default and minimum size is 255).
-Optional argument HASHSIZE specifies the table size."
-  (make-vector (if hashsize 
-                  (max (gnus-create-hash-size hashsize) 255)
-                255) 0))
-
 (defmacro gnus-gethash (string hashtable)
   "Get hash value of STRING in HASHTABLE."
   ;;(` (symbol-value (abbrev-symbol (, string) (, hashtable))))
@@ -1588,7 +1595,7 @@ Optional argument HASHSIZE specifies the table size."
 (defmacro gnus-sethash (string value 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))
   (` (set (intern (, string) (, hashtable)) (, value))))
 
 (defsubst gnus-buffer-substring (beg end)
@@ -1604,6 +1611,31 @@ Optional argument HASHSIZE specifies the table size."
 (defsubst gnus-goto-char (point)
   (and point (goto-char point)))
 
+(defmacro gnus-buffer-exists-p (buffer)
+  (` (and (, buffer)
+         (funcall (if (stringp (, buffer)) 'get-buffer 'buffer-name)
+                  (, buffer)))))
+
+(defmacro gnus-kill-buffer (buffer)
+  (` (if (gnus-buffer-exists-p (, buffer))
+        (kill-buffer (, buffer)))))
+
+(defsubst gnus-point-at-bol ()
+  "Return point at the beginning of line."
+  (let ((p (point)))
+    (beginning-of-line)
+    (prog1
+       (point)
+      (goto-char p))))
+
+(defsubst gnus-point-at-eol ()
+  "Return point at the beginning of line."
+  (let ((p (point)))
+    (end-of-line)
+    (prog1
+       (point)
+      (goto-char p))))
+
 \f
 ;;;
 ;;; Gnus Utility Functions
@@ -1627,28 +1659,23 @@ Optional argument HASHSIZE specifies the table size."
   "Return the value of the header FIELD of current article."
   (save-excursion
     (save-restriction
-      (gnus-narrow-to-headers)
-      (mail-fetch-field field))))
+      (let ((case-fold-search t))
+       (gnus-narrow-to-headers)
+       (mail-fetch-field field)))))
 
 (defun gnus-goto-colon ()
   (beginning-of-line)
-  (search-forward ":" (save-excursion (end-of-line) (point)) t))
+  (search-forward ":" (gnus-point-at-eol) t))
 
 (defun gnus-narrow-to-headers ()
   (widen)
   (save-excursion
-    (goto-char 1)
+    (goto-char (point-min))
     (if (search-forward "\n\n")
        (narrow-to-region 1 (1- (point))))))
 
-;; Get a number that is suitable for hashing; bigger than MIN
-(defun gnus-create-hash-size (min)
-  (let ((i 1))
-    (while (< i min)
-      (setq i (* 2 i)))
-    (1- i)))
-
 (defun gnus-update-format-specifications ()
+  (gnus-make-thread-indent-array)
   (setq gnus-summary-line-format-spec 
        (gnus-parse-format
         gnus-summary-line-format gnus-summary-line-format-alist))
@@ -1679,10 +1706,9 @@ Optional argument HASHSIZE specifies the table size."
     (let ((gnus-replied-mark 129)
          (gnus-score-below-mark 130)
          (gnus-score-over-mark 130)
+         (thread nil)
          pos)
-      (set-buffer (get-buffer-create " *gnus work*"))
-      (buffer-disable-undo (current-buffer))
-      (erase-buffer)
+      (gnus-set-work-buffer)
       (gnus-summary-insert-line 
        nil [0 "" "" "" "" "" 0 0 ""]  0 nil 128 t nil "" nil 1)
       (goto-char (point-min))
@@ -1694,19 +1720,18 @@ Optional argument HASHSIZE specifies the table size."
       (goto-char (point-min))
       (setq pos (cons (cons 'score (and (search-forward "\202" nil t)
                                        (- (point) 2))) pos))
-      (setq gnus-summary-mark-positions pos)
-      (kill-buffer (current-buffer)))))
+      (setq gnus-summary-mark-positions pos))))
 
-(defun gnus-format-max-width (var length)
-  (let (result)
-    (if (> (length (setq result (eval var))) length)
-       (format "%s" (substring result 0 length))
-      (format "%s" result))))
+(defun gnus-format-max-width (form length)
+  (let* ((val (eval form))
+        (valstr (if (numberp val) (int-to-string val) val)))
+    (if (> (length valstr) length)
+       (substring valstr 0 length)
+      valstr)))
 
 (defun gnus-set-mouse-face (string)
   ;; Set mouse face property on STRING.
-  (or gnus-xemacs
-      (put-text-property 0 (length string) 'mouse-face gnus-mouse-face string))
+  (put-text-property 0 (length string) 'mouse-face gnus-mouse-face string)
   string)
 
 (defun gnus-parse-format (format spec-alist)
@@ -1740,12 +1765,9 @@ Optional argument HASHSIZE specifies the table size."
   (let ((max-width 0)
        spec flist fstring b newspec max-width elem beg)
     (save-excursion
-      (set-buffer (get-buffer-create " *gnus work*"))
-      (buffer-disable-undo (current-buffer))
-      (gnus-add-current-to-buffer-list)
-      (erase-buffer)
+      (gnus-set-work-buffer)
       (insert format)
-      (goto-char 1)
+      (goto-char (point-min))
       (while (re-search-forward "%[-0-9]*\\(,[0-9]*\\)*\\(.\\)\\(.\\)?" nil t)
        (setq spec (string-to-char (buffer-substring (match-beginning 2)
                                                     (match-end 2))))
@@ -1778,8 +1800,7 @@ Optional argument HASHSIZE specifies the table size."
                     (setq el (list 'char-to-string el)))
                    ((= (car (cdr elem)) ?d)
                     (numberp el) (setq el (list 'int-to-string el))))
-             (setq flist (cons (list 'gnus-format-max-width 
-                                     el max-width) 
+             (setq flist (cons (list 'gnus-format-max-width el max-width) 
                                flist))
              (setq newspec ?s))
          (setq flist (cons (car elem) flist))
@@ -1802,6 +1823,15 @@ Optional argument HASHSIZE specifies the table size."
           (file-exists-p (concat gnus-init-file ".elc")))
        (load gnus-init-file nil t)))
 
+(defun gnus-set-work-buffer ()
+  (if (get-buffer gnus-work-buffer)
+      (progn
+       (set-buffer gnus-work-buffer)
+       (erase-buffer))
+    (set-buffer (get-buffer-create gnus-work-buffer))
+    (buffer-disable-undo (current-buffer))
+    (gnus-add-current-to-buffer-list)))
+
 ;; Article file names when saving.
 
 (defun gnus-Numeric-save-name (newsgroup headers &optional last-file)
@@ -1932,7 +1962,7 @@ Otherwise, it is like ~/News/news/group/news."
 (defun gnus-subscribe-alphabetically (newgroup)
   "Subscribe new NEWSGROUP and insert it in alphabetical order."
   ;; Basic ideas by mike-w@cs.aukuni.ac.nz (Mike Williams)
-  (let ((groups (cdr gnus-newsrc-assoc))
+  (let ((groups (cdr gnus-newsrc-alist))
        before)
     (while (and (not before) groups)
       (if (string< newgroup (car (car groups)))
@@ -1978,10 +2008,11 @@ it is killed."
   "Subscribe new NEWSGROUP.
 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 3.
+  ;; We subscribe the group by changing its level to `subscribed'.
   (gnus-group-change-level 
-   newsgroup 3 9 (gnus-gethash (or next "dummy.group") gnus-newsrc-hashtb))
-  (message "Subscribe newsgroup: %s" newsgroup))
+   newsgroup gnus-level-default-subscribed
+   gnus-level-killed (gnus-gethash (or next "dummy.group") gnus-newsrc-hashtb))
+  (gnus-message 5 "Subscribe newsgroup: %s" newsgroup))
 
 ;; For directories
 
@@ -1989,14 +2020,18 @@ the first newsgroup."
   "Make hierarchical directory name from NEWSGROUP name."
   (let ((newsgroup (substring newsgroup 0)) ;Copy string.
        (len (length newsgroup))
-       (idx 0))
+       idx)
+    ;; If this is a foreign group, we don't want to translate the
+    ;; entire name.  
+    (if (setq idx (string-match ":" newsgroup))
+       (aset newsgroup idx ?/)
+      (setq idx 0))
     ;; Replace all occurrences of `.' with `/'.
     (while (< idx len)
       (if (= (aref newsgroup idx) ?.)
          (aset newsgroup idx ?/))
       (setq idx (1+ idx)))
-    newsgroup
-    ))
+    newsgroup))
 
 (defun gnus-make-directory (dir)
   "Make DIRECTORY recursively."
@@ -2034,24 +2069,34 @@ If optional argument RE-ONLY is non-nil, strip `Re:' only."
     ;; Return subject string.
     subject))
 
+;; Remove any leading "re:"s, any trailing paren phrases, and simplify
+;; all whitespace.
 (defun gnus-simplify-subject-fuzzy (subject)
   (let ((case-fold-search t))
-    (and (string-match "^re:[ \t]*" subject)
-        (setq subject (substring subject (match-end 0))))
-    (while (string-match "[ \t\n]*([^()]*)[ \t\n]*\\'" subject)
-      (setq subject (substring subject 0 (match-beginning 0))))
-    (let ((beg 0)
-         (osubject ""))
-      (while (string-match "[ \t]+" subject beg)
-       (setq osubject
-             (concat osubject (substring 
-                               subject beg (match-beginning 0)) " ")
-             beg (match-end 0)))
-      (setq osubject (concat osubject (substring subject beg)))
-      (and (string-match " \\'" osubject) 
-          (setq osubject (substring osubject 0 (match-beginning 0))))
-      osubject)))
+    (save-excursion
+      (gnus-set-work-buffer)
+      (insert subject)
+      (gnus-simplify-buffer-fuzzy)
+      (buffer-string))))
+
+(defun gnus-simplify-buffer-fuzzy ()
+  (goto-char (point-min))
+  (while (re-search-forward "^[ \t]*re:[ \t]*" nil t)
+    (replace-match "" t t))
+  (goto-char (point-min))
+  (while (re-search-forward "[ \t\n]*([^()]*)[ \t\n]*$" nil t)
+    (replace-match "" t t))
+  (goto-char (point-min))
+  (while (re-search-forward "[ \t]+" nil t)
+    (replace-match " " t t))
+  (goto-char (point-min))
+  (while (re-search-forward "[ \t]+$" nil t)
+    (replace-match "" t t))
+  (goto-char (point-min))
+  (while (re-search-forward "^[ \t]+" nil t)
+    (replace-match "" t t)))
 
+;; Add the current buffer to the list of buffers to be killed on exit. 
 (defun gnus-add-current-to-buffer-list ()
   (setq gnus-buffer-list (cons (current-buffer) gnus-buffer-list)))
 
@@ -2063,37 +2108,31 @@ If optional argument RE-ONLY is non-nil, strip `Re:' only."
 ;; Functions are more convenient than macros in some cases.
 
 (defun gnus-header-number (header)
-  "Return article number in HEADER."
   (header-number header))
 
 (defun gnus-header-subject (header)
-  "Return subject string in HEADER."
   (header-subject header))
 
 (defun gnus-header-from (header)
-  "Return author string in HEADER."
   (header-from header))
 
 (defun gnus-header-xref (header)
-  "Return xref string in HEADER."
   (header-xref header))
 
 (defun gnus-header-lines (header)
-  "Return lines in HEADER."
   (header-lines header))
 
 (defun gnus-header-date (header)
-  "Return date in HEADER."
   (header-date header))
 
 (defun gnus-header-id (header)
-  "Return Id in HEADER."
   (header-id header))
 
 (defun gnus-header-references (header)
-  "Return references in HEADER."
   (header-references header))
 
+;;; General various misc type functions.
+
 (defun gnus-clear-system ()
   "Clear all variables and buffers."
   ;; Clear Gnus variables.
@@ -2104,7 +2143,7 @@ If optional argument RE-ONLY is non-nil, strip `Re:' only."
   ;; Clear other internal variables.
   (setq gnus-list-of-killed-groups nil
        gnus-have-read-active-file nil
-       gnus-newsrc-assoc nil
+       gnus-newsrc-alist nil
        gnus-newsrc-hashtb nil
        gnus-killed-list nil
        gnus-zombie-list nil
@@ -2113,141 +2152,182 @@ If optional argument RE-ONLY is non-nil, strip `Re:' only."
        gnus-moderated-list nil
        gnus-description-hashtb nil
        gnus-newsgroup-headers nil
-       gnus-score-cache nil
        gnus-newsgroup-headers-hashtb-by-number nil
        gnus-newsgroup-name nil
-       gnus-internal-global-score-files nil
        gnus-server-alist nil
        gnus-current-select-method nil)
+  ;; Reset any score variables.
+  (and (boundp 'gnus-score-cache)
+       (set 'gnus-score-cache nil))
+  (and (boundp 'gnus-internal-global-score-files)
+       (set 'gnus-internal-global-score-files nil))
   ;; Kill the startup file.
   (and gnus-current-startup-file
        (get-file-buffer gnus-current-startup-file)
        (kill-buffer (get-file-buffer gnus-current-startup-file)))
+  ;; Save any cache buffers.
+  (and gnus-use-cache (gnus-cache-save-buffers))
+  ;; Clear the dribble buffer.
   (gnus-dribble-clear)
   ;; Kill global KILL file buffer.
   (if (get-file-buffer (gnus-newsgroup-kill-file nil))
       (kill-buffer (get-file-buffer (gnus-newsgroup-kill-file nil))))
-  (and (buffer-name nntp-server-buffer)
-       (kill-buffer nntp-server-buffer))
+  (gnus-kill-buffer nntp-server-buffer)
   ;; Kill Gnus buffers.
   (while gnus-buffer-list
-    (if (and (get-buffer (car gnus-buffer-list))
-            (buffer-name (get-buffer (car gnus-buffer-list))))
-       (kill-buffer (car gnus-buffer-list)))
+    (gnus-kill-buffer (car gnus-buffer-list))
     (setq gnus-buffer-list (cdr gnus-buffer-list))))
 
-(defun gnus-configure-windows (action &optional force)
-  "Configure Gnus windows according to the next ACTION.
-The ACTION is either a symbol, such as `summary', or a
-configuration list such as `(1 1 2)'.  If ACTION is not a list,
-configuration list is got from the variable gnus-window-configuration.
-If FORCE is non-nil, the updating will be done whether it is necessary
-or not."
-  (let* ((windows
-         (if (listp action) action 
-           (if (listp gnus-window-configuration)
-               (car (cdr (assq action gnus-window-configuration)))
-             gnus-window-configuration)))
-        (grpwin (get-buffer-window gnus-group-buffer))
-        (subwin (get-buffer-window gnus-summary-buffer))
-        (artwin (get-buffer-window gnus-article-buffer))
-        (winsum nil)
-        (height nil)
-        (grpheight 0)
-        (subheight 0)
-        (artheight 0)
-
-        ;; Make split-window-vertically leave focus in upper window.
-        (split-window-keep-point t))
-    (if (and (symbolp windows) (fboundp windows))
-       (funcall windows action)
-      (if (and (not force)
-              (or (null windows)               ;No configuration is specified.
-                  (and (eq (null grpwin)
-                           (zerop (nth 0 windows)))
-                       (eq (null subwin)
-                           (zerop (nth 1 windows)))
-                       (eq (null artwin)
-                           (zerop (nth 2 windows))))))
-         ;; No need to change window configuration.
-         nil
-       (select-window (or grpwin subwin artwin (selected-window)))
-       ;; First of all, compute the height of each window.
-       (cond (gnus-use-full-window
-              ;; Take up the entire screen.
-              (delete-other-windows)
-              (setq height (window-height (selected-window))))
-             (t
-              (setq height (+ (if grpwin (window-height grpwin) 0)
-                              (if subwin (window-height subwin) 0)
-                              (if artwin (window-height artwin) 0)))))
-       ;; The group buffer exits always. So, use it to extend the
-       ;; group window so as to get enough window space.
-       (switch-to-buffer gnus-group-buffer 'norecord)
-       (and (get-buffer gnus-summary-buffer)
-            (delete-windows-on gnus-summary-buffer))
-       (and (get-buffer gnus-article-buffer)
-            (delete-windows-on gnus-article-buffer))
-       ;; Compute expected window height.
-       (setq winsum (apply (function +) windows))
-       (if (not (zerop (nth 0 windows)))
-           (setq grpheight (max window-min-height
-                                (/ (* height (nth 0 windows)) winsum))))
-       (if (not (zerop (nth 1 windows)))
-           (setq subheight (max window-min-height
-                                (/ (* height (nth 1 windows)) winsum))))
-       (if (not (zerop (nth 2 windows)))
-           (setq artheight (max window-min-height
-                                (/ (* height (nth 2 windows)) winsum))))
-       (setq height (+ grpheight subheight artheight))
-       (enlarge-window (max 0 (- height (window-height (selected-window)))))
-       ;; Then split the window.
-       (and (not (zerop artheight))
-            (or (not (zerop grpheight))
-                (not (zerop subheight)))
-            (split-window-vertically (+ grpheight subheight)))
-       (and (not (zerop grpheight))
-            (not (zerop subheight))
-            (split-window-vertically grpheight))
-       ;; Then select buffers in each window.
-       (or (zerop grpheight)
-           (progn
-             (switch-to-buffer gnus-group-buffer 'norecord)
-             (other-window 1)))
-       (or (zerop subheight)
-           (progn
-             (switch-to-buffer gnus-summary-buffer 'norecord)
-             (other-window 1)))
-       (or (zerop artheight)
+(defun gnus-windows-old-to-new (setting)
+  (if (symbolp setting)
+      (setq setting 
+           (cond ((eq setting 'SelectArticle)
+                  'article)
+                 ((eq setting 'SelectSubject)
+                  'summary)
+                 ((eq setting 'SelectNewsgroup)
+                  'group)
+                 (t setting))))
+  (if (or (listp setting)
+         (not (and gnus-window-configuration
+                   (memq setting '(group summary article)))))
+      setting
+    (let* ((setting (if (eq setting 'group) 
+                       (if (assq 'newsgroup gnus-window-configuration)
+                           'newsgroup
+                         'newsgroups) setting))
+          (elem (car (cdr (assq setting gnus-window-configuration))))
+          (total (apply '+ elem))
+          (types '(group summary article))
+          (pbuf (if (eq setting 'newsgroups) 'group 'summary))
+          (i 0)
+          perc
+          out)
+      (while (< i 3)
+       (or (zerop (nth i elem))
            (progn
-             ;; If article buffer does not exist, it will be created
-             ;; and initialized.
-             (gnus-article-setup-buffer)
-             (switch-to-buffer gnus-article-buffer 'norecord)
-             (setq buffer-read-only t) ; !!! Why!?! 
-             (bury-buffer gnus-summary-buffer)
-             (bury-buffer gnus-group-buffer)))
-       (or (zerop subheight)
+             (setq perc  (/ (* 1.0 (nth 0 elem)) total))
+             (setq out (cons (if (eq pbuf (nth i types))
+                                 (vector (nth i types) perc 'point)
+                               (vector (nth i types) perc))
+                             out))))
+       (setq i (1+ i)))
+      (list (nreverse out)))))
+          
+(defun gnus-configure-windows (setting)
+  (setq setting (gnus-windows-old-to-new setting))
+  (let ((r (if (symbolp setting)
+                 (cdr (assq setting gnus-buffer-configuration))
+               setting))
+       (in-buf (current-buffer))
+       rule val window w height hor ohor heights sub jump-buffer
+       rel total to-buf)
+    (or r (error "No such setting: %s" setting))
+
+    ;; Either remove all windows or just remove all Gnus windows.
+    (if gnus-use-full-window
+       (delete-other-windows)
+      (gnus-remove-some-windows)
+      (switch-to-buffer nntp-server-buffer))
+
+    (while r
+      (setq hor (car r)
+           ohor nil)
+
+      ;; We have to do the (possible) horizontal splitting before the
+      ;; vertical. 
+      (if (and (listp (car hor)) 
+              (eq (car (car hor)) 'horizontal))
+         (progn
+           (split-window nil (floor (* (frame-width) (nth 1 (car hor)))) t)
+           (setq hor (cdr hor))))
+
+      ;; Go through the rules and eval the elements that are to be
+      ;; evaled.  
+      (while hor
+       (if (setq val (if (vectorp (car hor)) (car hor) (eval (car hor))))
            (progn
-             (pop-to-buffer gnus-summary-buffer)
-             ;; It seems that some code in this function will set
-             ;; buffer-read-only to nil. I have absolutely no idea
-             ;; why. 
-             (setq buffer-read-only t))))))) ; !!! Why!?! 
-
-(defun gnus-window-configuration-split (action)
-  (switch-to-buffer gnus-group-buffer t)
-  (delete-other-windows)
-  (split-window-horizontally)
-  (cond ((or (eq action 'newsgoups) (eq action 'summary))
-        (if (and (get-buffer gnus-summary-buffer)
-                 (buffer-name gnus-summary-buffer))
-            (switch-to-buffer-other-window gnus-summary-buffer)))
-       ((eq action 'article)
-        (switch-to-buffer gnus-summary-buffer t)
-        (other-window 1)
-        (gnus-article-setup-buffer)
-        (switch-to-buffer gnus-article-buffer t))))
+             ;; Expand short buffer name.
+             (setq w (aref val 0))
+             (and (setq w (cdr (assq w gnus-window-to-buffer)))
+                  (progn
+                    (setq val (apply 'vector (mapcar (lambda (v) v) val)))
+                    (aset val 0 w)))
+             (setq ohor (cons val ohor))))
+       (setq hor (cdr hor)))
+      (setq rule (cons (nreverse ohor) rule))
+      (setq r (cdr r)))
+    (setq rule (nreverse rule))
+
+    ;; We tally the window sizes.
+    (setq total (window-height))
+    (while rule
+      (setq hor (car rule))
+      (if (and (listp (car hor)) (eq (car (car hor)) 'horizontal))
+         (setq hor (cdr hor)))
+      (setq sub 0)
+      (while hor
+       (setq rel (aref (car hor) 1)
+             heights (cons
+                      (cond ((and (floatp rel) (= 1.0 rel))
+                             'x)
+                            ((integerp rel)
+                             rel)
+                            (t
+                             (max (floor (* total rel)) 4)))
+                      heights)
+             sub (+ sub (if (numberp (car heights)) (car heights) 0))
+             hor (cdr hor)))
+      (setq heights (nreverse heights)
+           hor (car rule))
+      
+      ;; We then go through these heighs and create windows for them.
+      (while heights
+       (setq height (car heights)
+             heights (cdr heights))
+       (and (eq height 'x)
+            (setq height (- total sub)))
+       (and heights
+            (split-window nil height))
+       (setq to-buf (aref (car hor) 0))
+       (switch-to-buffer 
+        (cond ((not to-buf)
+               in-buf)
+              ((symbolp to-buf)
+               (symbol-value (aref (car hor) 0)))
+              (t
+               (aref (car hor) 0))))
+       (and (> (length (car hor)) 2)
+            (eq (aref (car hor) 2) 'point)
+            (setq jump-buffer (current-buffer)))
+       (other-window 1)
+       (setq hor (cdr hor)))
+      
+      (setq rule (cdr rule)))
+
+    ;; Finally, we pop to the buffer that's supposed to have point. 
+    (pop-to-buffer jump-buffer)
+    jump-buffer))
+      
+(defun gnus-remove-some-windows ()
+  (let ((buffers gnus-window-to-buffer)
+       (first t)
+       buf)
+    (while buffers
+      (setq buf (cdr (car buffers)))
+      (if (symbolp buf)
+         (setq buf (and (boundp buf) (symbol-value buf))))
+      (and buf 
+          (get-buffer-window buf)
+          (progn
+            (set-buffer buf)
+            (if first
+                (progn
+                  (switch-to-buffer nntp-server-buffer)
+                  (setq first nil))
+              (delete-window (get-buffer-window buf)))))
+      (setq buffers (cdr buffers)))
+    (set-buffer nntp-server-buffer)))
 
 (defun gnus-version ()
   "Version numbers of this version of Gnus."
@@ -2265,66 +2345,82 @@ or not."
           (stringp (symbol-value meth))
           (setq mess (concat mess "; " (symbol-value meth))))
       (setq methods (cdr methods)))
-    (message mess)))
+    (gnus-message 2 mess)))
 
 (defun gnus-info-find-node ()
   "Find Info documentation of Gnus."
   (interactive)
   ;; Enlarge info window if needed.
-  (cond ((eq major-mode 'gnus-group-mode)
-        (gnus-configure-windows '(1 0 0)) ;Take all windows.
-        (pop-to-buffer gnus-group-buffer))
-       ((eq major-mode 'gnus-summary-mode)
-        (gnus-configure-windows '(0 1 0)) ;Take all windows.
-        (pop-to-buffer gnus-summary-buffer)))
-  (Info-goto-node (car (cdr (assq major-mode gnus-info-nodes)))))
+  (let ((mode major-mode))
+    (gnus-configure-windows 'info)
+    (Info-goto-node (car (cdr (assq mode gnus-info-nodes))))))
 
 (defun gnus-bug ()
   "Send a bug report to the Gnus maintainers."
   (interactive)
-  (pop-to-buffer "*Gnus Bug*")
-  (erase-buffer)
-  (mail-setup gnus-maintainer "[Gnus Bug Report] " nil nil nil nil)
-  (goto-char (point-min))
-  (re-search-forward (concat "^" (regexp-quote mail-header-separator) "$"))
-  (forward-line 1)
-  (insert (format "%s\n%s\n\n" (gnus-version) (emacs-version)))
-  (gnus-debug)
-  (mail-mode)
-  (message ""))
+  (let ((winconf (current-window-configuration)))
+    (delete-other-windows)
+    (switch-to-buffer "*Gnus Bug Help*")
+    (erase-buffer)
+    (insert gnus-bug-message)
+    (goto-char (point-min))
+    (pop-to-buffer "*Gnus Bug*")
+    (erase-buffer)
+    (mail-mode)
+    (mail-setup gnus-maintainer "[Gnus Bug Report] " nil nil nil nil)
+    (make-local-variable 'gnus-prev-winconf)
+    (setq gnus-prev-winconf winconf)
+    (goto-char (point-min))
+    (re-search-forward (concat "^" (regexp-quote mail-header-separator) "$"))
+    (forward-line 1)
+    (insert (format "%s\n%s\n\n\n\n\n" (gnus-version) (emacs-version)))
+    (let ((b (point)))
+      (gnus-debug)
+      (goto-char (- b 3)))
+    (message "")))
 
 (defun gnus-debug ()
   "Attemps to go through the Gnus source file and report what variables have been changed.
 The source file has to be in the Emacs load path."
   (interactive)
-  (let ((dirs load-path)
-       file expr olist)
-    (while dirs
-      (if (file-exists-p (setq file (concat (car dirs) "/gnus.el")))
-         (save-excursion
+  (let ((files '("gnus.el" "gnus-msg.el" "gnus-score.el"))
+       file dirs expr olist)
+    (save-excursion
+      (set-buffer (get-buffer-create " *gnus bug info*"))
+      (buffer-disable-undo (current-buffer))
+      (message "Please wait while we snoop your variables...")
+      (sit-for 0)
+      (while files
+       (erase-buffer)
+       (setq dirs load-path)
+       (while dirs
+         (if (not (file-exists-p 
+                   (setq file (concat (file-name-as-directory 
+                                       (car dirs)) (car files)))))
+             (setq dirs (cdr dirs))
            (setq dirs nil)
-           (set-buffer (get-buffer-create "*gnus bug info*"))
-           (buffer-disable-undo (current-buffer))
-           (erase-buffer)
            (insert-file-contents file)
            (goto-char (point-min))
-           (or (search-forward "\n;; Internal variables" nil t)
-               (error "Malformed sources"))
+           (or (re-search-forward "^;;* Internal variables" nil t)
+               (error "Malformed sources in file %s" file))
            (narrow-to-region (point-min) (point))
            (goto-char (point-min))
            (while (setq expr (condition-case () 
                                  (read (current-buffer)) (error nil)))
              (and (eq (car expr) 'defvar)
                   (stringp (nth 3 expr))
-                  (not (equal (eval (nth 2 expr))
-                              (and (boundp (nth 1 expr))
-                                   (symbol-value (nth 1 expr)))))
-                  (setq olist (cons (nth 1 expr) olist))))
-           (kill-buffer (current-buffer)))
-       (setq dirs (cdr dirs))))
+                  (or (not (boundp (nth 1 expr)))
+                      (not (equal (eval (nth 2 expr))
+                                  (symbol-value (nth 1 expr)))))
+                  (setq olist (cons (nth 1 expr) olist))))))
+       (setq files (cdr files)))
+      (kill-buffer (current-buffer)))
+    (insert "------------------- Environment follows -------------------\n\n")
     (while olist
-      (insert "(setq " (symbol-name (car olist)) " '" 
-             (prin1-to-string (symbol-value (car olist))) ")\n")
+      (if (boundp (car olist))
+         (insert "(setq " (symbol-name (car olist)) " '" 
+                 (prin1-to-string (symbol-value (car olist))) ")\n")
+       (insert ";; (makeunbound '" (symbol-name (car olist)) ")\n"))
       (setq olist (cdr olist)))
     (insert "\n\n")))
 
@@ -2357,14 +2453,7 @@ If nothing is specified, use the variable gnus-overload-functions."
 
 (defun gnus-days-between (date1 date2)
   ;; Return the number of days between date1 and date2.
-  (let ((d1 (mapcar (lambda (s) (and s (string-to-int s)) )
-                   (timezone-parse-date date1)))
-       (d2 (mapcar (lambda (s) (and s (string-to-int s)) )
-                   (timezone-parse-date date2))))
-    (- (timezone-absolute-from-gregorian 
-       (nth 1 d1) (nth 2 d1) (car d1))
-       (timezone-absolute-from-gregorian 
-       (nth 1 d2) (nth 2 d2) (car d2)))))
+  (- (gnus-day-number date1) (gnus-day-number date2)))
 
 (defun gnus-day-number (date)
   (let ((dat (mapcar (lambda (s) (and s (string-to-int s)) )
@@ -2372,6 +2461,25 @@ If nothing is specified, use the variable gnus-overload-functions."
     (timezone-absolute-from-gregorian 
      (nth 1 dat) (nth 2 dat) (car dat))))
 
+;; Returns a floating point number that says how many seconds have
+;; lapsed between Jan 1 12:00:00 1970 and DATE.
+(defun gnus-seconds-since-epoch (date)
+  (let* ((tdate (mapcar (lambda (ti) (and ti (string-to-int ti)))
+                       (timezone-parse-date date)))
+        (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))))
+
 (defun gnus-file-newer-than (file date)
   (let ((fdate (nth 5 (file-attributes file))))
     (or (> (car fdate) (car date))
@@ -2390,17 +2498,6 @@ If nothing is specified, use the variable gnus-overload-functions."
       (yes-or-no-p prompt)
     (message "")))
 
-;; Return a string of length POS+1 representing NUMber in BASE. The
-;; resulting string will be left padded with zeds.
-(defun gnus-number-base-x (num pos base)
-  (if (< pos 0)
-      ""
-    (concat 
-     (char-to-string
-      (aref "zyxwvutsrqponmlkjihgfedcba9876543210" (/ num (expt base pos))))
-     (gnus-number-base-x 
-      (% num (expt base pos)) (1- pos) base))))
-
 ;; Check whether to use long file names.
 (defun gnus-use-long-file-name (symbol)
   ;; The variable has to be set...
@@ -2411,7 +2508,52 @@ If nothing is specified, use the variable gnus-overload-functions."
           ;; return nil.  
           (not (memq symbol gnus-use-long-file-name)))))
 
-;; List and range functions
+;; I suspect there's a better way, but I haven't taken the time to do
+;; it yet. -erik selberg@cs.washington.edu
+(defun gnus-dd-mmm (messy-date)
+  "Return a string like DD-MMM from a big messy string"
+  (let ((datevec (timezone-parse-date messy-date)))
+    (format "%2s-%s"
+           (or (aref datevec 2) "??")
+           (capitalize
+            (or (car 
+                 (nth (1- (string-to-number (aref datevec 1)))
+                      timezone-months-assoc))
+                "???")))))
+
+;; Make a hash table (default and minimum size is 255).
+;; Optional argument HASHSIZE specifies the table size.
+(defun gnus-make-hashtable (&optional hashsize)
+  (make-vector (if hashsize (max (gnus-create-hash-size hashsize) 255) 255) 0))
+
+;; Make a number that is suitable for hashing; bigger than MIN and one
+;; less than 2^x.
+(defun gnus-create-hash-size (min)
+  (let ((i 1))
+    (while (< i min)
+      (setq i (* 2 i)))
+    (1- i)))
+
+;; Delete the current line (and the next N lines.);
+(defun gnus-delete-line (&optional n)
+  (let ((n (or n 1)))
+    (delete-region (progn (beginning-of-line) (point))
+                  (progn (forward-line n) (point)))))
+
+;; Show message if message has a lower level than `gnus-verbose'. 
+;; Guide-line for numbers:
+;; 1 - error messages, 3 - non-serious error messages, 5 - messages
+;; for things that take a long time, 7 - not very important messages
+;; on stuff, 9 - messages inside loops.
+(defun gnus-message (level &rest args)
+  (if (<= level gnus-verbose)
+      (apply 'message args)
+    ;; We have to do this format thingie here even if the result isn't
+    ;; shown - the return value has to be the same as the return value
+    ;; from `message'.
+    (apply 'format args)))
+
+;;; List and range functions
 
 (defun gnus-last-element (list)
   "Return last element of LIST."
@@ -2442,17 +2584,19 @@ If nothing is specified, use the variable gnus-overload-functions."
   "Return a list of elements of LIST1 that do not appear in LIST2.
 Both lists have to be sorted over <."
   (let (out)
-    (while (and list1 list2)
-      (cond ((= (car list1) (car list2))
-            (setq list1 (cdr list1)
-                  list2 (cdr list2)))
-           ((< (car list1) (car list2))
-            (setq out (cons (car list1) out))
-            (setq list1 (cdr list1)))
-           (t
-            (setq out (cons (car list2) out))
-            (setq list2 (cdr list2)))))
-    (nreverse (append (or list1 list2) out))))
+    (if (or (null list1) (null list2))
+       (or list1 list2)
+      (while (and list1 list2)
+       (cond ((= (car list1) (car list2))
+              (setq list1 (cdr list1)
+                    list2 (cdr list2)))
+             ((< (car list1) (car list2))
+              (setq out (cons (car list1) out))
+              (setq list1 (cdr list1)))
+             (t
+              (setq out (cons (car list2) out))
+              (setq list2 (cdr list2)))))
+      (nconc (nreverse out) (or list1 list2)))))
 
 (defun gnus-intersection (list1 list2)      
   (let ((result nil))
@@ -2511,12 +2655,13 @@ ranges."
                 (setq last (car numbers)))
                (t                      ;End of one sequence
                 (setq result 
-                      (cons (if (= first last) first (cons first last)) result))
+                      (cons (if (= first last) first
+                              (cons first last)) result))
                 (setq first (car numbers))
                 (setq last  (car numbers))))
          (setq numbers (cdr numbers)))
        (if (and (not always-list) (null result))
-           (if (= first last) first (cons first last))
+           (if (= first last) (list first) (cons first last))
          (nreverse (cons (if (= first last) first (cons first last))
                          result)))))))
 
@@ -2609,58 +2754,6 @@ Note: LIST has to be sorted over `<'."
        (setq ranges (cdr ranges)))
       out)))
 
-(defun gnus-add-to-range-new (ranges list)
-  (gnus-compress-sequence 
-   (sort (nconc (gnus-uncompress-range ranges) list) '<)))     
-
-(defun gnus-add-to-range-old (ranges list)
-  "Return a list of ranges that has all articles from both RANGES and LIST.
-Note: LIST has to be sorted over `<'."
-  (let* ((ranges (if (and ranges (not (listp (cdr ranges))))
-                    (list ranges) ranges))
-        (inrange ranges)
-        did-one
-        range nranges first last)
-    (if (not list)
-       ranges
-      (if (not ranges)
-         (gnus-compress-sequence list t)
-       (and ranges 
-            (> (car (car ranges)) 1)
-            (progn
-              (setq did-one t)
-              (setq inrange (setq ranges (cons (cons 1 1) ranges)))))
-       (while (and ranges list)
-         (setq range (car ranges))
-         (while (and list (>= (car list) (car range))
-                     (<= (car list) (cdr range)))
-           (setq list (cdr list)))
-         (while (and list (= (1- (car list)) (cdr range)))
-           (setcdr range (car list))
-           (setq list (cdr list)))
-         (if (and list (and (> (car list) (cdr range)) 
-                            (cdr ranges)
-                            (< (car list) (car (car (cdr ranges))))))
-             (setcdr ranges (cons (cons (car list) (car list)) (cdr ranges))))
-         (setq ranges (cdr ranges)))
-       (if (and list (not ranges))
-           (setq inrange (nconc inrange (gnus-compress-sequence list t))))
-       (if did-one
-           (if (eq (cdr (car inrange)) 1)
-               (setq inrange (cdr inrange))
-             (setcar (car inrange) 2)))
-       (setq ranges inrange)
-       (while ranges
-         (if (and (cdr ranges) (>= (1+ (cdr (car ranges)))
-                                   (car (car (cdr ranges)))))
-             (progn
-               (setcdr (car ranges) (cdr (car (cdr ranges))))
-               (setcdr ranges (cdr (cdr ranges))))
-           (setq ranges (cdr ranges))))
-       (if (not (cdr inrange))
-           (car inrange)
-         inrange)))))
-
 (defun gnus-remove-from-range (ranges list)
   "Return a list of ranges that has all articles from LIST removed from RANGES.
 Note: LIST has to be sorted over `<'."
@@ -2693,7 +2786,8 @@ Note: LIST has to be sorted over `<'."
 ;;;
 
 (defvar gnus-group-mode-map nil)
-(defvar gnus-group-make-map nil)
+(defvar gnus-group-group-map nil)
+(defvar gnus-group-mark-map nil)
 (defvar gnus-group-list-map nil)
 (defvar gnus-group-sub-map nil)
 (put 'gnus-group-mode 'mode-class 'special)
@@ -2752,22 +2846,35 @@ Note: LIST has to be sorted over `<'."
   (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)
+  (define-key gnus-group-mode-map "\M-e" 'gnus-group-edit-group-method)
   (define-key gnus-group-mode-map "^" 'gnus-group-enter-server-mode)
-  (define-key gnus-group-mode-map
-    (if gnus-xemacs [button2] [mouse-2]) 'gnus-mouse-pick-group)
-
-  (define-prefix-command 'gnus-group-make-map)
-  (define-key gnus-group-mode-map "M" 'gnus-group-make-map)
-  (define-key gnus-group-make-map "d" 'gnus-group-make-directory-group)
-  (define-key gnus-group-make-map "h" 'gnus-group-make-help-group)
-  (define-key gnus-group-make-map "a" 'gnus-group-make-archive-group)
-  (define-key gnus-group-make-map "k" 'gnus-group-make-kiboze-group)
-  (define-key gnus-group-make-map "m" 'gnus-group-make-group)
-  (define-key gnus-group-make-map "e" 'gnus-group-edit-group)
+  (define-key gnus-group-mode-map gnus-mouse-2 'gnus-mouse-pick-group)
+  (define-key gnus-group-mode-map "<" 'beginning-of-buffer)
+  (define-key gnus-group-mode-map ">" 'end-of-buffer)
+  (define-key gnus-group-mode-map "\C-c\C-b" 'gnus-bug)
+
+  (define-key gnus-group-mode-map "#" 'gnus-group-mark-group)
+  (define-key gnus-group-mode-map "\M-#" 'gnus-group-unmark-group)
+  (define-prefix-command 'gnus-group-mark-map)
+  (define-key gnus-group-mode-map "M" 'gnus-group-mark-map)
+  (define-key gnus-group-mark-map "m" 'gnus-group-mark-group)
+  (define-key gnus-group-mark-map "u" 'gnus-group-unmark-group)
+  (define-key gnus-group-mark-map "w" 'gnus-group-mark-region)
+
+  (define-prefix-command 'gnus-group-group-map)
+  (define-key gnus-group-mode-map "G" 'gnus-group-group-map)
+  (define-key gnus-group-group-map "d" 'gnus-group-make-directory-group)
+  (define-key gnus-group-group-map "h" 'gnus-group-make-help-group)
+  (define-key gnus-group-group-map "a" 'gnus-group-make-archive-group)
+  (define-key gnus-group-group-map "k" 'gnus-group-make-kiboze-group)
+  (define-key gnus-group-group-map "m" 'gnus-group-make-group)
+  (define-key gnus-group-group-map "E" 'gnus-group-edit-group)
+  (define-key gnus-group-group-map "e" 'gnus-group-edit-group-method)
+  (define-key gnus-group-group-map "p" 'gnus-group-edit-group-parameters)
+  (define-key gnus-group-group-map "v" 'gnus-group-add-to-virtual)
 
   (define-prefix-command 'gnus-group-list-map)
-  (define-key gnus-group-mode-map "G" '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)
   (define-key gnus-group-list-map "z" 'gnus-group-list-zombies)
   (define-key gnus-group-list-map "s" 'gnus-group-list-groups)
@@ -2836,7 +2943,7 @@ 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."
   (interactive "P")
-  (gnus (or arg 2) t))
+  (gnus (or arg (1- gnus-level-default-subscribed)) t))
 
 (defalias '\(ding\) 'gnus)
 
@@ -2857,9 +2964,7 @@ prompt the user for the name of an NNTP server to use."
          did-connect)
       (unwind-protect
          (progn
-           (switch-to-buffer (get-buffer-create gnus-group-buffer))
-           (gnus-add-current-to-buffer-list)
-           (gnus-group-mode)
+           (gnus-group-setup-buffer)
            (or dont-connect 
                (setq did-connect
                      (gnus-start-news-server (and arg (not level))))))
@@ -2877,10 +2982,8 @@ prompt the user for the name of an NNTP server to use."
                  (sit-for 0))))
          (gnus-setup-news nil level)
          (and gnus-use-dribble-file (gnus-dribble-open))
-         (or t (not gnus-novice-user)
-             gnus-expert-user
-             (gnus-group-describe-briefly)) ;Show brief help message.
-         (gnus-group-list-groups level))))))
+         (gnus-group-list-groups level)
+         (gnus-configure-windows 'group))))))
 
 (defun gnus-group-startup-message (&optional x y)
   "Insert startup message in current buffer."
@@ -2912,22 +3015,24 @@ prompt the user for the name of an NNTP server to use."
 (defun gnus-group-setup-buffer ()
   (or (get-buffer gnus-group-buffer)
       (progn
-       (switch-to-buffer (get-buffer-create gnus-group-buffer))
+       (switch-to-buffer gnus-group-buffer)
        (gnus-add-current-to-buffer-list)
-       (gnus-group-mode))))
+       (gnus-group-mode)
+       (and gnus-carpal (gnus-carpal-setup-buffer 'group)))))
 
 (defun gnus-group-list-groups (level &optional unread)
   "List newsgroups with level LEVEL or lower that have unread alticles.
-Default is 5, which lists all subscribed groups.
+Default is all subscribed groups.
 If argument UNREAD is non-nil, groups with no unread articles are also listed."
-  (interactive "P")
-  (setq level (or level gnus-group-default-list-level 5))
+  (interactive (list (and current-prefix-arg
+                         (prefix-numeric-value current-prefix-arg))))
+  (setq level (or level gnus-group-default-list-level gnus-level-subscribed))
   (gnus-group-setup-buffer)    ;May call from out of group buffer
   (let ((case-fold-search nil)
        (group (gnus-group-group-name)))
     (funcall gnus-group-prepare-function level unread nil)
     (if (zerop (buffer-size))
-       (message gnus-no-groups-message)
+       (gnus-message 5 gnus-no-groups-message)
       (goto-char (point-min))
       (if (not group)
          ;; Go to the first group with unread articles.
@@ -2958,11 +3063,11 @@ If LOWEST is non-nil, list all newsgroups of level LOWEST or higher.
 If REGEXP, only list groups matching REGEXP."
   (set-buffer gnus-group-buffer)
   (let ((buffer-read-only nil)
-       (newsrc (cdr gnus-newsrc-assoc))
+       (newsrc (cdr gnus-newsrc-alist))
        (lowest (or lowest 1))
        info clevel unread group)
     (erase-buffer)
-    (if (< lowest 8)
+    (if (< lowest gnus-level-zombie)
        ;; List living groups.
        (while newsrc
          (setq info (car newsrc)
@@ -2982,14 +3087,15 @@ If REGEXP, only list groups matching REGEXP."
                nil group (car (cdr info)) (nth 3 info) unread (nth 4 info)))))
 
     ;; List dead groups.
-    (and (>= level 8) (<= lowest 8)
+    (and (>= level gnus-level-zombie) (<= lowest gnus-level-zombie)
         (gnus-group-prepare-flat-list-dead 
-         (setq gnus-zombie-list (sort gnus-zombie-list 'string<)) 8 ?Z
+         (setq gnus-zombie-list (sort gnus-zombie-list 'string<)) 
+         gnus-level-zombie ?Z
          regexp))
-    (and (>= level 9) (<= lowest 9)
+    (and (>= level gnus-level-killed) (<= lowest gnus-level-killed)
         (gnus-group-prepare-flat-list-dead 
-         (setq gnus-killed-list (sort gnus-killed-list 'string<)) 9 ?K
-         regexp))
+         (setq gnus-killed-list (sort gnus-killed-list 'string<)) 
+         gnus-level-killed ?K regexp))
 
     (gnus-group-set-mode-line)
     (setq gnus-have-all-newsgroups all)
@@ -3050,8 +3156,26 @@ If REGEXP, only list groups matching REGEXP."
   "Return nil if GROUP is native, non-nil if it is foreign."
   (string-match ":" group))
 
-(defun gnus-group-set-info (info)
-  (let ((entry (gnus-gethash (car info) gnus-newsrc-hashtb)))
+(defun gnus-group-set-info (info &optional method-only-group part)
+  (let* ((entry (gnus-gethash
+                (or method-only-group (car info)) gnus-newsrc-hashtb))
+        (part-info info)
+        (info (if method-only-group (nth 2 entry) info)))
+    (if (not method-only-group)
+       ()
+      (or entry
+         (error "Trying to change non-existant group %s" method-only-group))
+      ;; We have recevied parts of the actual group info - either the
+      ;; select method or the group parameters.  We first check
+      ;; whether we have to extend the info, and if so, do that.
+      (let ((len (length info))
+           (total (if (eq part 'method) 5 6)))
+       (and (< len total)
+            (setcdr (nthcdr (1- len) info)
+                    (make-list (- total len) nil)))
+       ;; Then we enter the new info.
+       (setcar (nthcdr (1- total) info) part-info)))
+    ;; We uncompress some lists of marked articles.
     (let (marked)
       (if (not (setq marked (nth 3 info)))
          ()
@@ -3064,23 +3188,28 @@ If REGEXP, only list groups matching REGEXP."
          (setq marked (cdr marked)))))
     (if entry
        ()
+      ;; This is a new group, so we just create it.
       (save-excursion
        (set-buffer gnus-group-buffer)
        (if (nth 4 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)))
+         ;; It's a native group.
          (gnus-group-make-group
           (car info)
           (prin1-to-string (car gnus-select-method))
           (nth 1 gnus-select-method)))
-       (message "Note: New group created")
+       (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-newsrc-hashtb))))
+    ;; Whether it was a new group or not, we now have the entry, so we
+    ;; can do the update.
     (if entry
        (progn
          (setcar (nthcdr 2 entry) info)
@@ -3094,6 +3223,12 @@ If REGEXP, only list groups matching REGEXP."
                                  (length (cdr (assq 'dormant marked)))))))))
       (error "No such group: %s" (car info)))))
 
+(defun gnus-group-set-method-info (group select-method)
+  (gnus-group-set-info select-method group 'method))
+
+(defun gnus-group-set-params-info (group params)
+  (gnus-group-set-info params group 'params))
+
 (defun gnus-group-update-group-line ()
   "This function updates the current line in the newsgroup buffer and
 moves the point to the colon."
@@ -3105,7 +3240,7 @@ moves the point to the colon."
         (concat "(gnus-group-set-info '" (prin1-to-string (nth 2 entry))
                 ")")))
     (beginning-of-line)
-    (delete-region (point) (save-excursion (forward-line 1) (point)))
+    (delete-region (point) (progn (forward-line 1) (point)))
     (gnus-group-insert-group-line-info group)
     (forward-line -1)
     (gnus-group-position-cursor)))
@@ -3120,7 +3255,8 @@ moves the point to the colon."
           nil group (nth 1 info) (nth 3 info) (car entry) (nth 4 info)))
       (setq active (gnus-gethash group gnus-active-hashtb))
       (gnus-group-insert-group-line 
-       nil group (if (member group gnus-zombie-list) 8 9)
+       nil group (if (member group gnus-zombie-list) gnus-level-zombie
+                  gnus-level-killed)
        nil (if active (- (1+ (cdr active)) (car active)) 0) nil))))
 
 (defun gnus-group-insert-group-line (gformat group level marked number method)
@@ -3138,9 +3274,9 @@ moves the point to the colon."
          (if (numberp number)
              (max 0 (- number-total number))
            "*"))
-        (subscribed (cond ((< level 6) ? )
-                          ((< level 8) ?U)
-                          ((= level 8) ?Z)
+        (subscribed (cond ((<= level gnus-level-subscribed) ? )
+                          ((<= level gnus-level-unsubscribed) ?U)
+                          ((= level gnus-level-zombie) ?Z)
                           (t ?K)))
         (qualified-group (gnus-group-real-name group))
         (newsgroup-description 
@@ -3213,6 +3349,7 @@ If VISIBLE-ONLY is non-nil, the group won't be displayed if it isn't already."
          (or visible-only
              (let ((entry (cdr (gnus-gethash group gnus-newsrc-hashtb))))
                (while (and entry
+                           (car entry)
                            (not
                             (gnus-goto-char
                              (text-property-any
@@ -3233,8 +3370,9 @@ If VISIBLE-ONLY is non-nil, the group won't be displayed if it isn't already."
                                 gnus-group-mode-line-format-alist))))
             (news-server (car (cdr gnus-select-method)))
             (news-method (car gnus-select-method))
-            (mode-string (eval gformat))
-            (max-len 60))
+            (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)
@@ -3242,13 +3380,12 @@ If VISIBLE-ONLY is non-nil, the group won't be displayed if it isn't already."
 
 (defun gnus-group-group-name ()
   "Get the name of the newsgroup on the current line."
-  (let ((group (get-text-property 
-               (save-excursion (beginning-of-line) (point)) 'gnus-group)))
+  (let ((group (get-text-property (gnus-point-at-bol) 'gnus-group)))
     (and group (symbol-name group))))
 
 (defun gnus-group-group-level ()
   "Get the level of the newsgroup on the current line."
-  (get-text-property (save-excursion (beginning-of-line) (point)) 'gnus-level))
+  (get-text-property (gnus-point-at-bol) 'gnus-level))
 
 (defun gnus-group-search-forward (&optional backward all level first-too)
   "Find the next newsgroup with unread articles.
@@ -3261,34 +3398,114 @@ If FIRST-TOO, the current line is also eligeble as a target."
        (low 10)
        (beg (point))
        pos found)
-    (or first-too (forward-line way))
-    (while (and 
-           (not (eobp))
-           (not (setq 
-                 found 
-                 (and (or all
-                          (and
-                           (let ((unread 
-                                  (get-text-property (point) 'gnus-unread)))
-                             (or (eq unread t) (and unread (> unread 0))))
-                           (let ((lev (get-text-property (point) 'gnus-level)))
-                             (and lev (< (get-text-property (point) 'gnus-level) 6)))))
-                      (or (not level)
-                          (let ((lev (get-text-property (point) 'gnus-level)))
-                            (if (and lev (<= lev level))
-                                t
-                              (if (< lev low)
-                                  (progn
-                                    (setq low lev)
-                                    (setq pos (point))))
-                              nil))))))
-           (zerop (forward-line way))))
+    (if (and backward (progn (beginning-of-line)) (bobp))
+       nil
+      (or first-too (forward-line way))
+      (while (and 
+             (not (eobp))
+             (not (setq 
+                   found 
+                   (and (or all
+                            (and
+                             (let ((unread 
+                                    (get-text-property (point) 'gnus-unread)))
+                               (or (eq unread t) (and unread (> unread 0))))
+                             (let ((lev (get-text-property
+                                         (point) 'gnus-level)))
+                               (and lev (<= (get-text-property 
+                                             (point) 'gnus-level)
+                                            gnus-level-subscribed)))))
+                        (or (not level)
+                            (let ((lev (get-text-property (point) 'gnus-level)))
+                              (if (and lev (<= lev level))
+                                  t
+                                (if (< lev low)
+                                    (progn
+                                      (setq low lev)
+                                      (setq pos (point))))
+                                nil))))))
+             (zerop (forward-line way)))))
     (if found 
        (progn (gnus-group-position-cursor) t)
       (if pos (goto-char pos) (goto-char beg))
       nil)))
 
-;; Gnus group mode commands
+;;; Gnus group mode commands
+
+;; Group marking.
+
+(defun gnus-group-mark-group (n &optional unmark)
+  "Mark the current group."
+  (interactive "p")
+  (let ((buffer-read-only nil)
+       group)
+    (while 
+       (and (> n 0) 
+            (setq group (gnus-group-group-name))
+            (progn
+              (beginning-of-line)
+              (forward-char 1)
+              (delete-char 1)
+              (if unmark
+                  (progn
+                    (insert " ")
+                    (setq gnus-group-marked (delete group gnus-group-marked)))
+                (insert "#")
+                (setq gnus-group-marked (cons group gnus-group-marked)))
+              t)
+            (zerop (gnus-group-next-group 1)))
+      (setq n (1- n)))
+    (gnus-summary-position-cursor)
+    n))
+
+(defun gnus-group-unmark-group (n)
+  "Remove the mark from the current group."
+  (interactive "p")
+  (gnus-group-mark-group n 'unmark))
+
+(defun gnus-group-mark-region (unmark beg end)
+  "Mark all groups between point and mark.
+If UNMARK, remove the mark instead."
+  (interactive "P\nr")
+  (let ((num (count-lines beg end)))
+    (save-excursion
+      (goto-char beg)
+      (- num (gnus-group-mark-group num unmark)))))
+
+(defun gnus-group-remove-mark (group)
+  (and (gnus-group-goto-group group)
+       (save-excursion
+        (gnus-group-mark-group 1 'unmark))))
+
+;; Return a list of groups to work on.  Take into consideration N (the
+;; prefix) and the list of marked groups.
+(defun gnus-group-process-prefix (n)
+  (cond (n
+        (setq n (prefix-numeric-value n))
+        ;; There is a prefix, so we return a list of the N next
+        ;; groups. 
+        (let ((way (if (< n 0) -1 1))
+              (n (abs n))
+              group groups)
+          (save-excursion
+            (while (and (> n 0)
+                        (setq group (gnus-group-group-name)))
+              (setq groups (cons group groups))
+              (setq n (1- n))
+              (forward-line way)))
+          (nreverse groups)))
+       (gnus-group-marked
+        ;; No prefix, but a list of marked articles.
+        (reverse gnus-group-marked))
+       (t
+        ;; Neither marked articles or a prefix, so we return the
+        ;; current group.
+        (let ((group (gnus-group-group-name)))
+          (and group (list group))))))
+
+
+
+;; Selecting groups.
 
 (defun gnus-group-read-group (all &optional no-article group)
   "Read news in this newsgroup.
@@ -3344,6 +3561,12 @@ If argument ALL is non-nil, already read articles become readable."
   ;; Adjust cursor point.
   (gnus-group-position-cursor))
 
+(defun gnus-group-goto-group (group)
+  "Goto to newsgroup GROUP."
+  (let ((b (text-property-any (point-min) (point-max) 
+                             'gnus-group (intern group))))
+    (and b (goto-char b))))
+
 (defun gnus-group-next-group (n)
   "Go to next N'th newsgroup.
 If N is negative, search backward instead.
@@ -3365,10 +3588,11 @@ made."
   (let ((backward (< n 0))
        (n (abs n)))
     (while (and (> n 0)
-               (gnus-group-search-forward backward all level))
+               (gnus-group-search-forward 
+                backward (or (not gnus-group-goto-unread) all) level))
       (setq n (1- n)))
-    (if (/= 0 n) (message "No more%s newsgroups%s" (if all "" " unread")
-                         (if level " on this level or higher" "")))
+    (if (/= 0 n) (gnus-message 7 "No more%s newsgroups%s" (if all "" " unread")
+                              (if level " on this level or higher" "")))
     n))
 
 (defun gnus-group-prev-group (n)
@@ -3407,7 +3631,7 @@ done."
 If EXCLUDE-GROUP, do not go to that group."
   (interactive)
   (goto-char (point-min))
-  (let ((best 10)
+  (let ((best 100000)
        unread best-point)
     (while (setq unread (get-text-property (point) 'gnus-unread))
       (if (and (numberp unread) (> unread 0))
@@ -3428,13 +3652,15 @@ If EXCLUDE-GROUP, do not go to that group."
   "Go to the first group with unread articles."
   (interactive)
   (goto-char (point-min))
-  (gnus-group-next-unread-group 1))
+  (or (not (zerop (or (get-text-property (point) 'gnus-unread) 0)))
+      (gnus-group-next-unread-group 1))
+  (gnus-group-position-cursor))
 
 (defun gnus-group-enter-server-mode ()
   "Jump to the server buffer."
   (interactive)
   (gnus-server-setup-buffer)
-  (switch-to-buffer gnus-server-buffer)
+  (gnus-configure-windows 'server)
   (gnus-server-prepare))
 
 (defun gnus-group-make-group (name method address)
@@ -3459,11 +3685,12 @@ ADDRESS."
   (let* ((meth (if address (list (intern method) address) method))
         (nname (gnus-group-prefixed-name name meth))
         info)
-    (and (gnus-gethash nname gnus-active-hashtb)
+    (and (gnus-gethash nname gnus-newsrc-hashtb)
         (error "Group %s already exists" nname))
     (gnus-group-change-level 
-     (setq info (list t nname 3 nil nil meth))
-     3 9 (gnus-gethash (or (gnus-group-group-name) "dummy.group")
+     (setq info (list t nname gnus-level-default-subscribed nil nil meth))
+     gnus-level-default-subscribed gnus-level-killed 
+     (gnus-gethash (or (gnus-group-group-name) "dummy.group")
                       gnus-newsrc-hashtb) t)
     (gnus-sethash nname '(0 . 0) gnus-active-hashtb)
     (gnus-dribble-enter 
@@ -3473,21 +3700,39 @@ ADDRESS."
     (and (gnus-check-backend-function 'request-create-group nname)
         (gnus-request-create-group nname))))
 
-(defun gnus-group-edit-group (group)
+(defun gnus-group-edit-group (group &optional part)
   "Edit the group on the current line."
   (interactive (list (gnus-group-group-name)))
-  (let (info)
+  (let ((done-func '(lambda () 
+                     "Exit editing mode and update the information."
+                     (interactive)
+                     (gnus-group-edit-group-done 'part 'group)))
+       (part (or part 'info))
+       (winconf (current-window-configuration))
+       info)
     (if group (setq info (nth 2 (gnus-gethash group gnus-newsrc-hashtb)))
       (error "No group on current line"))
-    (setq gnus-winconf-edit-group (current-window-configuration))
-    (pop-to-buffer (get-buffer-create gnus-group-edit-buffer))
+    (set-buffer (get-buffer-create gnus-group-edit-buffer))
+    (gnus-configure-windows 'edit-group)
     (gnus-add-current-to-buffer-list)
     (emacs-lisp-mode)
     ;; Suggested by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
     (use-local-map (copy-keymap emacs-lisp-mode-map))
-    (local-set-key "\C-c\C-c" 'gnus-group-edit-group-done)
+    (local-set-key "\C-c\C-c" done-func)
+    (make-local-variable 'gnus-prev-winconf)
+    (setq gnus-prev-winconf winconf)
+    ;; We modify the func to let it know what part it is editing.
+    (setcar (cdr (nth 4 done-func)) (list 'quote part))
+    (setcar (cdr (cdr (nth 4 done-func))) group)
     (erase-buffer)
-    (insert ";; Type `C-c C-c' after you have edited the newsgroup entry.\n\n")
+    (insert
+     (cond 
+      ((eq part 'method)
+       ";; Type `C-c C-c' after editing the select method.\n\n")
+      ((eq part 'params)
+       ";; Type `C-c C-c' after editing the group parameters.\n\n")
+      ((eq part 'info)
+       ";; 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)))
@@ -3499,20 +3744,40 @@ ADDRESS."
              (setcdr (car marked) 
                      (gnus-compress-sequence (sort (cdr (car marked)) '<) t)))
          (setq marked (cdr marked))))
-      (insert (pp-to-string (list 'gnus-group-set-info
-                                 (list 'quote cinfo)))))))
+      (insert 
+       (pp-to-string
+       (cond ((eq part 'method)
+              (or (nth 4 info) "native"))
+             ((eq part 'params)
+              (nth 5 info))
+             (t
+              cinfo)))
+       "\n"))))
 
-(defun gnus-group-edit-group-done ()
-  (interactive)
+(defun gnus-group-edit-group-method (group)
+  "Edit the select method of GROUP."
+  (interactive (list (gnus-group-group-name)))
+  (gnus-group-edit-group group 'method))
+
+(defun gnus-group-edit-group-parameters (group)
+  "Edit the group parameters of GROUP."
+  (interactive (list (gnus-group-group-name)))
+  (gnus-group-edit-group group 'params))
+
+(defun gnus-group-edit-group-done (part group)
+  "Get info from buffer, update variables and jump to the group buffer."
   (set-buffer (get-buffer-create gnus-group-edit-buffer))
-  (eval-current-buffer)
-  (kill-buffer (current-buffer))
-  (and gnus-winconf-edit-group
-       (set-window-configuration gnus-winconf-edit-group))
-  (setq gnus-winconf-edit-group nil)
-  (set-buffer gnus-group-buffer)
-  (gnus-group-update-group (gnus-group-group-name))
-  (gnus-group-position-cursor))
+  (goto-char (point-min))
+  (let ((form (read (current-buffer)))
+       (winconf gnus-prev-winconf))
+    (if (eq part 'info) 
+       (gnus-group-set-info form)
+      (gnus-group-set-info form group part))
+    (kill-buffer (current-buffer))
+    (and winconf (set-window-configuration winconf))
+    (set-buffer gnus-group-buffer)
+    (gnus-group-update-group (gnus-group-group-name))
+    (gnus-group-position-cursor)))
 
 (defun gnus-group-make-help-group ()
   "Create the (ding) Gnus documentation group."
@@ -3570,33 +3835,47 @@ score file entries for articles to include in the group."
        (while (not (equal "" (setq regexp (read-string 
                                            (format "Match on %s (string): "
                                                    header)))))
-         (setq regexps (cons (list regexp nil 1000 nil) regexps)))
+         (setq regexps (cons (list regexp nil nil 'r) regexps)))
        (setq scores (cons (cons header regexps) scores)))
-      (car scores))))
+      scores)))
   (gnus-group-make-group group "nnkiboze" address)
   (save-excursion
-    (set-buffer (get-buffer-create " *gnus work*"))
-    (buffer-disable-undo (current-buffer))
+    (gnus-set-work-buffer)
     (let (emacs-lisp-mode-hook)
-      (pp (list 'setq 'gnus-score-alist 
-               (list 'quote (list scores)))
-         (current-buffer)))
+      (pp scores (current-buffer)))
     (write-region (point-min) (point-max) 
                  (concat (or gnus-kill-files-directory "~/News")
-                         "nnkiboze:" group "." gnus-score-file-suffix))
-    (kill-buffer (current-buffer)))
+                         "nnkiboze:" group "." gnus-score-file-suffix)))
   (gnus-group-position-cursor))
 
+(defun gnus-group-add-to-virtual (n vgroup)
+  "Add the current group to a virtual group."
+  (interactive
+   (list current-prefix-arg
+        (completing-read "Add to virtual group: " gnus-newsrc-hashtb nil t)))
+  (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)))))
+    (setcar (cdr method)
+           (concat 
+            (nth 1 method) "\\|"
+            (mapconcat 
+             (lambda (s) 
+               (gnus-group-remove-mark s)
+               (concat "\\(^" (regexp-quote s) "$\\)"))
+             groups "\\|")))))
+
 ;; Group sorting commands
 ;; Suggested by Joe Hildebrand <hildjj@idaho.fuentez.com>.
 
 (defun gnus-group-sort-groups ()
   "Sort the group buffer using `gnus-group-sort-function'."
   (interactive)
-  (setq gnus-newsrc-assoc 
-       (sort (cdr gnus-newsrc-assoc) gnus-group-sort-function))
+  (setq gnus-newsrc-alist 
+       (sort (cdr gnus-newsrc-alist) gnus-group-sort-function))
   (gnus-make-hashtable-from-newsrc-alist)
-  (gnus-get-unread-articles 6)
+  (gnus-get-unread-articles (1+ gnus-level-subscribed))
   (gnus-group-list-groups nil))
 
 (defun gnus-group-sort-by-alphabet (info1 info2)
@@ -3620,28 +3899,30 @@ 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")
-  (if (or (not gnus-interactive-catchup) ;Without confirmation?
-         gnus-expert-user
-         (gnus-y-or-n-p
-          (if all
-              "Do you really want to mark all articles as read? "
-            "Mark all unread articles as read? ")))
-      (progn
-       (while 
-           (and (> n 0)
-                (progn
-                  (setq n (1- n))
-                  (gnus-group-catchup (gnus-group-group-name) all)
-                  (gnus-group-update-group-line)
-                  t)
-                (zerop (gnus-group-next-unread-group 1))))))
-  n)
+  (interactive "P")
+  (if (not (or (not gnus-interactive-catchup) ;Without confirmation?
+              gnus-expert-user
+              (gnus-y-or-n-p
+               (if all
+                   "Do you really want to mark all articles as read? "
+                 "Mark all unread articles as read? "))))
+      n
+    (let ((groups (gnus-group-process-prefix n))
+         (ret 0))
+      (while groups
+       (gnus-group-remove-mark (car groups))
+       (if (not (gnus-group-goto-group (car groups)))
+           (setq ret (1+ ret))
+         (gnus-group-catchup (car groups) all)
+         (gnus-group-update-group-line))
+       (setq groups (cdr groups)))
+      (gnus-group-next-unread-group 1)
+      ret)))
 
 (defun gnus-group-catchup-current-all (n)
   "Mark all articles in current newsgroup as read.
 Cross references (Xref: header) of articles are ignored."
-  (interactive "p")
+  (interactive "P")
   (gnus-group-catchup-current n 'all))
 
 (defun gnus-group-catchup (group &optional all)
@@ -3654,7 +3935,7 @@ or nil if no action could be taken."
         (marked (nth 3 (nth 2 entry)))
         ticked)
     (if (not (numberp (car entry)))
-       (message "Can't catch up; non-active group")
+       (gnus-message 1 "Can't catch up; non-active group")
       ;; Do the updating only if the newsgroup isn't killed
       (if entry
          (progn
@@ -3665,46 +3946,52 @@ or nil if no action could be taken."
                        (delq (assq 'dormant marked) marked))))))
     num))
 
-(defun gnus-group-expire-articles (newsgroup)
+(defun gnus-group-expire-articles (n)
   "Expire all expirable articles in the current newsgroup."
-  (interactive (list (gnus-group-group-name)))
-  (if (not newsgroup) (error "No current newsgroup"))
-  (let ((expirable 
-        (assq 'expire (nth 3 (nth 2 (gnus-gethash newsgroup 
-                                                  gnus-newsrc-hashtb))))))
- (and expirable 
-      (gnus-check-backend-function 'request-expire-articles newsgroup)
-      (setcdr expirable
-             (gnus-request-expire-articles (cdr expirable) newsgroup)))))
+  (interactive "P")
+  (let ((groups (gnus-group-process-prefix n))
+       group)
+    (or groups (error "No groups to expire"))
+    (while groups
+      (setq group (car groups)
+           groups (cdr groups))
+      (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)))
+              (expirable (if (memq 'total-expire (nth 5 info))
+                             (cons nil (gnus-list-of-read-articles group))
+                           (assq 'expire (nth 3 info)))))
+         (and expirable 
+              (setcdr expirable
+                      (gnus-request-expire-articles 
+                       (cdr expirable) group))))))))
 
 (defun gnus-group-expire-all-groups ()
   "Expire all expirable articles in all newsgroups."
   (interactive)
-  (message "Expiring...")
-  (let ((newsrc (cdr gnus-newsrc-assoc)))
-    (while newsrc
-      (gnus-group-expire-articles (car (car newsrc)))
-      (setq newsrc (cdr newsrc))))
-  (message "Expiring...done"))
-
-(defun gnus-group-set-current-level (n)
-  "Set the level of the current group to the numeric prefix."
-  (interactive "P")
-  (setq n (or n (string-to-int 
-                (completing-read 
-                 "Level: " 
-                 (mapcar (lambda (n) (list (char-to-string n))) "123456789")
-                 nil t))))
-  (let ((group (gnus-group-group-name)))
-    (if (not group) (error "No newsgroup on current line.")
-    (if (and (numberp n) (>= n 1) (<= n 9))
-       (progn
-         (message "Changed level of %s from %d to %d" 
-                  group (gnus-group-group-level) n)
-         (gnus-group-change-level group n (gnus-group-group-level))
-         (gnus-group-update-group-line))
-      (error "Illegal level: %s" n))))
-  (forward-line 1)
+  (gnus-message 5 "Expiring...")
+  (let ((gnus-group-marked (mapcar (lambda (info) (car info))
+                                  (cdr gnus-newsrc-alist))))
+    (gnus-group-expire-articles nil))
+  (gnus-message 5 "Expiring...done"))
+
+(defun gnus-group-set-current-level (n level)
+  "Set the level of the next N groups to LEVEL."
+  (interactive "P\nnLevel: ")
+  (or (and (>= level 1) (<= level gnus-level-killed))
+      (error "Illegal level: %d" level))
+  (let ((groups (gnus-group-process-prefix n))
+       group)
+    (while groups
+      (setq group (car groups)
+           groups (cdr groups))
+      (gnus-group-remove-mark group)
+      (gnus-message 6 "Changed level of %s from %d to %d" 
+                   group (gnus-group-group-level) level)
+      (gnus-group-change-level group level
+                              (gnus-group-group-level))
+      (gnus-group-update-group-line)))
   (gnus-group-position-cursor))
 
 (defun gnus-group-unsubscribe-current-group (arg)
@@ -3712,7 +3999,9 @@ or nil if no action could be taken."
   (interactive "P")
   (let ((group (gnus-group-group-name)))
     (or group (error "No newsgroup on current line"))
-    (or arg (setq arg (if (<= (gnus-group-group-level) 5) 6 3)))
+    (or arg (setq arg (if (<= (gnus-group-group-level) gnus-level-subscribed)
+                         gnus-level-default-unsubscribed
+                       gnus-level-default-subscribed)))
     (gnus-group-unsubscribe-group group arg)
     (gnus-group-next-group 1)))
 
@@ -3726,7 +4015,10 @@ New newsgroup is added to .newsrc automatically."
     (cond (newsrc
           ;; Toggle subscription flag.
           (gnus-group-change-level 
-           newsrc (if level level (if (< (nth 1 (nth 2 newsrc)) 6) 6 4)))
+           newsrc (if level level (if (<= (nth 1 (nth 2 newsrc)) 
+                                          gnus-level-subscribed) 
+                                      (1+ gnus-level-subscribed)
+                                    gnus-level-default-subscribed)))
           (gnus-group-update-group group))
          ((and (stringp group)
                (or (not gnus-have-read-active-file)
@@ -3734,38 +4026,35 @@ New newsgroup is added to .newsrc automatically."
           ;; Add new newsgroup.
           (gnus-group-change-level 
            group 
-           (if level level 3
-           (or (and (member group gnus-zombie-list) 8) 9)
-           (or (and (gnus-group-group-name)
-                    (gnus-gethash (gnus-group-group-name) gnus-newsrc-hashtb))
-               (gnus-gethash (car (car gnus-newsrc-assoc)) 
-                             gnus-newsrc-hashtb)))
+           (if level level gnus-level-default-subscribed
+           (or (and (member group gnus-zombie-list) 
+                    gnus-level-zombie) 
+               gnus-level-killed)
+           (and (gnus-group-group-name)
+                (gnus-gethash (gnus-group-group-name) gnus-newsrc-hashtb)))
           (gnus-group-update-group group))
          (t (error "No such newsgroup: %s" group)))
     (gnus-group-position-cursor)))
 
-(defun gnus-group-transpose-groups (arg)
-  "Exchange current newsgroup and previous newsgroup.
-With argument ARG, takes previous newsgroup and moves it past ARG newsgroup."
+(defun gnus-group-transpose-groups (n)
+  "Move the current newsgroup up N places.
+If given a negative prefix, move down instead. The difference between
+N and the number of steps taken is retured." 
   (interactive "p")
-  ;; BUG: last newsgroup and the last but one cannot be transposed
-  ;; since gnus-group-search-forward does not move forward beyond the
-  ;; last.  If we instead use forward-line, no problem, but I don't
-  ;; want to use it for later extension.
-  (while (> arg 0)
-    (gnus-group-search-forward t t)
-    (gnus-group-kill-group 1)
-    (gnus-group-search-forward nil t)
+  (or (gnus-group-group-name)
+      (error "No group on current line"))
+  (gnus-group-kill-group 1)
+  (prog1
+      (forward-line (- n))
     (gnus-group-yank-group)
-    (gnus-group-search-forward nil t)
-    (setq arg (1- arg))))
+    (gnus-group-position-cursor)))
 
 (defun gnus-group-kill-all-zombies ()
   "Kill all zombie newsgroups."
   (interactive)
   (setq gnus-killed-list (nconc gnus-zombie-list gnus-killed-list))
   (setq gnus-zombie-list nil)
-  (funcall gnus-group-prepare-function 5 nil nil)
+  (funcall gnus-group-prepare-function gnus-level-subscribed nil nil)
   (goto-char (point-min))
   (gnus-group-position-cursor))
 
@@ -3796,24 +4085,23 @@ The killed newsgroups can be yanked by using \\[gnus-group-yank-group]."
 The killed newsgroups can be yanked by using \\[gnus-group-yank-group].
 However, only groups that were alive can be yanked; already killed 
 groups or zombie groups can't be yanked.
-The return value is the name of the (last) newsgroup that was killed."
-  (interactive "p")
+The return value is the name of the (last) group that was killed."
+  (interactive "P")
   (let ((buffer-read-only nil)
+       (groups (gnus-group-process-prefix n))
        group entry level)
-    (while (>= (setq n  (1- n)) 0)
-      (setq group (gnus-group-group-name))
-      (or group
-         (signal 'end-of-buffer nil))
+    (while groups
+      (setq group (car groups)
+           groups (cdr groups))
+      (gnus-group-remove-mark group)
       (setq level (gnus-group-group-level))
-      (beginning-of-line)
-      (delete-region (point) (progn (forward-line 1) (point)))
+      (gnus-delete-line)
       (if (setq entry (gnus-gethash group gnus-newsrc-hashtb))
          (setq gnus-list-of-killed-groups 
                (cons (cons (car entry) (nth 2 entry)) 
                      gnus-list-of-killed-groups)))
-      (gnus-group-change-level (if entry entry group) 9 (if entry nil level)))
-    (if (eobp)
-       (forward-line -1))
+      (gnus-group-change-level 
+       (if entry entry group) gnus-level-killed (if entry nil level)))
     (gnus-group-position-cursor)
     group))
 
@@ -3833,13 +4121,10 @@ newsgroup yanked is returned."
       ;; backward until something suitable is found. If there are no
       ;; other newsgroups in this buffer, just make this newsgroup the
       ;; first newsgroup.
-      (while (and (not (setq prev (gnus-group-group-name)))
-                 (zerop (forward-line -1))))
-      (if (not prev)
-         (setq prev (car (car gnus-newsrc-assoc))))
+      (setq prev (gnus-group-group-name))
       (gnus-group-change-level 
-       info (nth 2 info) 9 
-       (gnus-gethash prev gnus-newsrc-hashtb)
+       info (nth 2 info) gnus-level-killed 
+       (and prev (gnus-gethash prev gnus-newsrc-hashtb))
        t)
       (gnus-group-insert-group-line-info (nth 1 info))
       (setq gnus-list-of-killed-groups 
@@ -3850,17 +4135,18 @@ newsgroup yanked is returned."
       
 (defun gnus-group-list-all-groups (arg)
   "List all newsgroups with level ARG or lower.
-Default is 7, which lists all subscribed and most unsubscribed groups."
+Default is gnus-level-unsubscribed, which lists all subscribed and most
+unsubscribed groups."
   (interactive "P")
-  (setq arg (or arg 7))
+  (setq arg (or arg gnus-level-unsubscribed))
   (gnus-group-list-groups arg t))
 
 (defun gnus-group-list-killed ()
   "List all killed newsgroups in the group buffer."
   (interactive)
   (if (not gnus-killed-list)
-      (message "No killed groups")
-    (funcall gnus-group-prepare-function 9 t 9)
+      (gnus-message 6 "No killed groups")
+    (funcall gnus-group-prepare-function gnus-level-killed t gnus-level-killed)
     (goto-char (point-min)))
   (gnus-group-position-cursor))
 
@@ -3868,8 +4154,8 @@ Default is 7, which lists all subscribed and most unsubscribed groups."
   "List all zombie newsgroups in the group buffer."
   (interactive)
   (if (not gnus-zombie-list)
-      (message "No zombie groups")
-    (funcall gnus-group-prepare-function 8 t 8)
+      (gnus-message 6 "No zombie groups")
+    (funcall gnus-group-prepare-function gnus-level-zombie t gnus-level-zombie)
     (goto-char (point-min)))
   (gnus-group-position-cursor))
 
@@ -3879,40 +4165,42 @@ If ARG is non-nil, it should be a number between one and nine to
 specify which levels you are interested in re-scanning."
   (interactive "P")
   (run-hooks 'gnus-get-new-news-hook)
-  (if (and gnus-read-active-file (not arg))
-      (progn
-       (gnus-read-active-file)
-       (gnus-get-unread-articles (or arg 6)))
-    (let ((gnus-read-active-file nil))
-      (gnus-get-unread-articles (or arg 6))))
-  (gnus-group-list-groups nil gnus-have-all-newsgroups))
+  (let ((level arg))
+    (if (and gnus-read-active-file (not level))
+       (progn
+         (gnus-read-active-file)
+         (gnus-get-unread-articles (or level (1+ gnus-level-subscribed))))
+      (let ((gnus-read-active-file nil))
+       (gnus-get-unread-articles (or level (1+ gnus-level-subscribed)))))
+    (gnus-group-list-groups 
+     (or gnus-group-always-list-unread level gnus-level-subscribed)
+     gnus-have-all-newsgroups)))
 
 (defun gnus-group-get-new-news-this-group (n)
   "Check for newly arrived news in the current group (and the N-1 next groups).
 The difference between N and the number of newsgroup checked is returned.
 If N is negative, this group and the N-1 previous groups will be checked."
-  (interactive "p")
-  (let ((way (if (< n 0) -1 1))
-       (n (abs n))
-       (w-p (window-start))
-       group)
-    (while (and (> n 0)
-               (progn
-                 (or (gnus-get-new-news-in-group
-                      (setq group (gnus-group-group-name)))
-                     (progn 
-                       (ding) 
-                       (message "%s error: %s" 
-                                group (gnus-status-message group))))
-                 t)
-               (zerop (gnus-group-next-group way)))
-      (setq n (1- n)))
-    (if (/= 0 n) (message "No more newsgroups"))
+  (interactive "P")
+  (let* ((groups (gnus-group-process-prefix n))
+        (ret (if (numberp n) (- n (length groups)) 0))
+        (w-p (window-start))
+        group)
+    (while groups
+      (setq group (car groups)
+           groups (cdr groups))
+      (gnus-group-remove-mark group)
+      (or (gnus-get-new-news-in-group group)
+         (progn 
+           (ding) 
+           (message "%s error: %s" group (gnus-status-message group))
+           (sit-for 2))))
     ;; !!! I don't know why the buffer scrolls forward when updating
     ;; the first line in the group buffer, but it does. So we set the
     ;; window start forcibly.
-    (set-window-start (get-buffer-window (current-buffer)) w-p)
-    n))
+;    (set-window-start (get-buffer-window (current-buffer)) w-p)
+    (forward-line 1)
+    (gnus-summary-position-cursor)
+    ret))
 
 (defun gnus-get-new-news-in-group (group)
   (and group 
@@ -3926,7 +4214,7 @@ If N is negative, this group and the N-1 previous groups will be checked."
 
 (defun gnus-group-fetch-faq (group)
   "Fetch the FAQ for the current group."
-  (interactive (list (gnus-group-group-name)))
+  (interactive (list (gnus-group-real-name (gnus-group-group-name))))
   (or group (error "No group name given"))
   (let ((file (concat gnus-group-faq-directory group))) 
     (if (not (file-exists-p file))
@@ -3939,7 +4227,7 @@ If N is negative, this group and the N-1 previous groups will be checked."
   (and force (setq gnus-description-hashtb nil))
   (let ((group (or group (gnus-group-group-name)))
        desc)
-    (or group (message "No group name given"))
+    (or group (error "No group name given"))
     (and (or gnus-description-hashtb
             (setq desc (gnus-group-get-description group))
             (gnus-read-descriptions-file))
@@ -3965,7 +4253,8 @@ If N is negative, this group and the N-1 previous groups will be checked."
                       (symbol-value group)))
        (add-text-properties 
        b (1+ b) (list 'gnus-group group
-                      'gnus-unread t 'gnus-marked nil 'gnus-level 6)))
+                      'gnus-unread t 'gnus-marked nil
+                      'gnus-level (1+ gnus-level-subscribed))))
      gnus-description-hashtb)
     (goto-char (point-min))
     (gnus-group-position-cursor)))
@@ -3992,10 +4281,10 @@ If N is negative, this group and the N-1 previous groups will be checked."
                (setq groups (cons (symbol-name group) groups))))
         gnus-description-hashtb))
     (if (not groups)
-       (message "No groups matched \"%s\"." regexp)
+       (gnus-message 3 "No groups matched \"%s\"." regexp)
       ;; Print out all the groups.
       (save-excursion
-       (pop-to-buffer (get-buffer-create "*Gnus Help*"))
+       (pop-to-buffer "*Gnus Help*")
        (buffer-disable-undo (current-buffer))
        (erase-buffer)
        (setq groups (sort groups 'string<))
@@ -4009,7 +4298,7 @@ If N is negative, this group and the N-1 previous groups will be checked."
                                                 gnus-description-hashtb)))
                    (insert "  " des "\n"))))
          (setq groups (cdr groups)))
-       (goto-char 1)))
+       (goto-char (point-min))))
     (pop-to-buffer obuf)))
 
 (defun gnus-group-description-apropos (regexp)
@@ -4028,7 +4317,8 @@ level to cut off listing groups.
 If ALL, also list groups with no unread articles.
 If LOWEST, don't list groups with level lower than LOWEST."
   (interactive "P\nsList newsgroups matching: ")
-  (gnus-group-prepare-flat (or level 5) all (or lowest 1) regexp)
+  (gnus-group-prepare-flat (or level gnus-level-subscribed)
+                          all (or lowest 1) regexp)
   (goto-char (point-min))
   (gnus-group-position-cursor))
 
@@ -4038,7 +4328,7 @@ If the prefix LEVEL is non-nil, it should be a number that says which
 level to cut off listing groups. 
 If LOWEST, don't list groups with level lower than LOWEST."
   (interactive "P\nsList newsgroups matching: ")
-  (gnus-group-list-matching (or level 9) regexp t lowest))
+  (gnus-group-list-matching (or level gnus-level-killed) regexp t lowest))
 
 ;; Suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>.
 (defun gnus-group-save-newsrc ()
@@ -4075,7 +4365,7 @@ If GROUP, edit that local kill file instead."
   (interactive "P")
   (setq gnus-current-kill-article article)
   (gnus-kill-file-edit-file group)
-  (message
+  (gnus-message 6
    (substitute-command-keys
     "Editing a global kill file (Type \\[gnus-kill-file-exit] to exit)")))
 
@@ -4097,16 +4387,18 @@ The hook gnus-suspend-gnus-hook is called before actually suspending."
   (run-hooks 'gnus-suspend-gnus-hook)
   ;; Kill Gnus buffers except for group mode buffer.
   (let ((group-buf (get-buffer gnus-group-buffer)))
-    (while gnus-buffer-list
-      (and (not (eq (get-buffer (car gnus-buffer-list)) group-buf))
-          (not (eq (get-buffer (car gnus-buffer-list)) gnus-dribble-buffer))
-          (get-buffer (car gnus-buffer-list))
-          (buffer-name (get-buffer (car gnus-buffer-list)))
-          (kill-buffer (car gnus-buffer-list)))
-      (setq gnus-buffer-list (cdr gnus-buffer-list)))
-    (setq gnus-buffer-list (list group-buf))
-    (bury-buffer group-buf)
-    (delete-windows-on group-buf t)))
+    ;; Do this on a separate list in case the user does a ^G before we finish
+    (let ((gnus-buffer-list
+          (delq group-buf (delq gnus-dribble-buffer
+                                (append gnus-buffer-list nil)))))
+      (while gnus-buffer-list
+       (gnus-kill-buffer (car gnus-buffer-list))
+       (setq gnus-buffer-list (cdr gnus-buffer-list))))
+    (if group-buf
+       (progn
+         (setq gnus-buffer-list (list group-buf))
+         (bury-buffer group-buf)
+         (delete-windows-on group-buf t)))))
 
 (defun gnus-group-clear-dribble ()
   "Clear all information from the dribble buffer."
@@ -4160,7 +4452,7 @@ The hook `gnus-exit-gnus-hook' is called before actually exiting."
 (defun gnus-group-describe-briefly ()
   "Give a one line description of the group mode commands."
   (interactive)
-  (message
+  (gnus-message 6
    (substitute-command-keys "\\<gnus-group-mode-map>\\[gnus-group-read-group]:Select  \\[gnus-group-next-unread-group]:Forward  \\[gnus-group-prev-unread-group]:Backward  \\[gnus-group-exit]:Exit  \\[gnus-info-find-node]:Run Info  \\[gnus-group-describe-briefly]:This help")))
 
 (defun gnus-group-browse-foreign-server (method)
@@ -4170,14 +4462,21 @@ If called interactively, this function will ask for a select method
 If not, METHOD should be a list where the first element is the method
 and the second element is the address."
   (interactive
-   (list (list (intern (completing-read 
-                       "Select method: "
-                       gnus-valid-select-methods nil t "nntp"))
-              ;; Suggested by mapjph@bath.ac.uk.
-              (completing-read 
-               "Server name: " 
-               (mapcar (lambda (server) (list server))
-                       gnus-secondary-servers)))))
+   (list (let ((how (completing-read 
+                    "Which backend: "
+                    (append gnus-valid-select-methods gnus-server-alist)
+                    nil t "nntp")))
+          ;; We either got a backend name or a virtual server name.
+          ;; If the first, we also need an address.
+          (if (assoc how gnus-valid-select-methods)
+              (list (intern how)
+                    ;; Suggested by mapjph@bath.ac.uk.
+                    (completing-read 
+                     "Address: " 
+                     (mapcar (lambda (server) (list server))
+                             gnus-secondary-servers)))
+            ;; We got a server name, so we find the method.
+            (gnus-server-to-method how)))))
   (gnus-browse-foreign-server method))
 
 \f
@@ -4185,66 +4484,73 @@ and the second element is the address."
 ;;; Browse Server Mode
 ;;;
 
-(defvar gnus-browse-server-mode-hook nil)
-(defvar gnus-browse-server-mode-map nil)
-(put 'gnus-browse-server-mode 'mode-class 'special)
+(defvar gnus-browse-mode-hook nil)
+(defvar gnus-browse-mode-map nil)
+(put 'gnus-browse-mode 'mode-class 'special)
 
-(if gnus-browse-server-mode-map
+(if gnus-browse-mode-map
     nil
-  (setq gnus-browse-server-mode-map (make-keymap))
-  (suppress-keymap gnus-browse-server-mode-map)
-  (define-key gnus-browse-server-mode-map " " 'gnus-browse-read-group)
-  (define-key gnus-browse-server-mode-map "=" 'gnus-browse-read-group)
-  (define-key gnus-browse-server-mode-map "n" 'gnus-browse-next-group)
-  (define-key gnus-browse-server-mode-map "p" 'gnus-browse-prev-group)
-  (define-key gnus-browse-server-mode-map "\177" 'gnus-browse-prev-group)
-  (define-key gnus-browse-server-mode-map "N" 'gnus-browse-next-group)
-  (define-key gnus-browse-server-mode-map "P" 'gnus-browse-prev-group)
-  (define-key gnus-browse-server-mode-map "\M-n" 'gnus-browse-next-group)
-  (define-key gnus-browse-server-mode-map "\M-p" 'gnus-browse-prev-group)
-  (define-key gnus-browse-server-mode-map "\r" 'gnus-browse-read-group)
-  (define-key gnus-browse-server-mode-map "u" 'gnus-browse-unsubscribe-current-group)
-  (define-key gnus-browse-server-mode-map "l" 'gnus-browse-exit)
-  (define-key gnus-browse-server-mode-map "L" 'gnus-browse-exit)
-  (define-key gnus-browse-server-mode-map "q" 'gnus-browse-exit)
-  (define-key gnus-browse-server-mode-map "Q" 'gnus-browse-exit)
-  (define-key gnus-browse-server-mode-map "\C-c\C-c" 'gnus-browse-exit)
-  (define-key gnus-browse-server-mode-map "?" 'gnus-browse-describe-briefly)
-  (define-key gnus-browse-server-mode-map "\C-c\C-i" 'gnus-info-find-node)
+  (setq gnus-browse-mode-map (make-keymap))
+  (suppress-keymap gnus-browse-mode-map)
+  (define-key gnus-browse-mode-map " " 'gnus-browse-read-group)
+  (define-key gnus-browse-mode-map "=" 'gnus-browse-read-group)
+  (define-key gnus-browse-mode-map "n" 'gnus-browse-next-group)
+  (define-key gnus-browse-mode-map "p" 'gnus-browse-prev-group)
+  (define-key gnus-browse-mode-map "\177" 'gnus-browse-prev-group)
+  (define-key gnus-browse-mode-map "N" 'gnus-browse-next-group)
+  (define-key gnus-browse-mode-map "P" 'gnus-browse-prev-group)
+  (define-key gnus-browse-mode-map "\M-n" 'gnus-browse-next-group)
+  (define-key gnus-browse-mode-map "\M-p" 'gnus-browse-prev-group)
+  (define-key gnus-browse-mode-map "\r" 'gnus-browse-read-group)
+  (define-key gnus-browse-mode-map "u" 'gnus-browse-unsubscribe-current-group)
+  (define-key gnus-browse-mode-map "l" 'gnus-browse-exit)
+  (define-key gnus-browse-mode-map "L" 'gnus-browse-exit)
+  (define-key gnus-browse-mode-map "q" 'gnus-browse-exit)
+  (define-key gnus-browse-mode-map "Q" 'gnus-browse-exit)
+  (define-key gnus-browse-mode-map "\C-c\C-c" 'gnus-browse-exit)
+  (define-key gnus-browse-mode-map "?" 'gnus-browse-describe-briefly)
+  (define-key gnus-browse-mode-map "\C-c\C-i" 'gnus-info-find-node)
   )
 
 (defvar gnus-browse-current-method nil)
+(defvar gnus-browse-return-buffer nil)
+
+(defvar gnus-browse-buffer "*Gnus Browse Server*")
 
-(defun gnus-browse-foreign-server (method)
+(defun gnus-browse-foreign-server (method &optional return-buffer)
   (setq gnus-browse-current-method method)
+  (setq gnus-browse-return-buffer return-buffer)
   (let ((gnus-select-method method)
        groups group)
-    (message "Connecting to %s..." (nth 1 method))
+    (gnus-message 5 "Connecting to %s..." (nth 1 method))
     (or (gnus-server-opened method)
        (gnus-open-server method)
        (error "Unable to contact server: %s" (gnus-status-message method)))
     (or (gnus-request-list method)
        (error "Couldn't request list: %s" (gnus-status-message method)))
-    (set-buffer (get-buffer-create "*Gnus Browse Server*"))
+    (get-buffer-create gnus-browse-buffer)
     (gnus-add-current-to-buffer-list)
+    (and gnus-carpal (gnus-carpal-setup-buffer 'browse))
+    (gnus-configure-windows 'browse)
     (buffer-disable-undo (current-buffer))
     (let ((buffer-read-only nil))
       (erase-buffer))
-    (gnus-browse-server-mode)
+    (gnus-browse-mode)
     (setq mode-line-buffer-identification
          (format
           "(ding) Browse Server {%s:%s}" (car method) (car (cdr method))))
     (save-excursion
       (set-buffer nntp-server-buffer)
       (let ((cur (current-buffer)))
-       (goto-char 1)
-       (delete-matching-lines gnus-ignored-newsgroups)
+       (goto-char (point-min))
+       (or (string= gnus-ignored-newsgroups "")
+           (delete-matching-lines gnus-ignored-newsgroups))
        (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))
-                                  (- (read cur) (read cur)))
+                                  (max 0 (- (1+ (read cur)) (read cur))))
                             groups)))))
     (setq groups (sort groups 
                       (lambda (l1 l2)
@@ -4256,26 +4562,27 @@ and the second element is the address."
         (format "K%7d: %s\n" (cdr group) (car group)))
        (setq groups (cdr groups))))
     (switch-to-buffer (current-buffer))
-    (goto-char 1)
+    (goto-char (point-min))
     (gnus-group-position-cursor)))
 
-(defun gnus-browse-server-mode ()
+(defun gnus-browse-mode ()
   "Major mode for browsing a foreign server."
   (interactive)
   (kill-all-local-variables)
+  (if gnus-visual (gnus-browse-make-menu-bar))
   (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-browse-server-mode)
+  (setq major-mode 'gnus-browse-mode)
   (setq mode-name "Browse Server")
   (setq mode-line-process nil)
-  (use-local-map gnus-browse-server-mode-map)
+  (use-local-map gnus-browse-mode-map)
   (buffer-disable-undo (current-buffer))
   (setq truncate-lines t)
   (setq buffer-read-only t)
-  (run-hooks 'gnus-browse-server-mode-hook))
+  (run-hooks 'gnus-browse-mode-hook))
 
 (defun gnus-browse-read-group ()
   "Not implemented, and will probably never be."
@@ -4307,7 +4614,7 @@ and the second element is the address."
                (zerop (gnus-browse-next-group ward)))
       (setq arg (1- arg)))
     (gnus-group-position-cursor)
-    (if (/= 0 arg) (message "No more newsgroups"))
+    (if (/= 0 arg) (gnus-message 7 "No more newsgroups"))
     arg))
   
 (defun gnus-browse-unsubscribe-group ()
@@ -4326,27 +4633,31 @@ and the second element is the address."
       (if sub
          (progn
            (gnus-group-change-level 
-            (list t group 3 nil nil gnus-browse-current-method) 3 9 
-            (gnus-gethash (car (nth 1 gnus-newsrc-assoc)) gnus-newsrc-hashtb)
+            (list t group gnus-level-default-subscribed
+                  nil nil gnus-browse-current-method) 
+            gnus-level-default-subscribed gnus-level-killed
+            (gnus-gethash (car (nth 1 gnus-newsrc-alist)) gnus-newsrc-hashtb)
             t)
            (insert ? ))
-       (gnus-group-change-level group 9 3)
+       (gnus-group-change-level 
+        group gnus-level-killed gnus-level-default-subscribed)
        (insert ?K)))
     t))
 
 (defun gnus-browse-exit ()
   "Quit browsing and return to the group buffer."
   (interactive)
-  (if (eq major-mode 'gnus-browse-server-mode)
+  (if (eq major-mode 'gnus-browse-mode)
       (kill-buffer (current-buffer)))
-  (switch-to-buffer gnus-group-buffer)
-  (gnus-group-list-groups nil))
+  (if gnus-browse-return-buffer
+      (gnus-configure-windows 'server)
+    (gnus-configure-windows 'group)))
 
 (defun gnus-browse-describe-briefly ()
   "Give a one line description of the group mode commands."
   (interactive)
-  (message
-   (substitute-command-keys "\\<gnus-browse-server-mode-map>\\[gnus-group-next-group]:Forward  \\[gnus-group-prev-group]:Backward  \\[gnus-browse-exit]:Exit  \\[gnus-info-find-node]:Run Info  \\[gnus-browse-describe-briefly]:This help")))
+  (gnus-message 6
+   (substitute-command-keys "\\<gnus-browse-mode-map>\\[gnus-group-next-group]:Forward  \\[gnus-group-prev-group]:Backward  \\[gnus-browse-exit]:Exit  \\[gnus-info-find-node]:Run Info  \\[gnus-browse-describe-briefly]:This help")))
       
 \f
 ;;;
@@ -4356,36 +4667,18 @@ and the second element is the address."
 (defvar gnus-summary-mode-map nil)
 (defvar gnus-summary-mark-map nil)
 (defvar gnus-summary-mscore-map nil)
-(defvar gnus-summary-send-map nil)
-(defvar gnus-summary-extract-map nil)
-(defvar gnus-summary-extract-view-map nil)
 (defvar gnus-summary-article-map nil)
 (defvar gnus-summary-thread-map nil)
 (defvar gnus-summary-goto-map nil)
 (defvar gnus-summary-exit-map nil)
 (defvar gnus-summary-various-map nil)
 (defvar gnus-summary-interest-map nil)
-(defvar gnus-summary-process-map nil)
-(defvar gnus-summary-score-map nil)
 (defvar gnus-summary-sort-map nil)
-(defvar gnus-summary-mgroup-map nil)
-(defvar gnus-summary-vsave-map nil)
-(defvar gnus-summary-increase-map nil)
-(defvar gnus-summary-inc-subject-map nil)
-(defvar gnus-summary-inc-author-map nil)
-(defvar gnus-summary-inc-body-map nil)
-(defvar gnus-summary-inc-id-map nil)
-(defvar gnus-summary-inc-xref-map nil)
-(defvar gnus-summary-inc-thread-map nil)
-(defvar gnus-summary-inc-fol-map nil)
-(defvar gnus-summary-lower-map nil)
-(defvar gnus-summary-low-subject-map nil)
-(defvar gnus-summary-low-author-map nil)
-(defvar gnus-summary-low-body-map nil)
-(defvar gnus-summary-low-id-map nil)
-(defvar gnus-summary-low-xref-map nil)
-(defvar gnus-summary-low-thread-map nil)
-(defvar gnus-summary-low-fol-map nil)
+(defvar gnus-summary-backend-map nil)
+(defvar gnus-summary-save-map nil)
+(defvar gnus-summary-wash-map nil)
+(defvar gnus-summary-help-map nil)
+
 (put 'gnus-summary-mode 'mode-class 'special)
 
 (if gnus-summary-mode-map
@@ -4470,8 +4763,7 @@ and the second element is the address."
   (define-key gnus-summary-mode-map "q" 'gnus-summary-exit)
   (define-key gnus-summary-mode-map "Q" 'gnus-summary-exit-no-update)
   (define-key gnus-summary-mode-map "\C-c\C-i" 'gnus-info-find-node)
-  (define-key gnus-summary-mode-map
-    (if gnus-xemacs [button2] [mouse-2]) 'gnus-mouse-pick-article)
+  (define-key gnus-summary-mode-map gnus-mouse-2 'gnus-mouse-pick-article)
   (define-key gnus-summary-mode-map "m" 'gnus-summary-mail-other-window)
   (define-key gnus-summary-mode-map "a" 'gnus-summary-post-news)
   (define-key gnus-summary-mode-map "x" 'gnus-summary-remove-lines-marked-as-read)
@@ -4519,35 +4811,9 @@ and the second element is the address."
   (define-key gnus-summary-mscore-map "m" 'gnus-summary-mark-above)
   (define-key gnus-summary-mscore-map "k" 'gnus-summary-kill-below)
 
-  (define-prefix-command 'gnus-summary-process-map)
-  (define-key gnus-summary-mark-map "p" 'gnus-summary-process-map)
-  (define-key gnus-summary-process-map "p" 'gnus-summary-mark-as-processable)
-  (define-key gnus-summary-process-map "u" 'gnus-summary-unmark-as-processable)
-  (define-key gnus-summary-process-map "U" 'gnus-summary-unmark-all-processable)
-  (define-key gnus-summary-process-map "s" 'gnus-uu-mark-series)
-  (define-key gnus-summary-process-map "r" 'gnus-uu-mark-region)
-  (define-key gnus-summary-process-map "R" 'gnus-uu-mark-by-regexp)
-  (define-key gnus-summary-process-map "t" 'gnus-uu-mark-thread)
-  (define-key gnus-summary-process-map "a" 'gnus-uu-mark-all)
-  (define-key gnus-summary-process-map "S" 'gnus-uu-mark-sparse)
+  (define-key gnus-summary-mark-map "p" 'gnus-uu-mark-map)
   
-
-  (define-prefix-command 'gnus-summary-send-map)
   (define-key gnus-summary-mode-map "S" 'gnus-summary-send-map)
-  (define-key gnus-summary-send-map "p" 'gnus-summary-post-news)
-  (define-key gnus-summary-send-map "f" 'gnus-summary-followup)
-  (define-key gnus-summary-send-map "F" 'gnus-summary-followup-with-original)
-  (define-key gnus-summary-send-map "b" 'gnus-summary-followup-and-reply)
-  (define-key gnus-summary-send-map "B" 'gnus-summary-followup-and-reply-with-original)
-  (define-key gnus-summary-send-map "c" 'gnus-summary-cancel-article)
-  (define-key gnus-summary-send-map "s" 'gnus-summary-supersede-article)
-  (define-key gnus-summary-send-map "r" 'gnus-summary-reply)
-  (define-key gnus-summary-send-map "R" 'gnus-summary-reply-with-original)
-  (define-key gnus-summary-send-map "\C-f" 'gnus-summary-mail-forward)
-  (define-key gnus-summary-send-map "m" 'gnus-summary-mail-other-window)
-  (define-key gnus-summary-send-map "u" 'gnus-uu-post-news)
-  (define-key gnus-summary-send-map "\M-f" 'gnus-uu-digest-and-forward)
-
   
   (define-prefix-command 'gnus-summary-goto-map)
   (define-key gnus-summary-mode-map "G" 'gnus-summary-goto-map)
@@ -4591,6 +4857,10 @@ and the second element is the address."
   (define-key gnus-summary-exit-map "Q" 'gnus-summary-exit)
   (define-key gnus-summary-exit-map "Z" 'gnus-summary-exit)
   (define-key gnus-summary-exit-map "n" 'gnus-summary-catchup-and-goto-next-group)
+  (define-key gnus-summary-exit-map "R" 'gnus-summary-reselect-current-group)
+  (define-key gnus-summary-exit-map "G" 'gnus-summary-rescan-group)
+  (define-key gnus-summary-exit-map "N" 'gnus-summary-next-group)
+  (define-key gnus-summary-exit-map "P" 'gnus-summary-prev-group)
 
 
   (define-prefix-command 'gnus-summary-article-map)
@@ -4610,42 +4880,63 @@ and the second element is the address."
   (define-key gnus-summary-article-map "c" 'gnus-summary-caesar-message)
   (define-key gnus-summary-article-map "g" 'gnus-summary-show-article)
   (define-key gnus-summary-article-map "t" 'gnus-summary-toggle-header)
-  (define-key gnus-summary-article-map "hh" 'gnus-article-hide-headers)
-  (define-key gnus-summary-article-map "hs" 'gnus-article-hide-signature)
-  (define-key gnus-summary-article-map "hc" 'gnus-article-hide-citation)
-  (define-key gnus-summary-article-map "ho" 'gnus-article-treat-overstrike)
-  (define-key gnus-summary-article-map "hw" 'gnus-article-word-wrap)
-  (define-key gnus-summary-article-map "hd" 'gnus-article-remove-cr)
-  (define-key gnus-summary-article-map "hq" 'gnus-article-de-quoted-unreadable)
-  (define-key gnus-summary-article-map "hf" 'gnus-article-display-x-face)
   (define-key gnus-summary-article-map "m" 'gnus-summary-toggle-mime)
   (define-key gnus-summary-article-map "s" 'gnus-summary-isearch-article)
 
 
-  (define-prefix-command 'gnus-summary-extract-map)
-  (define-key gnus-summary-mode-map "X" 'gnus-summary-extract-map)
-;  (define-key gnus-summary-extract-map "x" 'gnus-summary-extract-any)
-;  (define-key gnus-summary-extract-map "m" 'gnus-summary-extract-mime)
-  (define-key gnus-summary-extract-map "u" 'gnus-uu-decode-uu)
-  (define-key gnus-summary-extract-map "U" 'gnus-uu-decode-uu-and-save)
-  (define-key gnus-summary-extract-map "s" 'gnus-uu-decode-unshar)
-  (define-key gnus-summary-extract-map "S" 'gnus-uu-decode-unshar-and-save)
-  (define-key gnus-summary-extract-map "o" 'gnus-uu-decode-save)
-  (define-key gnus-summary-extract-map "O" 'gnus-uu-decode-save)
-  (define-key gnus-summary-extract-map "b" 'gnus-uu-decode-binhex)
-  (define-key gnus-summary-extract-map "B" 'gnus-uu-decode-binhex)
-
-  (define-prefix-command 'gnus-summary-extract-view-map)
-  (define-key gnus-summary-extract-map "v" 'gnus-summary-extract-view-map)
-  (define-key gnus-summary-extract-view-map "u" 'gnus-uu-decode-uu-view)
-  (define-key gnus-summary-extract-view-map "U" 'gnus-uu-decode-uu-and-save-view)
-  (define-key gnus-summary-extract-view-map "s" 'gnus-uu-decode-unshar-view)
-  (define-key gnus-summary-extract-view-map "S" 'gnus-uu-decode-unshar-and-save-view)
-  (define-key gnus-summary-extract-view-map "o" 'gnus-uu-decode-save-view)
-  (define-key gnus-summary-extract-view-map "O" 'gnus-uu-decode-save-view)
-  (define-key gnus-summary-extract-view-map "b" 'gnus-uu-decode-binhex-view)
-  (define-key gnus-summary-extract-view-map "B" 'gnus-uu-decode-binhex-view)
-  
+  (define-prefix-command 'gnus-summary-wash-map)
+  (define-key gnus-summary-mode-map "W" 'gnus-summary-wash-map)
+  (define-key gnus-summary-wash-map "h" 'gnus-article-hide-headers)
+  (define-key gnus-summary-wash-map "s" 'gnus-article-hide-signature)
+  (define-key gnus-summary-wash-map "c" 'gnus-article-hide-citation)
+  (define-key gnus-summary-wash-map "o" 'gnus-article-treat-overstrike)
+  (define-key gnus-summary-wash-map "w" 'gnus-article-word-wrap)
+  (define-key gnus-summary-wash-map "d" 'gnus-article-remove-cr)
+  (define-key gnus-summary-wash-map "q" 'gnus-article-de-quoted-unreadable)
+  (define-key gnus-summary-wash-map "f" 'gnus-article-display-x-face)
+  (define-key gnus-summary-wash-map "t" 'gnus-article-date-ut)
+  (define-key gnus-summary-wash-map "\C-t" 'gnus-article-date-local)
+  (define-key gnus-summary-wash-map "T" 'gnus-article-date-lapsed)
+
+  (define-key gnus-summary-wash-map "A" 'gnus-article-highlight)
+  (define-key gnus-summary-wash-map "a" 'gnus-article-hide)
+  (define-key gnus-summary-wash-map "H" 'gnus-article-highlight-headers)
+  (define-key gnus-summary-wash-map "C" 'gnus-article-highlight-citation)
+  (define-key gnus-summary-wash-map "S" 'gnus-article-highlight-signature)
+  (define-key gnus-summary-wash-map "b" 'gnus-article-add-buttons)
+
+
+  (define-prefix-command 'gnus-summary-help-map)
+  (define-key gnus-summary-mode-map "H" 'gnus-summary-help-map)
+  (define-key gnus-summary-help-map "v" 'gnus-version)
+  (define-key gnus-summary-help-map "f" 'gnus-summary-fetch-faq)
+  (define-key gnus-summary-help-map "d" 'gnus-summary-describe-group)
+  (define-key gnus-summary-help-map "h" 'gnus-summary-describe-briefly)
+  (define-key gnus-summary-help-map "i" 'gnus-info-find-node)
+
+
+  (define-prefix-command 'gnus-summary-backend-map)
+  (define-key gnus-summary-mode-map "B" 'gnus-summary-backend-map)
+  (define-key gnus-summary-backend-map "e" 'gnus-summary-expire-articles)
+  (define-key gnus-summary-backend-map "\177" 'gnus-summary-delete-article)
+  (define-key gnus-summary-backend-map "m" 'gnus-summary-move-article)
+  (define-key gnus-summary-backend-map "r" 'gnus-summary-respool-article)
+  (define-key gnus-summary-backend-map "w" 'gnus-summary-edit-article)
+  (define-key gnus-summary-backend-map "c" 'gnus-summary-copy-article)
+  (define-key gnus-summary-backend-map "q" 'gnus-summary-fancy-query)
+
+
+  (define-prefix-command 'gnus-summary-save-map)
+  (define-key gnus-summary-mode-map "O" 'gnus-summary-save-map)
+  (define-key gnus-summary-save-map "o" 'gnus-summary-save-article)
+  (define-key gnus-summary-save-map "m" 'gnus-summary-save-article-mail)
+  (define-key gnus-summary-save-map "r" 'gnus-summary-save-article-rmail)
+  (define-key gnus-summary-save-map "f" 'gnus-summary-save-article-file)
+  (define-key gnus-summary-save-map "h" 'gnus-summary-save-article-folder)
+  (define-key gnus-summary-save-map "v" 'gnus-summary-save-article-vm)
+  (define-key gnus-summary-save-map "p" 'gnus-summary-pipe-output)
+
+  (define-key gnus-summary-mode-map "X" 'gnus-uu-extract-map)
   
   (define-prefix-command 'gnus-summary-various-map)
   (define-key gnus-summary-mode-map "V" 'gnus-summary-various-map)
@@ -4656,34 +4947,11 @@ and the second element is the address."
   (define-key gnus-summary-various-map "&" 'gnus-summary-execute-command)
   (define-key gnus-summary-various-map "T" 'gnus-summary-toggle-truncation)
   (define-key gnus-summary-various-map "e" 'gnus-summary-expand-window)
-  (define-key gnus-summary-various-map "S" 'gnus-summary-reselect-current-group)
-  (define-key gnus-summary-various-map "g" 'gnus-summary-rescan-group)
-  (define-key gnus-summary-various-map "V" 'gnus-version)
-  (define-key gnus-summary-various-map "f" 'gnus-summary-fetch-faq)
-  (define-key gnus-summary-various-map "d" 'gnus-summary-describe-group)
-  (define-key gnus-summary-various-map "?" 'gnus-summary-describe-briefly)
-  (define-key gnus-summary-various-map "i" 'gnus-info-find-node)
   (define-key gnus-summary-various-map "D" 'gnus-summary-enter-digest-group)
   (define-key gnus-summary-various-map "k" 'gnus-summary-edit-local-kill)
   (define-key gnus-summary-various-map "K" 'gnus-summary-edit-global-kill)
 
-  (define-prefix-command 'gnus-summary-vsave-map)
-  (define-key gnus-summary-various-map "o" 'gnus-summary-vsave-map)
-  (define-key gnus-summary-vsave-map "o" 'gnus-summary-save-article)
-  (define-key gnus-summary-vsave-map "m" 'gnus-summary-save-article-mail)
-  (define-key gnus-summary-vsave-map "r" 'gnus-summary-save-article-rmail)
-  (define-key gnus-summary-vsave-map "f" 'gnus-summary-save-article-file)
-  (define-key gnus-summary-vsave-map "h" 'gnus-summary-save-article-folder)
-  (define-key gnus-summary-vsave-map "p" 'gnus-summary-pipe-output)
-
-  (define-prefix-command 'gnus-summary-score-map)
   (define-key gnus-summary-various-map "S" 'gnus-summary-score-map)
-  (define-key gnus-summary-score-map "s" 'gnus-summary-set-score)
-  (define-key gnus-summary-score-map "c" 'gnus-score-change-score-file)
-  (define-key gnus-summary-score-map "m" 'gnus-score-set-mark-below)
-  (define-key gnus-summary-score-map "x" 'gnus-score-set-expunge-below)
-  (define-key gnus-summary-score-map "e" 'gnus-score-edit-alist)
-  (define-key gnus-summary-score-map "f" 'gnus-score-edit-file)
 
   (define-prefix-command 'gnus-summary-sort-map)
   (define-key gnus-summary-various-map "s" 'gnus-summary-sort-map)
@@ -4693,139 +4961,8 @@ and the second element is the address."
   (define-key gnus-summary-sort-map "d" 'gnus-summary-sort-by-date)
   (define-key gnus-summary-sort-map "i" 'gnus-summary-sort-by-score)
 
-  (define-prefix-command 'gnus-summary-mgroup-map)
-  (define-key gnus-summary-various-map "m" 'gnus-summary-mgroup-map)
-  (define-key gnus-summary-mgroup-map "e" 'gnus-summary-expire-articles)
-  (define-key gnus-summary-mgroup-map "\177" 'gnus-summary-delete-article)
-  (define-key gnus-summary-mgroup-map "m" 'gnus-summary-move-article)
-  (define-key gnus-summary-mgroup-map "r" 'gnus-summary-respool-article)
-  (define-key gnus-summary-mgroup-map "w" 'gnus-summary-edit-article)
-  (define-key gnus-summary-mgroup-map "c" 'gnus-summary-copy-article)
-
-
-  (define-prefix-command 'gnus-summary-increase-map)
-  (define-key gnus-summary-mode-map "I" 'gnus-summary-increase-map)
-  (define-key gnus-summary-increase-map "i" 'gnus-summary-raise-same-subject-and-select)
-  (define-key gnus-summary-increase-map "I" 'gnus-summary-raise-same-subject)
-  (define-key gnus-summary-increase-map "\C-i" 'gnus-summary-raise-score)
-
-  (define-prefix-command 'gnus-summary-inc-subject-map)
-  (define-key gnus-summary-increase-map "s" 'gnus-summary-inc-subject-map)
-  (define-key gnus-summary-increase-map "S" 'gnus-summary-temporarily-raise-by-subject)
-  (define-key gnus-summary-inc-subject-map "s" 'gnus-summary-temporarily-raise-by-subject)
-  (define-key gnus-summary-inc-subject-map "S" 'gnus-summary-raise-by-subject)
-  (define-key gnus-summary-inc-subject-map "t" 'gnus-summary-temporarily-raise-by-subject)
-  (define-key gnus-summary-inc-subject-map "p" 'gnus-summary-raise-by-subject)
-
-  (define-prefix-command 'gnus-summary-inc-author-map)
-  (define-key gnus-summary-increase-map "a" 'gnus-summary-inc-author-map)
-  (define-key gnus-summary-increase-map "A" 'gnus-summary-temporarily-raise-by-author)
-  (define-key gnus-summary-inc-author-map "a" 'gnus-summary-temporarily-raise-by-author)
-  (define-key gnus-summary-inc-author-map "A" 'gnus-summary-raise-by-author)
-  (define-key gnus-summary-inc-author-map "t" 'gnus-summary-temporarily-raise-by-author)
-  (define-key gnus-summary-inc-author-map "p" 'gnus-summary-raise-by-author)
-
-  (define-prefix-command 'gnus-summary-inc-body-map)
-  (define-key gnus-summary-increase-map "b" 'gnus-summary-inc-body-map)
-  (define-key gnus-summary-increase-map "B" 'gnus-summary-temporarily-raise-by-body)
-  (define-key gnus-summary-inc-body-map "b" 'gnus-summary-temporarily-raise-by-body)
-  (define-key gnus-summary-inc-body-map "B" 'gnus-summary-raise-by-body)
-  (define-key gnus-summary-inc-body-map "t" 'gnus-summary-temporarily-raise-by-body)
-  (define-key gnus-summary-inc-body-map "p" 'gnus-summary-raise-by-body)
-
-  (define-prefix-command 'gnus-summary-inc-id-map)
-  (define-key gnus-summary-increase-map "i" 'gnus-summary-inc-id-map)
-  (define-key gnus-summary-increase-map "I" 'gnus-summary-temporarily-raise-by-id)
-  (define-key gnus-summary-inc-id-map "i" 'gnus-summary-temporarily-raise-by-id)
-  (define-key gnus-summary-inc-id-map "I" 'gnus-summary-raise-by-id)
-  (define-key gnus-summary-inc-id-map "t" 'gnus-summary-temporarily-raise-by-id)
-  (define-key gnus-summary-inc-id-map "p" 'gnus-summary-raise-by-id)
-
-  (define-prefix-command 'gnus-summary-inc-thread-map)
-  (define-key gnus-summary-increase-map "t" 'gnus-summary-inc-thread-map)
-  (define-key gnus-summary-increase-map "T" 'gnus-summary-temporarily-raise-by-thread)
-  (define-key gnus-summary-inc-thread-map "t" 'gnus-summary-temporarily-raise-by-thread)
-  (define-key gnus-summary-inc-thread-map "T" 'gnus-summary-raise-by-thread)
-  (define-key gnus-summary-inc-thread-map "t" 'gnus-summary-temporarily-raise-by-thread)
-  (define-key gnus-summary-inc-thread-map "p" 'gnus-summary-raise-by-thread)
-
-  (define-prefix-command 'gnus-summary-inc-xref-map)
-  (define-key gnus-summary-increase-map "x" 'gnus-summary-inc-xref-map)
-  (define-key gnus-summary-increase-map "X" 'gnus-summary-temporarily-raise-by-xref)
-  (define-key gnus-summary-inc-xref-map "x" 'gnus-summary-temporarily-raise-by-xref)
-  (define-key gnus-summary-inc-xref-map "X" 'gnus-summary-raise-by-xref)
-  (define-key gnus-summary-inc-xref-map "t" 'gnus-summary-temporarily-raise-by-xref)
-  (define-key gnus-summary-inc-xref-map "p" 'gnus-summary-raise-by-xref)
-
-  (define-prefix-command 'gnus-summary-inc-fol-map)
-  (define-key gnus-summary-increase-map "f" 'gnus-summary-inc-fol-map)
-  (define-key gnus-summary-increase-map "F" 'gnus-summary-raise-followups-to-author)
-  (define-key gnus-summary-inc-fol-map "f" 'gnus-summary-raise-followups-to-author)
-  (define-key gnus-summary-inc-fol-map "F" 'gnus-summary-raise-followups-to-author)
-  (define-key gnus-summary-inc-fol-map "t" 'gnus-summary-raise-followups-to-author)
-  (define-key gnus-summary-inc-fol-map "p" 'gnus-summary-raise-followups-to-author)
-
-  (define-prefix-command 'gnus-summary-lower-map)
-  (define-key gnus-summary-mode-map "L" 'gnus-summary-lower-map)
-  (define-key gnus-summary-lower-map "l" 'gnus-summary-lower-same-subject-and-select)
-  (define-key gnus-summary-lower-map "L" 'gnus-summary-lower-same-subject)
-  (define-key gnus-summary-lower-map "\C-l" 'gnus-summary-lower-score)
-
-  (define-prefix-command 'gnus-summary-low-subject-map)
-  (define-key gnus-summary-lower-map "s" 'gnus-summary-low-subject-map)
-  (define-key gnus-summary-lower-map "S" 'gnus-summary-temporarily-lower-by-subject)
-  (define-key gnus-summary-low-subject-map "s" 'gnus-summary-temporarily-lower-by-subject)
-  (define-key gnus-summary-low-subject-map "S" 'gnus-summary-lower-by-subject)
-  (define-key gnus-summary-low-subject-map "t" 'gnus-summary-temporarily-lower-by-subject)
-  (define-key gnus-summary-low-subject-map "p" 'gnus-summary-lower-by-subject)
-
-  (define-prefix-command 'gnus-summary-low-body-map)
-  (define-key gnus-summary-lower-map "b" 'gnus-summary-low-body-map)
-  (define-key gnus-summary-lower-map "B" 'gnus-summary-temporarily-lower-by-body)
-  (define-key gnus-summary-low-body-map "b" 'gnus-summary-temporarily-lower-by-body)
-  (define-key gnus-summary-low-body-map "B" 'gnus-summary-lower-by-body)
-  (define-key gnus-summary-low-body-map "t" 'gnus-summary-temporarily-lower-by-body)
-  (define-key gnus-summary-low-body-map "p" 'gnus-summary-lower-by-body)
-
-  (define-prefix-command 'gnus-summary-low-author-map)
-  (define-key gnus-summary-lower-map "a" 'gnus-summary-low-author-map)
-  (define-key gnus-summary-lower-map "A" 'gnus-summary-temporarily-lower-by-author)
-  (define-key gnus-summary-low-author-map "a" 'gnus-summary-temporarily-lower-by-author)
-  (define-key gnus-summary-low-author-map "A" 'gnus-summary-lower-by-author)
-  (define-key gnus-summary-low-author-map "t" 'gnus-summary-temporarily-lower-by-author)
-  (define-key gnus-summary-low-author-map "p" 'gnus-summary-lower-by-author)
-
-  (define-prefix-command 'gnus-summary-low-id-map)
-  (define-key gnus-summary-lower-map "i" 'gnus-summary-low-id-map)
-  (define-key gnus-summary-lower-map "I" 'gnus-summary-temporarily-lower-by-id)
-  (define-key gnus-summary-low-id-map "i" 'gnus-summary-temporarily-lower-by-id)
-  (define-key gnus-summary-low-id-map "I" 'gnus-summary-lower-by-id)
-  (define-key gnus-summary-low-id-map "t" 'gnus-summary-temporarily-lower-by-id)
-  (define-key gnus-summary-low-id-map "p" 'gnus-summary-lower-by-id)
-
-  (define-prefix-command 'gnus-summary-low-thread-map)
-  (define-key gnus-summary-lower-map "t" 'gnus-summary-low-thread-map)
-  (define-key gnus-summary-lower-map "T" 'gnus-summary-temporarily-lower-by-thread)
-  (define-key gnus-summary-low-thread-map "t" 'gnus-summary-temporarily-lower-by-thread)
-  (define-key gnus-summary-low-thread-map "T" 'gnus-summary-lower-by-thread)
-  (define-key gnus-summary-low-thread-map "t" 'gnus-summary-temporarily-lower-by-thread)
-  (define-key gnus-summary-low-thread-map "p" 'gnus-summary-lower-by-thread)
-
-  (define-prefix-command 'gnus-summary-low-xref-map)
-  (define-key gnus-summary-lower-map "x" 'gnus-summary-low-xref-map)
-  (define-key gnus-summary-lower-map "X" 'gnus-summary-temporarily-lower-by-xref)
-  (define-key gnus-summary-low-xref-map "x" 'gnus-summary-temporarily-lower-by-xref)
-  (define-key gnus-summary-low-xref-map "X" 'gnus-summary-lower-by-xref)
-  (define-key gnus-summary-low-xref-map "t" 'gnus-summary-temporarily-lower-by-xref)
-  (define-key gnus-summary-low-xref-map "p" 'gnus-summary-lower-by-xref)
-
-  (define-prefix-command 'gnus-summary-low-fol-map)
-  (define-key gnus-summary-lower-map "f" 'gnus-summary-low-fol-map)
-  (define-key gnus-summary-lower-map "F" 'gnus-summary-lower-followups-to-author)
-  (define-key gnus-summary-low-fol-map "f" 'gnus-summary-lower-followups-to-author)
-  (define-key gnus-summary-low-fol-map "F" 'gnus-summary-lower-followups-to-author)
-  (define-key gnus-summary-low-fol-map "t" 'gnus-summary-lower-followups-to-author)
-  (define-key gnus-summary-low-fol-map "p" 'gnus-summary-lower-followups-to-author)
+  (define-key gnus-summary-mode-map "I" 'gnus-summary-increase-score)
+  (define-key gnus-summary-mode-map "L" 'gnus-summary-lower-score)
   )
 
 
@@ -4863,6 +5000,7 @@ The following commands are available:
        (make-local-variable (car locals))
        (set (car locals) nil))
       (setq locals (cdr locals))))
+  (gnus-make-thread-indent-array)
   (gnus-update-format-specifications)
   (setq mode-line-modified "-- ")
   (make-local-variable 'mode-line-format)
@@ -4872,21 +5010,32 @@ The following commands are available:
   (setq major-mode 'gnus-summary-mode)
   (setq mode-name "Summary")
   (make-local-variable 'minor-mode-alist)
-  (gnus-set-mode-line 'summary)
   (use-local-map gnus-summary-mode-map)
   (buffer-disable-undo (current-buffer))
   (setq buffer-read-only t)            ;Disable modification
   (setq truncate-lines t)
   (setq selective-display t)
   (setq selective-display-ellipses t)  ;Display `...'
+  ;; Change the display table.  Odd characters have a tendency to mess
+  ;; up nicely formatted displays.
+  (setq buffer-display-table (copy-sequence standard-display-table))
+  (let ((i 32))
+    (while (>= (setq i (1- i)) 0)
+      (aset buffer-display-table i [??])))
+  (aset buffer-display-table ?\n nil)
+  (let ((i 160))
+    (while (>= (setq i (1- i)) 127)
+      (aset buffer-display-table i [??])))
   (run-hooks 'gnus-summary-mode-hook))
 
 (defun gnus-summary-clear-local-variables ()
   (let ((locals gnus-summary-local-variables))
     (while locals
       (if (consp (car locals))
-         (set (car (car locals)) nil)
-       (set (car locals) nil))
+         (and (vectorp (car (car locals)))
+              (set (car (car locals)) nil))
+       (and (vectorp (car locals))
+            (set (car locals) nil)))
       (setq locals (cdr locals)))))
 
 (defun gnus-mouse-pick-article (e)
@@ -4897,10 +5046,17 @@ The following commands are available:
 (defun gnus-summary-setup-buffer (group)
   "Initialize summary buffer."
   (let ((buffer (concat "*Summary " group "*")))
-    ;; 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)
-    (gnus-summary-mode)))
+    (if (get-buffer buffer)
+       (progn
+         (set-buffer buffer)
+         (not gnus-newsgroup-threads))
+      ;; 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)
+      (gnus-summary-mode)
+      (and gnus-carpal (gnus-carpal-setup-buffer 'summary))
+      (setq gnus-newsgroup-name group)
+      t)))
 
 (defun gnus-set-global-variables ()
   ;; Set the global equivalents of the summary buffer-local variables
@@ -4929,18 +5085,28 @@ The following commands are available:
     (insert (eval sformat))
     (add-text-properties
      b (1+ b)
-     (list 'gnus-subject (gnus-simplify-subject-re subject)
-          'gnus-number number
-          'gnus-mark ?Z
-          'gnus-thread 0))))
+     (list 'gnus (list number ?Z 0)))))
+
+(defvar gnus-thread-indent-array nil)
+(defvar gnus-thread-indent-array-level gnus-thread-indent-level)
+(defun gnus-make-thread-indent-array ()
+  (let ((n 200))
+    (if (and gnus-thread-indent-array
+            (= gnus-thread-indent-level gnus-thread-indent-array-level))
+       nil
+      (setq gnus-thread-indent-array (make-vector 201 "")
+           gnus-thread-indent-array-level gnus-thread-indent-level)
+      (while (>= n 0)
+       (aset gnus-thread-indent-array n
+             (make-string (* n gnus-thread-indent-level) ? ))
+       (setq n (1- n))))))
 
 (defun gnus-summary-insert-line 
   (sformat header level current unread replied expirable subject-or-nil
           &optional dummy score)
   (or sformat (setq sformat gnus-summary-line-format-spec))
-  (let* ((indentation 
-         (make-string (* level gnus-thread-indent-level) ? ))
-        (lines (or (header-lines header) 0))
+  (let* ((indentation (aref gnus-thread-indent-array level))
+        (lines (header-lines header))
         (score (or score gnus-summary-default-score 0))
         (score-char (if (or (null gnus-summary-default-score)
                             (= score gnus-summary-default-score)) ? 
@@ -4951,23 +5117,16 @@ The following commands are available:
         (name-address (funcall gnus-extract-address-components from))
         (address (car (cdr name-address)))
         (name (or (car name-address) (car (cdr name-address))))
-        (number (header-number header))
         (subject (header-subject header))
-        (buffer-read-only nil)
+        (number (header-number header))
         (opening-bracket (if dummy ?\< ?\[))
         (closing-bracket (if dummy ?\> ?\]))
-        b)
-    ;; Suggested by Brian Edmonds <bedmonds@prodigy.bc.ca>.
-    (if (not (numberp lines)) (setq lines 0))
-    (beginning-of-line)
-    (setq b (point))
+        (buffer-read-only nil)
+        (b (progn (beginning-of-line) (point))))
+    (or (numberp lines) (setq lines 0))
     (insert (eval sformat))
     (add-text-properties
-     b (1+ b)
-     (list 'gnus-subject (gnus-simplify-subject-re subject)
-          'gnus-number number
-          'gnus-mark (or unread gnus-unread-mark ? )
-          'gnus-thread level))))
+     b (1+ b) (list 'gnus (list number (or unread gnus-unread-mark) level)))))
 
 (defun gnus-summary-update-line (&optional dont-update)
   ;; Update summary line after change.
@@ -4987,92 +5146,124 @@ The following commands are available:
                (and (eq (gnus-summary-article-mark) gnus-low-score-mark)
                     (gnus-summary-mark-article nil gnus-unread-mark))))
          (and gnus-visual
-              (run-hooks 'gnus-visual-summary-update-hook))))))
+              (run-hooks 'gnus-summary-update-hook))))))
 
-(defun gnus-summary-update-lines ()
+(defun gnus-summary-update-lines (&optional beg end)
   ;; Rehighlight summary buffer according to `gnus-summary-highlight'.
-  (and (save-excursion
-        (set-buffer gnus-summary-buffer)
-        (goto-char (point-min))
-        (while (not (eobp))
-          (gnus-summary-update-line)
-          (forward-line 1)))))
+  (let ((beg (or beg (point-min)))
+       (end (or end (point-max))))
+    (save-excursion
+      (set-buffer gnus-summary-buffer)
+      (goto-char beg)
+      (while (and (not (eobp)) (< (point) end))
+       (gnus-summary-update-line)
+       (forward-line 1)))))
 
-(defun gnus-summary-number-of-articles-in-thread (thread)
+(defun gnus-summary-number-of-articles-in-thread (thread &optional char)
   ;; Sum up all elements (and sub-elements) in a list.
-  (if (listp thread) 
-      (apply '+ (mapcar 'gnus-summary-number-of-articles-in-thread thread))
-    1))
+  (let ((number 
+        (if (listp thread) 
+            (apply 
+             '+ (mapcar 'gnus-summary-number-of-articles-in-thread thread))
+          1)))
+    (if char 
+       (if (> number 1) gnus-not-empty-thread-mark
+         gnus-empty-thread-mark)
+      number)))
 
 (defun gnus-summary-read-group (group &optional show-all no-article kill-buffer)
   "Start reading news in newsgroup GROUP.
 If SHOW-ALL is non-nil, already read articles are also listed.
 If NO-ARTICLE is non-nil, no article is selected initially."
-  (message "Retrieving newsgroup: %s..." group)
-  (gnus-summary-setup-buffer group)
-  (if (gnus-select-newsgroup group show-all)
-      (progn
-       (gnus-set-global-variables)
-       ;; Save the active value in effect when the group was entered.
-       (setq gnus-newsgroup-active 
-             (gnus-copy-sequence
-              (gnus-gethash gnus-newsgroup-name gnus-active-hashtb)))
-       ;; You can change the subjects in this hook.
-       (run-hooks 'gnus-select-group-hook)
-       ;; Do score processing.
-       (gnus-score-headers)
-       ;; Update the format specifiers.
-       (gnus-update-format-specifications)
-       ;; Generate the summary buffer.
-       (gnus-summary-prepare)
-       (if (zerop (buffer-size))
-           (cond (gnus-newsgroup-dormant
-                  (gnus-summary-show-all-dormant))
-                 ((and gnus-newsgroup-scored show-all)
-                  (gnus-summary-show-all-expunged))))
-       ;; Function `gnus-apply-kill-file' must be called in this hook.
-       (run-hooks 'gnus-apply-kill-hook)
-       (if (zerop (buffer-size))
-           (progn
-             ;; This newsgroup is empty.
-             (gnus-summary-catchup-and-exit nil t) ;Without confirmations.
-             (message "No unread news")
-             (and kill-buffer
-                  (get-buffer kill-buffer)
-                  (buffer-name (get-buffer kill-buffer))
-                  (kill-buffer kill-buffer)))
-         (save-excursion
-           (if kill-buffer
-               (let ((gnus-summary-buffer kill-buffer))
-                 (gnus-configure-windows 'newsgroups t))))
-         ;; Hide conversation thread subtrees.  We cannot do this in
-         ;; gnus-summary-prepare-hook since kill processing may not
-         ;; work with hidden articles.
-         (and gnus-show-threads
-              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-configure-windows 'article)
-           (gnus-configure-windows 'summary))
-         (pop-to-buffer gnus-summary-buffer)
-         (gnus-set-mode-line 'summary)
-         (gnus-summary-position-cursor)
-         (if (and kill-buffer
-                  (get-buffer kill-buffer)
-                  (buffer-name (get-buffer kill-buffer)))
-             (kill-buffer kill-buffer))))
-    ;; Cannot select newsgroup GROUP.
-    (message "Couldn't select newsgroup")
-    (and (eq major-mode 'gnus-summary-mode)
-        (kill-buffer (current-buffer)))
-    (switch-to-buffer gnus-group-buffer)))
+  (gnus-message 5 "Retrieving newsgroup: %s..." group)
+  (let* ((new-group (gnus-summary-setup-buffer group))
+        (did-select (and new-group (gnus-select-newsgroup group show-all)))
+        (method (car (gnus-find-method-for-group group))))
+    (cond 
+     ((not new-group)
+      (gnus-set-global-variables)
+      (gnus-kill-buffer kill-buffer)
+      (gnus-configure-windows 'summary)
+      (gnus-set-mode-line 'summary)
+      (gnus-summary-position-cursor)
+      (message "")
+      t)
+     ((null did-select) 
+      (and (eq major-mode 'gnus-summary-mode)
+          (not (equal (current-buffer) kill-buffer))
+          (progn
+            (kill-buffer (current-buffer))
+            (set-buffer gnus-group-buffer)
+            (gnus-group-next-unread-group 1)))
+      nil)
+     ((eq did-select 'quit)
+      (and (eq major-mode 'gnus-summary-mode)
+          (not (equal (current-buffer) kill-buffer))
+          (kill-buffer (current-buffer)))
+      (gnus-kill-buffer kill-buffer)
+      (gnus-configure-windows 'group)
+      (gnus-group-next-unread-group 1)
+      (signal 'quit nil))
+     (t
+      (gnus-set-global-variables)
+      ;; Save the active value in effect when the group was entered.
+      (setq gnus-newsgroup-active 
+           (gnus-copy-sequence
+            (gnus-gethash gnus-newsgroup-name gnus-active-hashtb)))
+      ;; You can change the subjects in this hook.
+      (run-hooks 'gnus-select-group-hook)
+      ;; Do score processing.
+      (and gnus-use-scoring (gnus-possibly-score-headers))
+      ;; Update the format specifiers.
+      (gnus-update-format-specifications)
+      ;; Generate the summary buffer.
+      (gnus-summary-prepare)
+      (if (zerop (buffer-size))
+         (cond (gnus-newsgroup-dormant
+                (gnus-summary-show-all-dormant))
+               ((and gnus-newsgroup-scored show-all)
+                (gnus-summary-show-all-expunged))))
+      ;; Function `gnus-apply-kill-file' must be called in this hook.
+      (run-hooks 'gnus-apply-kill-hook)
+      (if (zerop (buffer-size))
+         (progn
+           ;; This newsgroup is empty.
+           (gnus-summary-catchup-and-exit nil t) ;Without confirmations.
+           (gnus-message 6 "No unread news")
+           (gnus-kill-buffer kill-buffer))
+       (save-excursion
+         (if kill-buffer
+             (let ((gnus-summary-buffer kill-buffer))
+               (gnus-configure-windows 'group))))
+       ;; Hide conversation thread subtrees.  We cannot do this in
+       ;; gnus-summary-prepare-hook since kill processing may not
+       ;; work with hidden articles.
+       (and gnus-show-threads
+            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-configure-windows 'article)
+         (gnus-configure-windows 'summary))
+       (gnus-set-mode-line 'summary)
+       (gnus-summary-position-cursor)
+       ;; If in async mode, we send some info to the backend.
+       (and gnus-newsgroup-async
+            (setq gnus-newsgroup-threads (nreverse gnus-newsgroup-threads))
+            (gnus-request-asynchronous 
+             gnus-newsgroup-name
+             (if (and gnus-asynchronous-article-function
+                      (fboundp gnus-asynchronous-article-function))
+                 (funcall gnus-asynchronous-article-function
+                          gnus-newsgroup-threads)
+               gnus-newsgroup-threads)))
+       (gnus-kill-buffer kill-buffer))))))
 
 (defun gnus-summary-prepare ()
-  "Prepare summary list of current newsgroup in summary buffer."
+  ;; Generate the summary buffer.
   (let ((buffer-read-only nil))
     (erase-buffer)
     (gnus-summary-prepare-threads 
@@ -5205,7 +5396,14 @@ If NO-ARTICLE is non-nil, no article is selected initially."
                                   (gnus-simplify-subject-re 
                                    (header-subject (car headers)))))
                     (progn
-                      (setq roots (cons (car headers) roots))
+                      (if (not (< (or (cdr (assq (header-number (car headers))
+                                                 gnus-newsgroup-scored))
+                                      gnus-summary-default-score 0)
+                                  gnus-summary-expunge-below))
+                          (setq roots (cons (car headers) roots))
+                        (setq gnus-newsgroup-unreads
+                              (delq (header-number (car headers))
+                                    gnus-newsgroup-unreads)))
                       (setcdr prev (cdr headers)))
                   (setq prev headers))
                 (setq headers (cdr headers)))))
@@ -5311,8 +5509,9 @@ If NO-ARTICLE is non-nil, no article is selected initially."
          (goto-char (point-min))
          (while (and (not found) (search-forward id nil t))
            (beginning-of-line)
-           (setq found (looking-at (format "^[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t%s"
-                                           (regexp-quote id))))
+           (setq found (looking-at 
+                        (format "^[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t%s"
+                                (regexp-quote id))))
            (or found (beginning-of-line 2)))
          (if found
              (let (ref)
@@ -5328,6 +5527,30 @@ If NO-ARTICLE is non-nil, no article is selected initially."
                 gnus-newsgroup-ancient (cons (header-number header)
                                              gnus-newsgroup-ancient))))))
 
+;; Re-build the thread containing ID.
+(defun gnus-rebuild-thread (id)
+  (let ((dep gnus-newsgroup-dependencies)
+       (buffer-read-only nil)
+       parent headers refs thread art)
+    (while (and id (setq headers
+                        (car (setq art (gnus-gethash (downcase id) dep)))))
+      (setq parent art)
+      (setq id (and (setq refs (header-references headers))
+                   (string-match "\\(<[^>]+>\\) *$" refs)
+                   (substring refs (match-beginning 1) (match-end 1)))))
+    (setq thread (gnus-make-sub-thread (car parent)))
+    (gnus-rebuild-remove-articles thread)
+    (let ((beg (point)))
+      (gnus-summary-prepare-threads (list thread) 0)
+      (gnus-summary-update-lines beg (point)))))
+
+;; Delete all lines in the summary buffer that correspond to articles
+;; in this thread.
+(defun gnus-rebuild-remove-articles (thread)
+  (and (gnus-summary-goto-subject (header-number (car thread)))
+       (gnus-delete-line))
+  (mapcar (lambda (th) (gnus-rebuild-remove-articles th)) (cdr thread)))
+
 (defun gnus-sort-threads (threads)
   ;; Sort threads as specified in `gnus-thread-sort-functions'.
   (let ((fun gnus-thread-sort-functions))
@@ -5414,6 +5637,7 @@ Unscored articles will be counted as havin a score of zero."
 
 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
 (defvar gnus-tmp-prev-subject "")
+(defvar gnus-tmp-adopt-thread nil)
 
 ;; Basic ideas by Paul Dworkin <paul@media-lab.media.mit.edu>.
 (defun gnus-summary-prepare-threads 
@@ -5446,7 +5670,8 @@ or a straight list of headers."
        ;; The header is a dummy root.
        (cond ((eq gnus-summary-make-false-root 'adopt)
               ;; We let the first article adopt the rest.
-              (gnus-summary-prepare-threads (list (car (cdr thread))) 0)
+              (let ((gnus-tmp-adopt-thread thread))
+                (gnus-summary-prepare-threads (list (car (cdr thread))) 0))
               (setq thread (cdr (cdr thread)))
               (while thread
                 (gnus-summary-prepare-threads (list (car thread)) 1 t)
@@ -5458,7 +5683,8 @@ or a straight list of headers."
               (setq clevel 1))
              ((eq gnus-summary-make-false-root 'empty)
               ;; We print the articles with empty subject fields. 
-              (gnus-summary-prepare-threads (list (car (cdr thread))) 0)
+              (let ((gnus-tmp-adopt-thread thread))
+                (gnus-summary-prepare-threads (list (car (cdr thread))) 0))
               (setq thread (cdr (cdr thread)))
               (while thread
                 (gnus-summary-prepare-threads 
@@ -5480,6 +5706,10 @@ or a straight list of headers."
        (header
        (setq number (header-number header)
              subject (header-subject header))
+       (and gnus-newsgroup-async
+            (setq gnus-newsgroup-threads
+                  (cons (cons (header-number header)
+                              (header-lines header)) gnus-newsgroup-threads)))
        (gnus-summary-insert-line
         nil header level nil 
         (cond ((memq number gnus-newsgroup-marked) gnus-ticked-mark)
@@ -5530,8 +5760,20 @@ If READ-ALL is non-nil, all articles in the group are selected."
     (setq gnus-newsgroup-unselected nil)
     (setq gnus-newsgroup-unreads (gnus-list-of-unread-articles group))
 
-    (if (not (setq articles (gnus-articles-to-read group read-all)))
-       nil
+    (and gnus-asynchronous
+        (gnus-check-backend-function 
+         'request-asynchronous gnus-newsgroup-name)
+        (setq gnus-newsgroup-async
+              (gnus-request-asynchronous gnus-newsgroup-name)))
+
+    (setq articles (gnus-articles-to-read group read-all))
+
+    (cond 
+     ((null articles) 
+      (gnus-message 3 "Couldn't select newsgroup")
+      'quit)
+     ((eq articles 0) nil)
+     (t
       ;; Init the dependencies hash table.
       (setq gnus-newsgroup-dependencies 
            (gnus-make-hashtable (length articles)))
@@ -5577,7 +5819,7 @@ If READ-ALL is non-nil, all articles in the group are selected."
       (setq gnus-newsgroup-auto-expire
            (or (and (stringp gnus-auto-expirable-newsgroups)
                     (string-match gnus-auto-expirable-newsgroups group))
-               (memq 'auto-expire gnus-current-select-method)))
+               (memq 'auto-expire (nth 5 info))))
       ;; First and last article in this newsgroup.
       (and gnus-newsgroup-headers
           (setq gnus-newsgroup-begin 
@@ -5586,7 +5828,7 @@ If READ-ALL is non-nil, all articles in the group are selected."
                 (header-number (gnus-last-element gnus-newsgroup-headers))))
       (setq gnus-reffed-article-number -1)
       ;; GROUP is successfully selected.
-      (or gnus-newsgroup-headers t))))
+      (or gnus-newsgroup-headers t)))))
 
 (defun gnus-articles-to-read (group read-all)
   ;; Find out what articles the user wants to read.
@@ -5627,11 +5869,11 @@ If READ-ALL is non-nil, all articles in the group are selected."
                       (if (string-equal input "")
                           number input)))
                    (t number))
-           (quit 0)))
+           (quit nil)))
         total-articles)
-    (setq select (if (numberp select) select (string-to-number select)))
-    (if (zerop select)
-       ()
+    (setq select (if (stringp select) (string-to-number select) select))
+    (if (or (null select) (zerop select))
+       select
       (if (and (not (zerop scored)) (<= (abs select) scored))
          (progn
            (setq articles (sort scored-list '<))
@@ -5799,12 +6041,18 @@ If WHERE is `summary', the summary mode line format will be used."
                 (subject
                  (if gnus-current-headers
                      (header-subject gnus-current-headers) ""))
-                (max-len (- (frame-width) gnus-mode-non-string-length)))
+                (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))
-           (if (> (length mode-string) max-len) 
+            (or (numberp max-len)
+               (setq max-len (length mode-string)))
+           (if (< max-len 4) (setq max-len 4))
+           (if (> (length mode-string) max-len)
                (setq mode-string 
-                     (concat (substring mode-string 0 (- max-len 3)) "...")))
-           (setq mode-string (format (format "%%-%ds" max-len 5)
+                     (concat (substring mode-string 0 (- 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))))
@@ -5878,7 +6126,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) 5)))
+                           (<= (nth 1 info) gnus-level-subscribed)))
                   (progn
                     (setq num 0)
                     ;; Set the new list of read articles in this group.
@@ -5949,7 +6197,7 @@ The resulting hash table is returned, or nil if no Xrefs were found."
                 (equal (nth 1 m1) (nth 1 m2)))))))
 
 (defsubst gnus-header-value ()
-  (buffer-substring (match-end 0) (save-excursion (end-of-line) (point))))
+  (buffer-substring (match-end 0) (gnus-point-at-eol)))
 
 (defun gnus-get-newsgroup-headers ()
   (setq gnus-article-internal-prepare-hook nil)
@@ -5959,7 +6207,7 @@ The resulting hash table is returned, or nil if no Xrefs were found."
        headers char article id dep end)
     (save-excursion
       (set-buffer nntp-server-buffer)
-      (goto-char 1)
+      (goto-char (point-min))
       ;; 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)
@@ -5994,8 +6242,9 @@ The resulting hash table is returned, or nil if no Xrefs were found."
            (and (search-forward "\nxref: " nil t)
                 (header-set-xref header (gnus-header-value)))
            (goto-char p)
-           (and (search-forward "\nlines: " nil t)
-                (header-set-lines header (read cur)))
+           (or (numberp (and (search-forward "\nlines: " nil t)
+                             (header-set-lines header (read cur))))
+               (header-set-lines header 0))
            (goto-char p)
            (and (search-forward "\ndate: " nil t)
                 (header-set-date header (gnus-header-value)))
@@ -6069,23 +6318,19 @@ The resulting hash table is returned, or nil if no Xrefs were found."
 ;; The following macros and functions were written by Felix Lee
 ;; <flee@cse.psu.edu>. 
 
-;; This is almost 4x faster than (string-to-int (buffer-substring ... ))
-;; primarily because of garbage collection.  -jwz
-(defmacro gnus-read-integer (&optional point move-p)
-  (` ((, (if move-p 'progn 'save-excursion))
-      (,@ (if point (list (list 'goto-char point))))
-      (if (and (<= (following-char) ?9)
-              (>= (following-char) ?0))
-         (read (current-buffer))
-       0))))
+(defmacro gnus-nov-read-integer ()
+  '(prog1
+       (if (= (following-char) ?\t)
+          0
+        (let ((num (read buffer)))
+          (if (numberp num) num 0)))
+     (or (eobp) (forward-char 1))))
 
 (defmacro gnus-nov-skip-field ()
-  '(search-forward "\t" eol 'end))
+  '(search-forward "\t" eol 'move))
 
 (defmacro gnus-nov-field ()
-  '(buffer-substring
-    (point)
-    (progn (gnus-nov-skip-field) (1- (point)))))
+  '(buffer-substring (point) (if (gnus-nov-skip-field) (1- (point)) eol)))
 
 ;; Goes through the xover lines and returns a list of vectors
 (defun gnus-get-newsgroup-headers-xover (sequence)
@@ -6116,52 +6361,55 @@ list of headers that match SEQUENCE (see `nntp-retrieve-headers')."
       (setq headers (nreverse headers)))
     headers))
 
+;; This function has to be called with point after the article number
+;; on the beginning of the line.
 (defun gnus-nov-parse-line (number dependencies)
-  "Point has to be after the number on the beginning of the line."
   (let ((none 0)
-       header eol ref id dep)
-    (save-excursion
-      (end-of-line)
-      (setq eol (point)))
-    (forward-char)
+       (eol (gnus-point-at-eol)) 
+       (buffer (current-buffer))
+       header ref id dep)
+
     ;; overview: [num subject from date id refs chars lines misc]
-    (save-restriction
-      (narrow-to-region (point) eol)
-      (condition-case nil
-         (setq header
-               (vector 
-                number                 ; number
-                (gnus-nov-field)       ; subject
-                (gnus-nov-field)       ; from
-                (gnus-nov-field)       ; date
-                (setq id (or (gnus-nov-field)
-                             (concat "none+"
-                                    (int-to-string 
-                                     (setq none (1+ none)))))) ; id
-                (progn
-                  (save-excursion
-                    (let ((beg (point)))
-                      (search-forward "\t" eol)
-                      (if (search-backward ">" beg t)
-                          (setq ref 
-                                (downcase 
-                                 (buffer-substring 
-                                  (1+ (point))
-                                  (progn
-                                    (search-backward "<" beg t)
-                                    (point)))))
-                        (setq ref nil))))
-                  (gnus-nov-field))    ; refs
-                (read (current-buffer)) ; chars
-                (read (current-buffer)) ; lines
-                (if (/= (following-char) ?\t)
-                    nil
-                  (forward-char 1)
-                  (gnus-nov-field))    ; misc
-                ))
-       (error (progn 
-                (setq header nil)
-                (goto-char eol)))))
+    (narrow-to-region (point) eol)
+    (forward-char)
+
+    (condition-case nil
+       (setq header
+             (vector 
+              number                   ; number
+              (gnus-nov-field)         ; subject
+              (gnus-nov-field)         ; from
+              (gnus-nov-field)         ; date
+              (setq id (or (gnus-nov-field)
+                           (concat "none+"
+                                   (int-to-string 
+                                    (setq none (1+ none)))))) ; id
+              (progn
+                (save-excursion
+                  (let ((beg (point)))
+                    (search-forward "\t" eol)
+                    (if (search-backward ">" beg t)
+                        (setq ref 
+                              (downcase 
+                               (buffer-substring 
+                                (1+ (point))
+                                (progn
+                                  (search-backward "<" beg t)
+                                  (point)))))
+                      (setq ref nil))))
+                (gnus-nov-field))      ; refs
+              (gnus-nov-read-integer)  ; chars
+              (gnus-nov-read-integer)  ; lines
+              (if (= (following-char) ?\n)
+                  nil
+                (gnus-nov-field))      ; misc
+              ))
+      (quit (progn 
+              (setq header nil)
+              (goto-char eol))))
+
+    (widen)
+
     ;; We build the thread tree.
     (and header
         (if (boundp (setq dep (intern (downcase id) dependencies)))
@@ -6190,23 +6438,24 @@ list of headers that match SEQUENCE (see `nntp-retrieve-headers')."
 (defun gnus-article-get-xrefs ()
   "Fill in the Xref value in `gnus-current-headers', if necessary.
 This is meant to be called in `gnus-article-internal-prepare-hook'."
-  (or (not gnus-use-cross-reference)
-      (header-xref gnus-current-headers)
-      (let ((case-fold-search t)
-           xref)
-       (save-restriction
-         (gnus-narrow-to-headers)
-         (goto-char (point-min))
-         (if (or (and (eq (downcase (following-char)) ?x)
-                      (looking-at "Xref:"))
-                 (search-forward "\nXref:" nil t))
-             (progn
-               (goto-char (1+ (match-end 0)))
-               (setq xref (buffer-substring (point) 
-                                            (progn (end-of-line) (point))))
-               (save-excursion
-                 (set-buffer gnus-summary-buffer)
-                 (header-set-xref gnus-current-headers xref))))))))
+  (let ((headers (save-excursion (set-buffer gnus-summary-buffer)
+                                gnus-current-headers)))
+    (or (not gnus-use-cross-reference)
+       (and (header-xref headers)
+            (not (string= (header-xref headers) "")))
+       (let ((case-fold-search t)
+             xref)
+         (save-restriction
+           (gnus-narrow-to-headers)
+           (goto-char (point-min))
+           (if (or (and (eq (downcase (following-char)) ?x)
+                        (looking-at "Xref:"))
+                   (search-forward "\nXref:" nil t))
+               (progn
+                 (goto-char (1+ (match-end 0)))
+                 (setq xref (buffer-substring (point) 
+                                              (progn (end-of-line) (point))))
+                 (header-set-xref headers xref))))))))
 
 (defalias 'gnus-find-header-by-number 'gnus-get-header-by-number)
 (make-obsolete 'gnus-find-header-by-number 'gnus-get-header-by-number)
@@ -6323,26 +6572,31 @@ searched for."
        (did t)
        pos)
     (beginning-of-line)
-    (forward-char (if backward (if (bobp) 0 -1) (if (eobp) 0 1)))
-    (while (and (setq pos (funcall func (point) 'gnus-number))
-               (goto-char (if backward (1- pos) pos))
-               (setq did
-                     (not (and (or (not unread)
-                                   (eq (get-text-property (point) 'gnus-mark) 
-                                       gnus-unread-mark))
-                               (or (not subject)
-                                   (equal (gnus-simplify-subject-re 
-                                           subject)
-                                          (gnus-simplify-subject-re
-                                           (get-text-property 
-                                            (point) 
-                                            'gnus-subject)))))))
-               (if backward (if (bobp) nil (forward-char -1) t)
-                 (if (eobp) nil (forward-char 1) t))))
+    (and gnus-summary-check-current unread
+        (eq (nth 1 (get-text-property (point) 'gnus)) gnus-unread-mark)
+        (setq did nil))
+    (if (not did)
+       ()
+      (forward-char (if backward (if (bobp) 0 -1) (if (eobp) 0 1)))
+      (while
+         (and 
+          (setq pos (funcall func (point) 'gnus))
+          (goto-char (if backward (1- pos) pos))
+          (setq did
+                (not (and
+                      (or (not unread)
+                          (eq (nth 1 (get-text-property (point) 'gnus))
+                              gnus-unread-mark))
+                      (or (not subject)
+                          (equal (gnus-simplify-subject-re subject)
+                                 (gnus-simplify-subject-re
+                                  (gnus-summary-subject-string)))))))
+          (if backward (if (bobp) nil (forward-char -1) t)
+            (if (eobp) nil (forward-char 1) t)))))
     (if did
        (progn (goto-char beg) nil)
       (prog1
-         (get-text-property (point) 'gnus-number)
+         (car (get-text-property (point) 'gnus))
        (gnus-summary-position-cursor)))))
 
 (defun gnus-summary-search-forward (&optional unread subject backward)
@@ -6365,30 +6619,33 @@ the same subject will be searched for."
 If there isn's an article number here, then we return the current
 article number."
   (let* ((p (point))
-        (number (get-text-property 
-                 (progn (beginning-of-line) (prog1 (point) (goto-char p)))
-                 'gnus-number)))
+        (number (car (get-text-property 
+                      (progn (beginning-of-line) 
+                             (prog1 (point) (goto-char p)))
+                      'gnus))))
     (if number-or-nil number (or number gnus-current-article))))
 
 (defun gnus-summary-thread-level ()
   "The thread level of the article on the current line."
-  (or (get-text-property 
-       (save-excursion (beginning-of-line) (point)) 'gnus-thread)
+  (or (nth 2 (get-text-property (gnus-point-at-bol) 'gnus))
       0))
 
 (defun gnus-summary-pseudo-article ()
   "The thread level of the article on the current line."
-  (get-text-property 
-   (save-excursion (beginning-of-line) (point)) 'gnus-pseudo))
+  (get-text-property (gnus-point-at-bol) 'gnus-pseudo))
 
 (defun gnus-summary-article-mark ()
   "The mark on the current line."
-  (get-text-property (save-excursion (beginning-of-line) (point)) 'gnus-mark))
+  (nth 1 (get-text-property (gnus-point-at-bol) 'gnus)))
 
 (defun gnus-summary-subject-string ()
   "Return current subject string or nil if nothing."
-  (get-text-property 
-   (save-excursion (beginning-of-line) (point)) 'gnus-subject))
+  (let ((article (gnus-summary-article-number))
+       header)
+    (and article 
+        (setq header (gnus-get-header-by-number article))
+        (vectorp header)
+        (header-subject header))))
 
 (defalias 'gnus-summary-score 'gnus-summary-article-score)
 (make-obsolete 'gnus-summary-score 'gnus-summary-article-score)
@@ -6397,44 +6654,51 @@ article number."
   (or (cdr (assq (gnus-summary-article-number) gnus-newsgroup-scored))
       gnus-summary-default-score 0))
 
+;; Written by Sudish Joseph <joseph@cis.ohio-state.edu>.
+
 (defun gnus-summary-recenter ()
   "Center point in the summary window.
 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.
-  (let ((top (cond ((< (window-height) 4) 0)
-                  ((< (window-height) 6) 1)
-                  (t 2))))
+  (let* ((top (cond ((< (window-height) 4) 0)
+                   ((< (window-height) 6) 1)
+                   (t 2)))
+        (height (1- (window-height)))
+        (bottom (save-excursion (goto-char (point-max))
+                                (forward-line (- height))
+                                (point)))
+        (window (get-buffer-window (current-buffer))))
     (and 
      ;; The user has to want it,
      gnus-auto-center-summary 
      ;; the article buffer must be displayed,
      (get-buffer-window gnus-article-buffer)
-     ;; there must be lines left to scroll forward,
-     (zerop (save-excursion (forward-line (- (window-height) 1 top))))
-     ;; so we recenter.
-     (set-window-start 
-      (get-buffer-window (current-buffer)) 
-      (save-excursion (forward-line (- top)) (point))))))
+     ;; Set the window start to either `bottom', which is the biggest
+     ;; 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)))))))
 
 ;; Function written by Stainless Steel Rat <ratinox@ccs.neu.edu>.
-(defun gnus-short-group-name (newsgroup)
-  "Convert a long group name to an initialized form.
-The last part of the name is left intact: \"rec.arts.anime\" becomes
-\"r.a.anime\"."
-  (let ((name ""))
-    (while newsgroup
-      (if (string-match "\\." newsgroup)
-         (progn
-           (setq name (concat name (substring newsgroup 0 1))
-                 newsgroup (substring newsgroup (match-end 0))
-                 name (concat name ".")))
-         (setq name (concat name newsgroup)
-               newsgroup nil)))
+(defun gnus-short-group-name (group &optional levels)
+  "Collapse GROUP name LEVELS."
+  (let ((name "") (foreign "")
+       (levels (or levels 2)))
+    (if (string-match ":" group)
+       (setq foreign (substring group 0 (match-end 0))
+             group (substring group (match-end 0))))
+    (while group
+      (if (and (string-match "\\." group) (> levels 0))
+         (setq name (concat name (substring group 0 1))
+               group (substring group (match-end 0))
+               levels (- levels 1)
+               name (concat name "."))
+       (setq name (concat foreign name group)
+             group nil)))
     name))
 
-
 (defun gnus-summary-jump-to-group (newsgroup)
   "Move point to NEWSGROUP in group mode buffer."
   ;; Keep update point of group mode buffer if visible.
@@ -6488,6 +6752,13 @@ The last part of the name is left intact: \"rec.arts.anime\" becomes
     ;; Return the list of unread articles.
     (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)))
+    (and info active
+        (gnus-sorted-complement 
+         (gnus-uncompress-range active) 
+         (gnus-list-of-unread-articles (nth 2 info))))))
 
 ;; Various summary commands
 
@@ -6520,12 +6791,14 @@ With arg, turn line truncation on iff arg is positive."
 The prefix argument ALL means to select all articles."
   (interactive "P")
   (gnus-set-global-variables)
-  (let ((current-subject (gnus-summary-article-number)))
+  (let ((current-subject (gnus-summary-article-number))
+       (group gnus-newsgroup-name))
+    (setq gnus-newsgroup-threads nil)
     (gnus-summary-exit t)
     ;; We have to adjust the point of group mode buffer because the
     ;; current point was moved to the next unread newsgroup by
     ;; exiting.
-    (gnus-summary-jump-to-group gnus-newsgroup-name)
+    (gnus-summary-jump-to-group group)
     (gnus-group-read-group all t)
     (gnus-summary-goto-subject current-subject)))
 
@@ -6535,7 +6808,7 @@ The prefix argument ALL means to select all articles."
   (gnus-set-global-variables)
   ;; Fix by Ilja Weis <kult@uni-paderborn.de>.
   (let ((group gnus-newsgroup-name))
-    (gnus-summary-exit t)
+    (gnus-summary-exit)
     (gnus-summary-jump-to-group group)
     (save-excursion
       (set-buffer gnus-group-buffer)
@@ -6543,18 +6816,9 @@ The prefix argument ALL means to select all articles."
     (gnus-summary-jump-to-group group)
     (gnus-group-read-group all)))
 
-(defun gnus-summary-exit (&optional temporary)
-  "Exit reading current newsgroup, and then return to group selection mode.
-gnus-exit-group-hook is called with no arguments if that value is non-nil."
-  (interactive)
-  (gnus-set-global-variables)
-  (gnus-kill-save-kill-buffer)
+(defun gnus-summary-update-info ()
   (let* ((group gnus-newsgroup-name)
-        (quit-buffer (cdr (assoc 'quit-buffer (gnus-find-method-for-group
-                                               gnus-newsgroup-name))))
-        (mode major-mode)
-        (method (car (gnus-find-method-for-group group)))
-        (buf (current-buffer)))
+        (method (car (gnus-find-method-for-group group))))
     (if gnus-newsgroup-kill-headers
        (setq gnus-newsgroup-killed
              (gnus-compress-sequence
@@ -6571,7 +6835,6 @@ gnus-exit-group-hook is called with no arguments if that value is non-nil."
          (headers gnus-newsgroup-headers))
       (gnus-close-group group)
       (run-hooks 'gnus-exit-group-hook)
-      (gnus-score-save)
       (gnus-update-read-articles 
        group gnus-newsgroup-unreads gnus-newsgroup-unselected 
        gnus-newsgroup-marked
@@ -6582,18 +6845,35 @@ gnus-exit-group-hook is called with no arguments if that value is non-nil."
       (and gnus-use-cross-reference
           (gnus-mark-xrefs-as-read 
            group headers gnus-newsgroup-unreads gnus-newsgroup-expirable))
+      ;; Do adaptive scoring, and possibly save score files.
+      (and gnus-newsgroup-adaptive
+          (gnus-score-adaptive))
+      (and (fboundp 'gnus-score-save)
+          (funcall 'gnus-score-save))
       ;; Do not switch windows but change the buffer to work.
       (set-buffer gnus-group-buffer)
       (or (eq 'nndigest method)
-         (gnus-group-update-group group)))
+         (gnus-group-update-group group)))))
+  
+(defun gnus-summary-exit (&optional temporary)
+  "Exit reading current newsgroup, and then return to group selection mode.
+gnus-exit-group-hook is called with no arguments if that value is non-nil."
+  (interactive)
+  (gnus-set-global-variables)
+  (gnus-kill-save-kill-buffer)
+  (let* ((group gnus-newsgroup-name)
+        (quit-buffer (cdr (assoc 'quit-buffer (gnus-find-method-for-group
+                                               gnus-newsgroup-name))))
+        (mode major-mode)
+        (method (car (gnus-find-method-for-group group)))
+        (buf (current-buffer)))
+    (gnus-summary-update-info) ; Make all changes in this group permanent.
     ;; Make sure where I was, and go to next newsgroup.
     (if (eq method 'nndigest)
        ()
       (gnus-group-jump-to-group group)
       (gnus-group-next-unread-group 1))
     (if temporary
-       ;; If exiting temporary, caller should adjust group mode
-       ;; buffer point by itself.
        nil                             ;Nothing to do.
       ;; We set all buffer-local variables to nil. It is unclear why
       ;; this is needed, but if we don't, buffer-local variables are
@@ -6603,18 +6883,20 @@ gnus-exit-group-hook is called with no arguments if that value is non-nil."
       (gnus-summary-clear-local-variables)
       ;; We clear the global counterparts of the buffer-local
       ;; variables as well, just to be on the safe side.
-      (set-buffer gnus-group-buffer)
+      (gnus-configure-windows 'group)
       (gnus-summary-clear-local-variables)
-      (gnus-configure-windows 'newsgroups t)
       ;; Return to group mode buffer. 
-      (and (get-buffer buf) 
-          (eq mode 'gnus-summary-mode)
-          (kill-buffer buf))
+      (if (eq mode 'gnus-summary-mode)
+         (gnus-kill-buffer buf))
       (if (get-buffer gnus-article-buffer)
          (bury-buffer gnus-article-buffer))
       (setq gnus-current-select-method gnus-select-method)
       (pop-to-buffer gnus-group-buffer)
-      (if (and quit-buffer (buffer-name quit-buffer))
+      (if (eq method 'nndigest)
+         ()
+       (gnus-group-jump-to-group group)
+       (gnus-group-next-unread-group 1))
+      (if (gnus-buffer-exists-p quit-buffer)
          (progn
            (switch-to-buffer quit-buffer)
            (gnus-set-global-variables)
@@ -6636,15 +6918,14 @@ gnus-exit-group-hook is called with no arguments if that value is non-nil."
          (set-buffer gnus-group-buffer)
          (gnus-summary-clear-local-variables)
          ;; Return to group selection mode.
-         (gnus-configure-windows 'newsgroups)
+         (gnus-configure-windows 'group)
          (if (get-buffer gnus-summary-buffer)
              (kill-buffer gnus-summary-buffer))
          (if (get-buffer gnus-article-buffer)
              (bury-buffer gnus-article-buffer))
-         (pop-to-buffer gnus-group-buffer)
-         (gnus-group-jump-to-group group)
-         (gnus-group-next-group 1)
-         (if (and quit-buffer (buffer-name quit-buffer))
+         (if (equal (gnus-group-group-name) group)
+             (gnus-group-next-unread-group 1))
+         (if (gnus-buffer-exists-p quit-buffer)
              (progn
                (switch-to-buffer quit-buffer)
                (gnus-configure-windows 'summary)))))))
@@ -6653,8 +6934,7 @@ gnus-exit-group-hook is called with no arguments if that value is non-nil."
 (defun gnus-summary-fetch-faq (group)
   "Fetch the FAQ for the current group."
   (interactive (list gnus-newsgroup-name))
-  (gnus-configure-windows 'article)
-  (pop-to-buffer gnus-article-buffer)
+  (gnus-configure-windows 'summary-faq)
   (find-file (concat gnus-group-faq-directory group)))
 
 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
@@ -6666,7 +6946,7 @@ gnus-exit-group-hook is called with no arguments if that value is non-nil."
 (defun gnus-summary-describe-briefly ()
   "Describe summary mode commands briefly."
   (interactive)
-  (message
+  (gnus-message 6
     (substitute-command-keys "\\<gnus-summary-mode-map>\\[gnus-summary-next-page]:Select  \\[gnus-summary-next-unread-article]:Forward  \\[gnus-summary-prev-unread-article]:Backward  \\[gnus-summary-exit]:Exit  \\[gnus-info-find-node]:Run Info  \\[gnus-summary-describe-briefly]:This help")))
 
 ;; Walking around group mode buffer from summary mode.
@@ -6690,21 +6970,29 @@ If BACKWARD, go to previous group instead."
          (gnus-group-jump-to-group group)
          (setq group nil))
       (gnus-group-jump-to-group ingroup))
+    (gnus-summary-search-group backward)
     (let ((group (or group (gnus-summary-search-group backward)))
          (buf gnus-summary-buffer))
       (if (null group)
          (gnus-summary-exit-no-update t)
-       (message "Selecting %s..." group)
+       (gnus-message 5 "Selecting %s..." group)
        ;; We are now in group mode buffer.
        ;; Make sure group mode buffer point is on GROUP.
        (gnus-group-jump-to-group group)
-       (unwind-protect
-           (gnus-summary-read-group group nil no-article buf)
-         (and (string= gnus-newsgroup-name ingroup)
-              (bufferp sumbuf) (buffer-name sumbuf)
-              (progn
-                (set-buffer (setq gnus-summary-buffer sumbuf))
-                (gnus-summary-exit-no-update t))))))))
+       (if (not (eq gnus-auto-select-next 'quietly))
+           (progn
+             (gnus-summary-read-group group nil no-article buf)
+             (and (string= gnus-newsgroup-name ingroup)
+                  (bufferp sumbuf) (buffer-name sumbuf)
+                  (progn
+                    (set-buffer (setq gnus-summary-buffer sumbuf))
+                    (gnus-summary-exit-no-update t))))
+         (gnus-summary-read-group group nil no-article buf)
+         (while (and (string= gnus-newsgroup-name ingroup)
+                     (bufferp sumbuf) (buffer-name sumbuf))
+           (set-buffer gnus-group-buffer)
+           (gnus-summary-read-group 
+            (gnus-group-group-name) nil no-article buf)))))))
 
 (defun gnus-summary-prev-group (no-article)
   "Exit current newsgroup and then select previous unread newsgroup.
@@ -6720,19 +7008,22 @@ If UNREAD is non-nil, go to the first unread article.
 Returns nil if there are no unread articles."
   (interactive "P")
   (let ((begin (point)))
-    (if unread
-       (if (not (gnus-goto-char 
-                 (text-property-any (point-min) (point-max)
-                                    'gnus-mark gnus-unread-mark)))
-           (progn
-             ;; If there is no unread articles, stay where you are.
-             (goto-char begin)
-             (message "No more unread articles")
-             nil)
-         t)
-      (goto-char (point-min)))))
+    (goto-char (point-min))
+    (if (not unread)
+       t
+      (while (and (not (eq (nth 1 (get-text-property (point) 'gnus))
+                          gnus-unread-mark))
+                 (zerop (forward-line 1))))
+      (prog1
+         (if (not (eobp))
+             t
+           ;; If there is no unread articles, stay where you are.
+           (goto-char begin)
+           (gnus-message 3 "No more unread articles")
+           nil)
+       (gnus-summary-position-cursor)))))
 
-(defun gnus-summary-next-subject (n &optional unread)
+(defun gnus-summary-next-subject (n &optional unread dont-display)
   "Go to next N'th summary line.
 If N is negative, go to the previous N'th subject line.
 If UNREAD is non-nil, only unread articles are selected.
@@ -6741,12 +7032,15 @@ returned."
   (interactive "p")
   (let ((backward (< n 0))
        (n (abs n)))
-  (while (and (> n 0)
-             (gnus-summary-search-forward unread nil backward))
-    (setq n (1- n)))
-  (gnus-summary-recenter)
-  (if (/= 0 n) (message "No more%s articles" (if unread " unread" "")))
-  (gnus-summary-position-cursor)
+    (while (and (> n 0)
+               (gnus-summary-search-forward unread nil backward))
+      (setq n (1- n)))
+    (if (/= 0 n) (gnus-message 7 "No more%s articles"
+                              (if unread " unread" "")))
+    (or dont-display
+       (progn
+         (gnus-summary-recenter)
+         (gnus-summary-position-cursor)))
   n))
 
 (defun gnus-summary-next-unread-subject (n)
@@ -6778,11 +7072,19 @@ If optional argument UNREAD is non-nil, only unread article is selected."
                       gnus-newsgroup-headers)
                      nil 'require-match))))
   (or article (error "No article number"))
-  (if (or (eq article (gnus-summary-article-number t))
-         (gnus-goto-char
-          (text-property-any
-           (point-min) (point-max) 'gnus-number article)))
-      article))
+  (let ((b (point)))
+    (goto-char (point-min))
+    (while (and (not (eq (car (get-text-property (point) 'gnus)) article))
+               (zerop (forward-line 1))))
+    ;; Skip dummy articles. 
+    (if (eq (gnus-summary-article-mark) ?Z)
+       (forward-line 1))
+    (prog1
+       (if (not (eobp))
+           article
+         (goto-char b)
+         nil)
+      (gnus-summary-position-cursor))))
 
 ;; Walking around summary lines with displaying articles.
 
@@ -6790,8 +7092,7 @@ If optional argument UNREAD is non-nil, only unread article is selected."
   "Expand summary window to show headers full window."
   (interactive)
   (gnus-set-global-variables)
-  (gnus-configure-windows 'summary)
-  (pop-to-buffer gnus-summary-buffer))
+  (gnus-configure-windows 'summary))
 
 (defun gnus-summary-display-article (article &optional all-header)
   "Display ARTICLE in article buffer."
@@ -6810,6 +7111,19 @@ If optional argument UNREAD is non-nil, only unread article is selected."
     (gnus-summary-goto-subject article)
     ;; Successfully display article.
     (gnus-summary-update-line)
+    (let ((bookmark (cdr (assq article gnus-newsgroup-bookmarks))))
+      (set-window-start 
+       (get-buffer-window gnus-article-buffer)
+       (save-excursion
+        (set-buffer gnus-article-buffer)
+        (goto-char (point-min))
+        (cond (bookmark
+               (gnus-message 6 "Moved to bookmark")
+               (search-forward "\n\n" nil t)
+               (forward-line bookmark)
+               (point))
+              (t
+               (point-min))))))
     t))
 
 (defun gnus-summary-select-article (&optional all-headers force pseudo article)
@@ -6821,20 +7135,39 @@ be displayed."
   (and (not pseudo) (gnus-summary-pseudo-article)
        (error "This is a pseudo-article."))
   (let ((article (or article (gnus-summary-article-number)))
-       (all-headers (not (not all-headers)))) ;Must be T or NIL.
-    (if (or (null gnus-current-article)
-           (null gnus-article-current)
-           (/= article (cdr gnus-article-current))
-           (not (equal (car gnus-article-current) gnus-newsgroup-name))
-           force)
-       ;; The requested article is different from the current article.
-       (progn
-         (gnus-summary-display-article article all-headers)
-         article)
-      (if all-headers (gnus-article-show-all-headers))
-      (gnus-configure-windows 'article)
-      (pop-to-buffer gnus-summary-buffer)
-      nil)))
+       (all-headers (not (not all-headers))) ;Must be T or NIL.
+       did) 
+    (prog1
+       (save-excursion
+         (set-buffer gnus-summary-buffer)
+         (if (or (null gnus-current-article)
+                 (null gnus-article-current)
+                 (not (eq article (cdr gnus-article-current)))
+                 (not (equal (car gnus-article-current) gnus-newsgroup-name))
+                 force)
+             ;; The requested article is different from the current article.
+             (progn
+               (gnus-summary-display-article article all-headers)
+               (gnus-configure-windows 'article)
+               (setq did article))
+           (if all-headers (gnus-article-show-all-headers))
+           (gnus-configure-windows 'article)
+           nil))
+      (if (not did)
+         ()
+       (let ((bookmark (cdr (assq article gnus-newsgroup-bookmarks))))
+         (set-window-start 
+          (get-buffer-window gnus-article-buffer)
+          (save-excursion
+            (set-buffer gnus-article-buffer)
+            (goto-char (point-min))
+            (cond (bookmark
+                   (gnus-message 6 "Moved to bookmark")
+                   (search-forward "\n\n" nil t)
+                   (forward-line bookmark)
+                   (point))
+                  (t
+                   (point-min))))))))))
 
 (defun gnus-summary-set-current-mark (&optional current-mark)
   "Obsolete function."
@@ -6858,7 +7191,7 @@ If BACKWARD, the previous article is selected instead of the next."
      ((and subject
           gnus-auto-select-same
           (gnus-summary-first-unread-article))
-      (message "Wrapped"))
+      (gnus-message 6 "Wrapped"))
      ;; Try to get next/previous article not displayed in this group.
      ((and gnus-auto-extend-newsgroup
           (not unread) (not subject)
@@ -6871,7 +7204,8 @@ If BACKWARD, the previous article is selected instead of the next."
                                   gnus-newsgroup-end)))
      ;; Go to next/previous group.
      (t
-      (gnus-summary-jump-to-group gnus-newsgroup-name)
+      (or (eq method 'nndigest)
+         (gnus-summary-jump-to-group gnus-newsgroup-name))
       (let ((cmd (aref (this-command-keys) 0))
            (group 
             (if (eq gnus-keep-same-level 'best) 
@@ -6882,22 +7216,22 @@ If BACKWARD, the previous article is selected instead of the next."
        ;; Select next unread newsgroup automagically.
        (cond 
         ((not gnus-auto-select-next)
-         (message "No more%s articles" (if unread " unread" "")))
+         (gnus-message 7 "No more%s articles" (if unread " unread" "")))
         ((eq gnus-auto-select-next 'quietly)
          ;; Select quietly.
          (if (eq method 'nndigest)
              (gnus-summary-exit)
-           (message "No more%s articles (%s)..."
-                    (if unread " unread" "") 
-                    (if group (concat "selecting " group)
-                      "exiting"))
+           (gnus-message 7 "No more%s articles (%s)..."
+                         (if unread " unread" "") 
+                         (if group (concat "selecting " group)
+                           "exiting"))
            (gnus-summary-next-group nil group backward)))
         (t
          (let ((keystrokes '(?\C-n ?\C-p))
                key)
            (while (or (null key) (memq key keystrokes))
-             (message 
-              "No more%s articles%s" (if unread " unread" "")
+             (gnus-message 
+              "No more%s articles%s" (if unread " unread" "")
               (if (and group (not (eq method 'nndigest)))
                   (format " (Type %s for %s [%s])"
                           (single-key-description cmd) group
@@ -6948,6 +7282,7 @@ instead of selecting the next article when reaching the end of the
 current article." 
   (interactive "P")
   (setq gnus-summary-buffer (current-buffer))
+  (gnus-set-global-variables)
   (let ((article (gnus-summary-article-number))
        (endp nil))
     (if (or (null gnus-current-article)
@@ -6957,7 +7292,6 @@ current article."
        ;; Selected subject is different from current article's.
        (gnus-summary-display-article article)
       (gnus-configure-windows 'article)
-      (pop-to-buffer gnus-summary-buffer)
       (gnus-eval-in-buffer-window
        gnus-article-buffer
        (setq endp (gnus-article-next-page lines)))
@@ -6965,10 +7299,9 @@ current article."
          (cond (circular
                 (gnus-summary-beginning-of-article))
                (lines
-                (message "End of message"))
+                (gnus-message 3 "End of message"))
                ((null lines)
-                (gnus-summary-next-unread-article))))))
-  (gnus-summary-position-cursor))
+                (gnus-summary-next-unread-article)))))))
 
 (defun gnus-summary-prev-page (lines)
   "Show previous page of selected article.
@@ -6982,7 +7315,6 @@ Argument LINES specifies lines to be scrolled down."
        ;; Selected subject is different from current article's.
        (gnus-summary-display-article article)
       (gnus-configure-windows 'article)
-      (pop-to-buffer gnus-summary-buffer)
       (gnus-eval-in-buffer-window gnus-article-buffer
        (gnus-article-prev-page lines))))
   (gnus-summary-position-cursor))
@@ -6996,7 +7328,7 @@ Argument LINES specifies lines to be scrolled up (or down if negative)."
        gnus-article-buffer
        (cond ((> lines 0)
              (if (gnus-article-next-page lines)
-                 (message "End of message")))
+                 (gnus-message 3 "End of message")))
             ((< lines 0)
              (gnus-article-prev-page (- lines))))))
   (gnus-summary-position-cursor))
@@ -7063,16 +7395,18 @@ If ALL-HEADERS is non-nil, no header lines are hidden."
       (mapcar (lambda (headers) (list (int-to-string (header-number headers))))
              gnus-newsgroup-headers) 
       nil 'require-match))))
-  (if (gnus-summary-goto-subject article)
-      (gnus-summary-display-article article all-headers))
-  (gnus-summary-position-cursor))
+  (prog1
+      (and (gnus-summary-goto-subject article)
+          (gnus-summary-display-article article all-headers))
+    (gnus-summary-position-cursor)))
 
 (defun gnus-summary-goto-last-article ()
   "Go to the last article."
   (interactive)
-  (if gnus-last-article
-      (gnus-summary-goto-article gnus-last-article))
-  (gnus-summary-position-cursor))
+  (prog1
+      (and gnus-last-article
+          (gnus-summary-goto-article gnus-last-article))
+    (gnus-summary-position-cursor)))
 
 (defun gnus-summary-pop-article (number)
   "Pop one article off the history and go to the previous.
@@ -7103,7 +7437,8 @@ The difference between N and the number of articles fetched is returned."
             (gnus-summary-refer-article 
              (substring ref (match-beginning 0) (match-end 0))))))
     (setq n (1- n)))
-  (or (zerop n) (message "No references in article or expired article."))
+  (or (zerop n) 
+      (gnus-message 1 "No references in article or expired article."))
   (gnus-summary-position-cursor)
   n)
     
@@ -7123,25 +7458,38 @@ NOTE: This command only works with newsgroup that use NNTP."
     (let ((header (car (gnus-gethash (downcase message-id)
                                     gnus-newsgroup-dependencies))))
       (if header
-         (gnus-summary-goto-article (header-number header))
-       (let ((gnus-override-method gnus-refer-article-method))
+         (or (gnus-summary-goto-article (header-number header))
+             ;; The header has been read, but the article had been
+             ;; expunged, so we insert it again.
+             (progn
+               (gnus-summary-insert-line
+                nil header 0 nil gnus-read-mark nil nil
+                (header-subject header))
+               (forward-line -1)
+               (header-number header)))
+       (let ((gnus-override-method gnus-refer-article-method)
+             (gnus-ancient-mark gnus-read-mark)
+             number)
+         (and gnus-refer-article-method
+              (or (gnus-server-opened gnus-refer-article-method)
+                  (gnus-open-server gnus-refer-article-method)))
          (if (gnus-article-prepare 
               message-id nil (gnus-read-header message-id))
              (progn
-               (gnus-summary-insert-line 
-                nil gnus-current-headers 0 nil gnus-read-mark nil nil 
-                (header-subject gnus-current-headers))
-               (forward-line -1)
-               (gnus-summary-position-cursor)
-               (gnus-summary-update-line)
+               (setq number (header-number gnus-current-headers))
+               (gnus-rebuild-thread message-id)
+               (gnus-summary-goto-subject number)
                message-id)
-           (message "No such references")
+           (gnus-message 1 "No such references")
            nil))))))
 
 (defun gnus-summary-enter-digest-group ()
   "Enter a digest group based on the current article."
   (interactive)
+  (gnus-set-global-variables)
   (gnus-summary-select-article)
+  ;; We do not want a narrowed article.
+  (gnus-summary-stop-page-breaking)
   (let ((name (format "%s/%d" 
                      (gnus-group-prefixed-name 
                       gnus-newsgroup-name (list 'nndigest "")) 
@@ -7150,15 +7498,25 @@ NOTE: This command only works with newsgroup that use NNTP."
     (set-buffer gnus-group-buffer)
     (gnus-sethash 
      name 
-     (list t nil (list name 3 nil nil 
+     (list t nil (list name gnus-level-default-subscribed nil nil 
                       (list 'nndigest gnus-article-buffer
                             (cons 'quit-buffer buf))))
      gnus-newsrc-hashtb)
-    (gnus-group-read-group t nil name)))
+    (condition-case ()
+       (gnus-group-read-group t nil name)
+      (error nil)
+      (quit nil))
+    (if (not (equal major-mode 'gnus-group-mode))
+       ()
+      (switch-to-buffer buf)
+      (gnus-set-global-variables)
+      (gnus-configure-windows 'summary)
+      (gnus-message 3 "Article not a digest?"))))
   
 (defun gnus-summary-isearch-article ()
   "Do incremental search forward on current article."
   (interactive)
+  (gnus-set-global-variables)
   (gnus-summary-select-article)
   (gnus-eval-in-buffer-window gnus-article-buffer
                              (isearch-forward)))
@@ -7171,6 +7529,7 @@ gnus-select-article-hook is not called during the search."
          (concat "Search forward (regexp): "
                  (if gnus-last-search-regexp
                      (concat "(default " gnus-last-search-regexp ") "))))))
+  (gnus-set-global-variables)
   (if (string-equal regexp "")
       (setq regexp (or gnus-last-search-regexp ""))
     (setq gnus-last-search-regexp regexp))
@@ -7188,6 +7547,7 @@ gnus-select-article-hook is not called during the search."
          (concat "Search backward (regexp): "
                  (if gnus-last-search-regexp
                      (concat "(default " gnus-last-search-regexp ") "))))))
+  (gnus-set-global-variables)
   (if (string-equal regexp "")
       (setq regexp (or gnus-last-search-regexp ""))
     (setq gnus-last-search-regexp regexp))
@@ -7215,7 +7575,7 @@ gnus-select-article-hook is not called during the search."
     ;; We don't want to read article again from NNTP server nor reset
     ;; current point.
     (gnus-summary-select-article)
-    (message "Searching article: %d..." gnus-current-article)
+    (gnus-message 9 "Searching article: %d..." gnus-current-article)
     (setq last gnus-current-article)
     (gnus-eval-in-buffer-window gnus-article-buffer
       (save-restriction
@@ -7226,7 +7586,7 @@ gnus-select-article-hook is not called during the search."
     (while (and (not found)
                (gnus-summary-display-article 
                 (gnus-summary-search-subject backward nil nil)))
-      (message "Searching article: %d..." gnus-current-article)
+      (gnus-message 9 "Searching article: %d..." gnus-current-article)
       (gnus-eval-in-buffer-window gnus-article-buffer
        (save-restriction
          (widen)
@@ -7247,29 +7607,31 @@ article. If BACKWARD (the prefix) is non-nil, search backward instead."
    (list (let ((completion-ignore-case t))
           (completing-read 
            "Header name: "
-           (mapcar (string) (list string)
+           (mapcar (lambda (string) (list string))
                    '("Number" "Subject" "From" "Lines" "Date"
-                     "Message-ID" "Xref" "References")
-                   nil 'require-match)))
+                     "Message-ID" "Xref" "References"))
+           nil 'require-match))
         (read-string "Regexp: ")
         (read-key-sequence "Command: ")
         current-prefix-arg))
+  (gnus-set-global-variables)
   ;; Hidden thread subtrees must be searched as well.
   (gnus-summary-show-all-threads)
   ;; We don't want to change current point nor window configuration.
   (save-excursion
     (save-window-excursion
-      (message "Executing %s..." (key-description command))
+      (gnus-message 6 "Executing %s..." (key-description command))
       ;; We'd like to execute COMMAND interactively so as to give arguments.
       (gnus-execute header regexp
                    (` (lambda ()
                         (call-interactively '(, (key-binding command)))))
                    backward)
-      (message "Executing %s... done" (key-description command)))))
+      (gnus-message 6 "Executing %s... done" (key-description command)))))
 
 (defun gnus-summary-beginning-of-article ()
   "Scroll the article back to the beginning."
   (interactive)
+  (gnus-set-global-variables)
   (gnus-summary-select-article)
   (gnus-eval-in-buffer-window
    gnus-article-buffer
@@ -7280,6 +7642,7 @@ article. If BACKWARD (the prefix) is non-nil, search backward instead."
 (defun gnus-summary-end-of-article ()
   "Scroll to the end of the article."
   (interactive)
+  (gnus-set-global-variables)
   (gnus-summary-select-article)
   (gnus-eval-in-buffer-window 
    gnus-article-buffer
@@ -7290,7 +7653,8 @@ article. If BACKWARD (the prefix) is non-nil, search backward instead."
 (defun gnus-summary-show-article ()
   "Force re-fetching of the current article."
   (interactive)
-  (gnus-summary-select-article gnus-have-all-headers t t))
+  (gnus-set-global-variables)
+  (gnus-summary-select-article gnus-have-all-headers t))
 
 (defun gnus-summary-toggle-header (arg)
   "Show the headers if they are hidden, or hide them if they are shown.
@@ -7302,23 +7666,27 @@ If ARG is a negative number, hide the unwanted header lines."
     (set-buffer gnus-article-buffer)
     (let ((buffer-read-only nil))
       (if (numberp arg) 
-         (if (> arg 0) (remove-text-properties 1 (point-max) '(invisible t))
+         (if (> arg 0) (remove-text-properties (point-min) (point-max) 
+                                               gnus-hidden-properties)
            (if (< arg 0) (run-hooks 'gnus-article-display-hook)))
-       (if (text-property-any 1 (point-max) 'invisible t)
-           (remove-text-properties 1 (point-max) '(invisible t))
+       (if (text-property-any (point-min) (point-max) 'invisible t)
+           (remove-text-properties (point-min) (point-max)
+                                   gnus-hidden-properties)
          (let ((gnus-have-all-headers nil))
            (run-hooks 'gnus-article-display-hook))))
-      (set-window-point (get-buffer-window (current-buffer)) 1))))
+      (set-window-point (get-buffer-window (current-buffer)) (point-min)))))
 
 (defun gnus-summary-show-all-headers ()
   "Make all header lines visible."
   (interactive)
+  (gnus-set-global-variables)
   (gnus-article-show-all-headers))
 
 (defun gnus-summary-toggle-mime (arg)
   "Toggle MIME processing.
 If ARG is a positive number, turn MIME processing on."
   (interactive "P")
+  (gnus-set-global-variables)
   (setq gnus-show-mime
        (if (null arg) (not gnus-show-mime)
          (> (prefix-numeric-value arg) 0)))
@@ -7329,6 +7697,7 @@ If ARG is a positive number, turn MIME processing on."
 With prefix arg, specifies the number of places to rotate each letter forward.
 Caesar rotates Japanese letters by 47 places in any case."
   (interactive "P")
+  (gnus-set-global-variables)
   (gnus-summary-select-article)
   (let ((mail-header-separator "")) ; !!! Is this necessary?
     (gnus-overload-functions)
@@ -7347,6 +7716,7 @@ Caesar rotates Japanese letters by 47 places in any case."
 (defun gnus-summary-stop-page-breaking ()
   "Stop page breaking in the current article."
   (interactive)
+  (gnus-set-global-variables)
   (gnus-summary-select-article)
   (gnus-eval-in-buffer-window gnus-article-buffer (widen)))
 
@@ -7369,6 +7739,7 @@ and `request-accept' functions. (Ie. mail newsgroups at present.)"
   (or (gnus-check-backend-function 'request-move-article gnus-newsgroup-name)
       (error "The current newsgroup does not support article moving"))
   (let ((articles (gnus-summary-work-articles n))
+       (prefix (gnus-group-real-prefix gnus-newsgroup-name))
        art-group)
     (if (and (not to-newsgroup) (not select-method))
        (setq to-newsgroup
@@ -7380,17 +7751,20 @@ and `request-accept' functions. (Ie. mail newsgroups at present.)"
                       (if gnus-current-move-group
                           (format "(%s default) " gnus-current-move-group)
                         ""))
-              gnus-active-hashtb nil nil
-              (gnus-group-real-prefix gnus-newsgroup-name))))
-    (if (string= to-newsgroup "")
-       (setq to-newsgroup (or gnus-current-move-group "")))
-    (or (gnus-gethash to-newsgroup gnus-active-hashtb)
-       (error "No such group: %s" to-newsgroup))
-    (setq gnus-current-move-group to-newsgroup)
+              gnus-active-hashtb nil nil prefix)))
+    (if to-newsgroup
+        (progn
+          (if (or (string= to-newsgroup "") (string= to-newsgroup prefix))
+              (setq to-newsgroup (or gnus-current-move-group "")))
+          (or (gnus-gethash to-newsgroup gnus-active-hashtb)
+             (gnus-activate-newsgroup to-newsgroup)
+              (error "No such group: %s" to-newsgroup))
+          (setq gnus-current-move-group to-newsgroup)))
     (or (gnus-check-backend-function 'request-accept-article 
                                     (or select-method to-newsgroup))
        (error "%s does not support article moving" to-newsgroup))
-    (message "Moving to %s: %s..." (or select-method to-newsgroup) articles)
+    (gnus-message 6 "Moving to %s: %s..." 
+                 (or select-method to-newsgroup) articles)
     (while articles
       (if (setq art-group
                (gnus-request-move-article 
@@ -7400,7 +7774,7 @@ and `request-accept' functions. (Ie. mail newsgroups at present.)"
                         gnus-newsgroup-name))    ; Server
                 (list 'gnus-request-accept-article 
                       (if select-method
-                          (quote select-method)
+                          (list 'quote select-method)
                         to-newsgroup)
                       (not (cdr articles)))     ; Accept form
                 (not (cdr articles))))          ; Only save nov last time
@@ -7418,7 +7792,8 @@ and `request-accept' functions. (Ie. mail newsgroups at present.)"
                 (article (car articles))
                 (marked (nth 3 info)))
            (gnus-summary-goto-subject article)
-           (delete-region (progn (beginning-of-line) (point))
+           (beginning-of-line)
+           (delete-region (point)
                           (progn (forward-line 1) (point)))
            (if (not (memq article gnus-newsgroup-unreads))
                (setcar (cdr (cdr info))
@@ -7441,7 +7816,7 @@ and `request-accept' functions. (Ie. mail newsgroups at present.)"
            (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
            (setq gnus-newsgroup-dormant
                  (delq article gnus-newsgroup-dormant)))
-       (message "Couldn't move article %s" (car articles)))
+       (gnus-message 1 "Couldn't move article %s" (car articles)))
       (gnus-summary-remove-process-mark (car articles))
       (setq articles (cdr articles)))))
 
@@ -7461,17 +7836,20 @@ current group into whatever groups they are destined to.  In the
 latter case, they will be copied into the relevant groups."
   (interactive "P")
   (gnus-set-global-variables)
-  (let ((respool-methods (gnus-methods-using 'respool)))
+  (let ((respool-methods (gnus-methods-using 'respool))
+       (methname 
+        (symbol-name (car (gnus-find-method-for-group gnus-newsgroup-name)))))
     (or respool-method
        (setq respool-method
              (completing-read
               "What method do you want to use when respooling? "
-              respool-methods nil t)))
-    (if (assoc (symbol-name
-               (car (gnus-find-method-for-group gnus-newsgroup-name)))
-              respool-methods)
-       (gnus-summary-copy-article n nil (intern respool-method)))
-    (gnus-summary-move-article n nil (intern respool-method))))
+              respool-methods nil t methname)))
+    (or (string= respool-method "")
+       (if (assoc (symbol-name
+                   (car (gnus-find-method-for-group gnus-newsgroup-name)))
+                  respool-methods)
+           (gnus-summary-move-article n nil (intern respool-method))
+         (gnus-summary-copy-article n nil (intern respool-method))))))
 
 ;; Suggested by gregj@unidata.com (Gregory J. Grubbs).
 (defun gnus-summary-copy-article (n &optional to-newsgroup select-method)
@@ -7490,6 +7868,7 @@ functions. (Ie. mail newsgroups at present.)"
   (gnus-set-global-variables)
   (let ((articles (gnus-summary-work-articles n))
        (copy-buf (get-buffer-create "*copy work*"))
+       (prefix (gnus-group-real-prefix gnus-newsgroup-name))
        art-group)
     (buffer-disable-undo copy-buf)
     (if (and (not to-newsgroup) (not select-method))
@@ -7502,17 +7881,20 @@ functions. (Ie. mail newsgroups at present.)"
                       (if gnus-current-move-group
                           (format "(%s default) " gnus-current-move-group)
                         ""))
-              gnus-active-hashtb nil nil
-              (gnus-group-real-prefix gnus-newsgroup-name))))
-    (if (string= to-newsgroup "")
-       (setq to-newsgroup (or gnus-current-move-group "")))
-    (or (gnus-gethash to-newsgroup gnus-active-hashtb)
-       (error "No such group: %s" to-newsgroup))
-    (setq gnus-current-move-group to-newsgroup)
+              gnus-active-hashtb nil nil prefix)))
+    (if to-newsgroup
+        (progn
+          (if (or (string= to-newsgroup "") (string= to-newsgroup prefix))
+              (setq to-newsgroup (or gnus-current-move-group "")))
+          (or (gnus-gethash to-newsgroup gnus-active-hashtb)
+             (gnus-activate-newsgroup to-newsgroup)
+              (error "No such group: %s" to-newsgroup))
+          (setq gnus-current-move-group to-newsgroup)))
     (or (gnus-check-backend-function 'request-accept-article 
                                     (or select-method to-newsgroup))
        (error "%s does not support article copying" to-newsgroup))
-    (message "Copying to %s: %s..." (or select-method to-newsgroup) articles)
+    (gnus-message 6 "Copying to %s: %s..." 
+                 (or select-method to-newsgroup) articles)
     (while articles
       (if (setq art-group
                (save-excursion
@@ -7551,7 +7933,7 @@ functions. (Ie. mail newsgroups at present.)"
                    (gnus-add-marked-articles 
                     (car info) (car (car marks)) (list to-article) info))
                (setq marks (cdr marks)))))
-       (message "Couldn't copy article %s" (car articles)))
+       (gnus-message 1 "Couldn't copy article %s" (car articles)))
       (gnus-summary-remove-process-mark (car articles))
       (setq articles (cdr articles)))
     (kill-buffer copy-buf)))
@@ -7605,7 +7987,8 @@ delete these instead."
        ;; after all.  
        (or (memq (car articles) gnus-newsgroup-expirable)
            (gnus-summary-mark-as-read (car articles) gnus-canceled-mark))
-       (setq articles (cdr articles))))))
+       (setq articles (cdr articles)))))
+  (gnus-summary-position-cursor))
 
 (defun gnus-summary-edit-article ()
   "Enter into a buffer and edit the current article.
@@ -7616,12 +7999,12 @@ This will have permanent effect only in mail groups."
       (error "The current newsgroup does not support article editing."))
   (gnus-summary-select-article t)
   (other-window 1)
-  (message "C-c C-c to end edits")
+  (gnus-message 6 "C-c C-c to end edits")
   (setq buffer-read-only nil)
   (text-mode)
   (use-local-map (copy-keymap (current-local-map)))
   (local-set-key "\C-c\C-c" 'gnus-summary-edit-article-done)
-  (goto-char 1)
+  (goto-char (point-min))
   (search-forward "\n\n" nil t))
 
 (defun gnus-summary-edit-article-done ()
@@ -7636,6 +8019,18 @@ This will have permanent effect only in mail groups."
     (setq buffer-read-only t)
     (pop-to-buffer gnus-summary-buffer)))      
 
+(defun gnus-summary-fancy-query ()
+  "Query where the fancy respool algorithm would put this article."
+  (interactive)
+  (gnus-summary-select-article)
+  (save-excursion
+    (set-buffer gnus-article-buffer)
+    (save-restriction
+      (goto-char (point-min))
+      (search-forward "\n\n")
+      (narrow-to-region (point-min) (point))
+      (pp-eval-expression (list 'quote (nnmail-split-fancy))))))
+
 ;; Summary score commands.
 
 ;; Suggested by boubaker@cenatls.cena.dgac.fr.
@@ -7670,6 +8065,11 @@ This will have permanent effect only in mail groups."
              (cons (cons article n) gnus-newsgroup-scored))))
     (gnus-summary-update-line)))
 
+(defun gnus-summary-current-score ()
+  "Return the score of the current article."
+  (interactive)
+  (message "%s" (gnus-summary-article-score)))
+
 ;; Summary marking commands.
 
 (defun gnus-summary-raise-same-subject-and-select (score)
@@ -7690,19 +8090,26 @@ This will have permanent effect only in mail groups."
       (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 (score)
   "Raise articles under current thread with SCORE."
-  (interactive "p")
+  (interactive "P")
+  (setq score (1- (gnus-score-default score)))
   (let (e)
     (save-excursion
       (let ((level (gnus-summary-thread-level)))
        (gnus-summary-raise-score score)
-       (while (and (zerop (gnus-summary-next-subject 1))
+       (while (and (zerop (gnus-summary-next-subject 1 nil t))
                    (> (gnus-summary-thread-level) level))
          (gnus-summary-raise-score score))
        (setq e (point))))
-    (or (zerop (gnus-summary-next-subject 1 t))
-       (goto-char e)))
+    (let ((gnus-summary-check-current t))
+      (or (zerop (gnus-summary-next-subject 1 t))
+         (goto-char e))))
+  (gnus-summary-recenter)
   (gnus-summary-position-cursor)
   (gnus-set-mode-line 'summary))
 
@@ -7718,8 +8125,8 @@ This will have permanent effect only in mail groups."
 
 (defun gnus-summary-lower-thread (score)
   "Raise articles under current thread with SCORE."
-  (interactive "p")
-  (gnus-summary-raise-thread (- score)))
+  (interactive "P")
+  (gnus-summary-raise-thread (- (1- (gnus-score-default score)))))
 
 (defun gnus-summary-kill-same-subject-and-select (unmark)
   "Mark articles which has the same subject as read, and then select the next.
@@ -7735,8 +8142,8 @@ If UNMARK is negative, tick articles."
     ;; select the first unread article.
     (gnus-summary-next-article t (and gnus-auto-select-same
                                      (gnus-summary-subject-string)))
-    (message "%d articles are marked as %s"
-            count (if unmark "unread" "read"))))
+    (gnus-message 7 "%d articles are marked as %s"
+                 count (if unmark "unread" "read"))))
 
 (defun gnus-summary-kill-same-subject (unmark)
   "Mark articles which has the same subject as read. 
@@ -7752,8 +8159,8 @@ If UNMARK is negative, tick articles."
     (if (null unmark)
        ;; Go to next unread subject.
        (gnus-summary-next-subject 1 t))
-    (message "%d articles are marked as %s"
-            count (if unmark "unread" "read"))))
+    (gnus-message 7 "%d articles are marked as %s"
+                 count (if unmark "unread" "read"))))
 
 (defun gnus-summary-mark-same-subject (subject &optional unmark)
   "Mark articles with same SUBJECT as read, and return marked number.
@@ -7796,9 +8203,11 @@ number of articles marked is returned."
          (if unmark
              (gnus-summary-remove-process-mark (gnus-summary-article-number))
            (gnus-summary-set-process-mark (gnus-summary-article-number)))
-         (zerop (gnus-summary-next-subject (if backward -1 1))))
+         (zerop (gnus-summary-next-subject (if backward -1 1) nil t)))
     (setq n (1- n)))
-  (if (/= 0 n) (message "No more articles"))
+  (if (/= 0 n) (gnus-message 7 "No more articles"))
+  (gnus-summary-recenter)
+  (gnus-summary-position-cursor)
   n))
 
 (defun gnus-summary-unmark-as-processable (n)
@@ -7854,12 +8263,12 @@ the actual number of articles marked is returned."
                 (count-lines
                  (min (point)
                       (save-excursion
-                        (goto-char 1)
+                        (goto-char (point-min))
                         (search-forward "\n\n" nil t)
                         (point)))
                  (point))))
         gnus-newsgroup-bookmarks))
-  (message "A bookmark has been added to the current article."))
+  (gnus-message 6 "A bookmark has been added to the current article."))
 
 (defun gnus-summary-remove-bookmark (article)
   "Remove the bookmark from the current article."
@@ -7870,8 +8279,8 @@ the actual number of articles marked is returned."
        (progn
          (setq gnus-newsgroup-bookmarks 
                (delq old gnus-newsgroup-bookmarks))
-         (message "Removed bookmark."))
-      (message "No bookmark in current article."))))
+         (gnus-message 6 "Removed bookmark."))
+      (gnus-message 6 "No bookmark in current article."))))
 
 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
 (defun gnus-summary-mark-as-dormant (n)
@@ -7916,13 +8325,15 @@ returned."
   (gnus-set-global-variables)
   (let ((backward (< n 0))
        (n (abs n))
-       (mark (or mark gnus-dread-mark)))
+       (mark (or mark gnus-del-mark)))
   (while (and (> n 0)
              (gnus-summary-mark-article nil mark no-expire)
              (zerop (gnus-summary-next-subject 
-                     (if backward -1 1) gnus-summary-goto-unread)))
+                     (if backward -1 1) gnus-summary-goto-unread t)))
     (setq n (1- n)))
-  (if (/= 0 n) (message "No more %sarticles" (if mark "" "unread ")))
+  (if (/= 0 n) (gnus-message 7 "No more %sarticles" (if mark "" "unread ")))
+  (gnus-summary-recenter)
+  (gnus-summary-position-cursor)
   (gnus-set-mode-line 'summary)
   n))
 
@@ -7939,21 +8350,30 @@ marked."
        gnus-newsgroup-auto-expire 
        (or (not mark)
           (and (numberp mark) (or (= mark gnus-killed-mark)
-                                  (= mark gnus-dread-mark)
+                                  (= mark gnus-del-mark)
                                   (= mark gnus-catchup-mark)
                                   (= mark gnus-low-score-mark)
                                   (= mark gnus-read-mark))))
        (setq mark gnus-expirable-mark))
-  (let* ((buffer-read-only nil)
-        (mark (or (and (stringp mark) (aref mark 0)) mark gnus-dread-mark))
+  (let* ((mark (or (and (stringp mark) (aref mark 0)) mark gnus-del-mark))
         (article (or article (gnus-summary-article-number))))
     (if (or (= mark gnus-unread-mark) 
            (= mark gnus-ticked-mark) 
            (= mark gnus-dormant-mark))
        (gnus-mark-article-as-unread article mark)
       (gnus-mark-article-as-read article mark))
+
+    ;; See whether the article is to be put in the cache.
+    (and gnus-use-cache
+        (save-excursion
+          (gnus-cache-possibly-enter-article 
+           gnus-newsgroup-name article 
+           (gnus-get-header-by-number article)
+           (= mark gnus-ticked-mark)
+           (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
+
     (if (gnus-summary-goto-subject article)
-       (progn
+       (let ((buffer-read-only nil))
          (gnus-summary-show-thread)
          (beginning-of-line)
          (and (eq (gnus-summary-article-mark) ?Z)
@@ -7971,7 +8391,8 @@ marked."
       (forward-char forward)
       (setq plist (text-properties-at (point)))
       (delete-char 1)
-      (and (memq 'gnus-mark plist) (setcar (cdr (memq 'gnus-mark plist)) mark))
+      (and (memq 'gnus plist) 
+          (setcar (cdr (car (cdr (memq 'gnus plist)))) mark))
       (insert mark)
       (and plist (add-text-properties (1- (point)) (point) plist))
       (gnus-summary-update-line (eq mark gnus-unread-mark)))))
@@ -7979,7 +8400,7 @@ marked."
 (defun gnus-mark-article-as-read (article &optional mark)
   "Enter ARTICLE in the pertinent lists and remove it from others."
   ;; Make the article expirable.
-  (let ((mark (or (and (stringp mark) (aref mark 0)) mark gnus-dread-mark)))
+  (let ((mark (or (and (stringp mark) (aref mark 0)) mark gnus-del-mark)))
     (if (= mark gnus-expirable-mark)
        (setq gnus-newsgroup-expirable (cons article gnus-newsgroup-expirable))
       (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)))
@@ -8049,14 +8470,14 @@ If N is negative, mark backwards instead.
 The difference between N and the actual number of articles marked is
 returned."
   (interactive "p")
-  (gnus-summary-mark-forward n gnus-dread-mark t))
+  (gnus-summary-mark-forward n gnus-del-mark t))
 
 (defun gnus-summary-mark-as-read-backward (n)
   "Mark the N articles as read backwards.
 The difference between N and the actual number of articles marked is
 returned."
   (interactive "p")
-  (gnus-summary-mark-forward (- n) gnus-dread-mark t))
+  (gnus-summary-mark-forward (- n) gnus-del-mark t))
 
 (defun gnus-summary-mark-as-read (&optional article mark)
   "Mark current article as read.
@@ -8103,7 +8524,7 @@ even ticked and dormant ones."
                    (not (memq (gnus-summary-article-number)
                               gnus-newsgroup-dormant))))
               (gnus-summary-mark-article
-               (gnus-summary-article-number) gnus-dread-mark))
+               (gnus-summary-article-number) gnus-del-mark))
              t)
            (zerop (forward-line 1))))))
 
@@ -8118,7 +8539,7 @@ even ticked and dormant ones."
   (gnus-summary-remove-lines-marked-with 
    (concat (mapconcat
            (lambda (char) (char-to-string (symbol-value char)))
-           '(gnus-dread-mark gnus-read-mark
+           '(gnus-del-mark gnus-read-mark gnus-ancient-mark
              gnus-killed-mark gnus-kill-file-mark
              gnus-low-score-mark gnus-expirable-mark)
            ""))))
@@ -8137,9 +8558,12 @@ even ticked and dormant ones."
     (let ((buffer-read-only nil)
           (marks (concat "^[" marks "]")))
       (goto-char (point-min))
-      (while (search-forward-regexp marks (point-max) t)
-       (delete-region (progn (beginning-of-line) (point))
-                      (progn (forward-line 1) (point)))))
+      (if gnus-newsgroup-adaptive
+         (gnus-score-remove-lines-adaptive marks)
+       (while (re-search-forward marks (point-max) t)
+         (beginning-of-line)
+         (delete-region (point)
+                        (progn (forward-line 1) (point))))))
     (or (zerop (buffer-size))
        (if (eobp)
            (gnus-summary-prev-subject 1)
@@ -8230,7 +8654,11 @@ even ticked and dormant ones."
       (or headers (error "No expunged articles hidden."))
       (goto-char (point-min))
       (save-excursion 
-       (gnus-summary-prepare-threads (nreverse headers) 0)))
+       (gnus-summary-update-lines 
+        (point)
+        (progn
+          (gnus-summary-prepare-threads (nreverse headers) 0)
+          (point)))))
     (goto-char (point-min))
     (gnus-summary-position-cursor)))
 
@@ -8247,7 +8675,12 @@ even ticked and dormant ones."
                 (setq headers (cons h headers))))
        (setq dormant (cdr dormant)))
       (or headers (error "No dormant articles hidden."))
-      (save-excursion (gnus-summary-prepare-threads (nreverse headers) 0)))
+      (save-excursion 
+       (gnus-summary-update-lines 
+        (point)
+        (progn
+          (gnus-summary-prepare-threads (nreverse headers) 0)
+          (point)))))
     (goto-char (point-min))
     (gnus-summary-position-cursor)))
 
@@ -8257,7 +8690,7 @@ even ticked and dormant ones."
   (gnus-summary-remove-lines-marked-with (char-to-string gnus-dormant-mark))
   (gnus-summary-position-cursor))
 
-(defun gnus-summary-catchup (all &optional quietly to-here)
+(defun gnus-summary-catchup (all &optional quietly to-here not-mark)
   "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.
@@ -8273,14 +8706,21 @@ The number of articles marked as read is returned."
               (if all
                   "Mark absolutely all articles as read? "
                 "Mark all unread articles as read? ")))
-         (let ((unreads (length gnus-newsgroup-unreads)))
-           (if (gnus-summary-first-subject (not all))
-               (while (and (gnus-summary-mark-as-read nil gnus-catchup-mark)
-                           (if to-here (< (point) to-here) t)
-                           (gnus-summary-search-subject nil (not all)))))
-           (- unreads (length gnus-newsgroup-unreads))
-           (or to-here
-               (setq gnus-newsgroup-unreads gnus-newsgroup-marked))))
+         (if (and not-mark 
+                  (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 gnus-newsgroup-marked))
+           (let ((unreads (length gnus-newsgroup-unreads)))
+             (if (gnus-summary-first-subject (not all))
+                 (while (and (gnus-summary-mark-as-read nil gnus-catchup-mark)
+                             (if to-here (< (point) to-here) t)
+                             (gnus-summary-search-subject nil (not all)))))
+             (- unreads (length gnus-newsgroup-unreads))
+             (or to-here
+                 (setq gnus-newsgroup-unreads gnus-newsgroup-marked)))))
     (gnus-summary-position-cursor)))
 
 (defun gnus-summary-catchup-to-here (&optional all)
@@ -8300,7 +8740,7 @@ If ALL is non-nil, also mark ticked and dormant articles as read."
   "Mark all articles not marked as unread in this newsgroup as read, then exit.
 If prefix argument ALL is non-nil, all articles are marked as read."
   (interactive "P")
-  (gnus-summary-catchup all quietly)
+  (gnus-summary-catchup all quietly nil 'fast)
   ;; Select next newsgroup or exit.
   (if (eq gnus-auto-select-next 'quietly)
       (gnus-summary-next-group nil)
@@ -8349,8 +8789,9 @@ Returns nil if no thread was there to be shown."
   (prog1
       (save-excursion
        (let ((buffer-read-only nil)
-             (beg (progn (beginning-of-line) (point)))
-             (end (save-excursion (end-of-line) (point))))
+             ;; first goto end then to beg, to have point at beg after let
+             (end (progn (end-of-line) (point)))
+             (beg (progn (beginning-of-line) (point))))
          (prog1
              ;; Any hidden lines here?
              (search-forward "\r" end t)
@@ -8400,6 +8841,8 @@ Return the article number moved to, or nil if moving was impossible."
                    (> (gnus-summary-thread-level) level)))
       (while (and (zerop (gnus-summary-next-subject 1))
                  (> (gnus-summary-thread-level) level))))
+    (gnus-summary-recenter)
+    (gnus-summary-position-cursor)
     (let ((oart (gnus-summary-article-number)))
       (and (/= oart article) oart))))
 
@@ -8415,7 +8858,7 @@ done."
              (gnus-summary-go-to-next-thread backward))
     (setq n (1- n)))
   (gnus-summary-position-cursor)
-  (if (/= 0 n) (message "No more threads"))
+  (if (/= 0 n) (gnus-message 7 "No more threads"))
   n))
 
 (defun gnus-summary-prev-thread (n)
@@ -8461,7 +8904,7 @@ taken."
                (gnus-summary-go-down-thread)))
     (setq n (1- n)))
   (gnus-summary-position-cursor)
-  (if (/= 0 n) (message "Can't go further"))
+  (if (/= 0 n) (gnus-message 7 "Can't go further"))
   n))
 
 (defun gnus-summary-up-thread (n)
@@ -8504,14 +8947,14 @@ If the prefix argument is negative, tick articles instead."
 
 ;; Summary sorting commands
 
-(defun gnus-summary-sort-by-number (reverse)
+(defun gnus-summary-sort-by-number (&optional reverse)
   "Sort summary buffer by article number.
 Argument REVERSE means reverse order."
   (interactive "P")
   (gnus-summary-sort 
    (cons 'gnus-summary-article-number 'gnus-thread-sort-by-number) reverse))
 
-(defun gnus-summary-sort-by-author (reverse)
+(defun gnus-summary-sort-by-author (&optional reverse)
   "Sort summary buffer by author name alphabetically.
 If case-fold-search is non-nil, case of letters is ignored.
 Argument REVERSE means reverse order."
@@ -8527,7 +8970,7 @@ Argument REVERSE means reverse order."
     'gnus-thread-sort-by-author)
    reverse))
 
-(defun gnus-summary-sort-by-subject (reverse)
+(defun gnus-summary-sort-by-subject (&optional reverse)
   "Sort summary buffer by subject alphabetically. `Re:'s are ignored.
 If case-fold-search is non-nil, case of letters is ignored.
 Argument REVERSE means reverse order."
@@ -8539,7 +8982,7 @@ Argument REVERSE means reverse order."
     'gnus-thread-sort-by-subject)
    reverse))
 
-(defun gnus-summary-sort-by-date (reverse)
+(defun gnus-summary-sort-by-date (&optional reverse)
   "Sort summary buffer by date.
 Argument REVERSE means reverse order."
   (interactive "P")
@@ -8552,7 +8995,7 @@ Argument REVERSE means reverse order."
     'gnus-thread-sort-by-date)
    reverse))
 
-(defun gnus-summary-sort-by-score (reverse)
+(defun gnus-summary-sort-by-score (&optional reverse)
   "Sort summary buffer by score.
 Argument REVERSE means reverse order."
   (interactive "P")
@@ -8571,8 +9014,12 @@ Argument REVERSE means reverse order."
            (goto-char (point-min))
            (sort-subr reverse 'forward-line 'end-of-line (car predicate)))
        (let ((gnus-thread-sort-functions (list (cdr predicate)))
+             (gnus-summary-prepare-hook nil)
              (gnus-summary-already-sorted nil))
-         (gnus-summary-prepare))))))
+         (gnus-summary-prepare)
+         (and gnus-show-threads
+              gnus-thread-hide-subtree
+              (gnus-summary-hide-all-threads)))))))
   
 (defun gnus-sortable-date (date)
   "Make sortable string by string-lessp from DATE.
@@ -8597,26 +9044,9 @@ If N is nil and any articles have been marked with the process mark,
 save those articles instead.
 The variable `gnus-default-article-saver' specifies the saver function."
   (interactive "P")
-  (let (articles process)
-    (if (and n (numberp n))
-       (let ((backward (< n 0))
-             (n (abs n)))
-         (save-excursion
-           (while (and (> n 0)
-                       (setq articles (cons (gnus-summary-article-number) 
-                                            articles))
-                       (gnus-summary-search-forward nil nil backward))
-             (setq n (1- n))))
-         (setq articles (sort articles (function <))))
-      (if gnus-newsgroup-processable
-         (progn
-           (setq articles (setq gnus-newsgroup-processable
-                                (nreverse gnus-newsgroup-processable)))
-           (setq process t))
-       (setq articles (list (gnus-summary-article-number)))))
+  (let ((articles (gnus-summary-work-articles n)))
     (while articles
-      (let ((header (gnus-gethash (int-to-string (car articles))
-                                 gnus-newsgroup-headers-hashtb-by-number)))
+      (let ((header (gnus-get-header-by-number (car articles))))
        (if (vectorp header)
            (progn
              (gnus-summary-select-article t nil nil (car articles))
@@ -8631,20 +9061,19 @@ The variable `gnus-default-article-saver' specifies the saver function."
                    (narrow-to-region (point) (or (search-forward "\n\n" nil t)
                                                  (point-max)))
                    (while (re-search-forward "^X-Gnus" nil t)
-                     (delete-region (progn (beginning-of-line) (point))
+                     (beginning-of-line)
+                     (delete-region (point)
                                     (progn (forward-line 1) (point))))
                    (widen))))
-             (if gnus-default-article-saver
-                 (funcall gnus-default-article-saver)
-               (error "No default saver is defined.")))
+             (save-excursion
+               (if gnus-default-article-saver
+                   (funcall gnus-default-article-saver)
+                 (error "No default saver is defined."))))
          (if (assq 'name header)
              (gnus-copy-file (cdr (assq 'name header)))
-           (message "Article %d is unsaveable" (car articles)))))
-      (if process
-         (gnus-summary-remove-process-mark (car articles)))
+           (gnus-message 1 "Article %d is unsaveable" (car articles)))))
+      (gnus-summary-remove-process-mark (car articles))
       (setq articles (cdr articles)))
-    (if process (setq gnus-newsgroup-processable 
-                     (nreverse gnus-newsgroup-processable)))
     (gnus-summary-position-cursor)
     n))
 
@@ -8698,6 +9127,16 @@ save those articles instead."
   (let ((gnus-default-article-saver 'gnus-summary-save-in-folder))
     (gnus-summary-save-article arg)))
 
+(defun gnus-summary-save-article-vm (arg)
+  "Append the current article to a vm folder.
+If N is a positive number, save the N next articles.
+If N is a negative number, save the N previous articles.
+If N is nil and any articles have been marked with the process mark,
+save those articles instead."
+  (interactive "P")
+  (let ((gnus-default-article-saver 'gnus-summary-save-in-vm))
+    (gnus-summary-save-article arg)))
+
 (defun gnus-read-save-file-name (prompt default-name)
   (let ((methods gnus-split-methods)
        split-name)
@@ -8833,6 +9272,32 @@ is initialized from the SAVEDIR environment variable."
     (or gnus-newsgroup-headers-hashtb-by-number
        (gnus-make-headers-hashtable-by-number))
     (gnus-summary-position-cursor)
+    ;; If all commands are to be bunched up on one line, we collect
+    ;; them here.  
+    (if gnus-view-pseudos-separately
+       ()
+      (let ((ps (setq pslist (sort pslist 'gnus-pseudos<)))
+           files action)
+       (while ps
+         (setq action (cdr (assq 'action (car ps))))
+         (setq files (list (cdr (assq 'name (car ps)))))
+         (while (and ps (cdr ps)
+                     (string= (or action "1")
+                              (or (cdr (assq 'action (car (cdr ps)))) "2")))
+           (setq files (cons (cdr (assq 'name (car (cdr ps)))) files))
+           (setcdr ps (cdr (cdr ps))))
+         (if (not files)
+             ()
+           (if (not (string-match "%s" action))
+               (setq files (cons " " files)))
+           (setq files (cons " " files))
+           (and (assq 'execute (car ps))
+                (setcdr (assq 'execute (car ps))
+                        (funcall (if (string-match "%s" action)
+                                     'format 'concat)
+                                 action 
+                                 (mapconcat (lambda (f) f) files " ")))))
+         (setq ps (cdr ps)))))
     (if gnus-view-pseudos
        (while pslist
          (and (assq 'execute (car pslist))
@@ -8849,17 +9314,20 @@ is initialized from the SAVEDIR environment variable."
                                (cdr (assq 'name (car pslist))))
                  ": " (or (cdr (assq 'execute (car pslist))) "") "\n")
          (add-text-properties 
-          b (1+ b) (list 'gnus-subject (cdr (assq 'name (car pslist)))
-                         'gnus-number gnus-reffed-article-number
-                         'gnus-mark gnus-unread-mark
-                         'gnus-pseudo (car pslist)
-                         'gnus-thread 0))
+          b (1+ b) (list 'gnus (list gnus-reffed-article-number
+                                     gnus-unread-mark 0)
+                         'gnus-pseudo (car pslist)))
          (forward-line -1)
          (gnus-sethash (int-to-string gnus-reffed-article-number)
                        (car pslist) gnus-newsgroup-headers-hashtb-by-number)
          (setq gnus-reffed-article-number (1- gnus-reffed-article-number))
          (setq pslist (cdr pslist)))))))
 
+(defun gnus-pseudos< (p1 p2)
+  (let ((c1 (cdr (assq 'action p1)))
+       (c2 (cdr (assq 'action p2))))
+    (and c1 c2 (string< c1 c2))))
+
 (defun gnus-request-pseudo-article (props)
   (cond ((assq 'execute props)
         (gnus-execute-command (cdr (assq 'execute props)))))
@@ -8889,285 +9357,15 @@ is initialized from the SAVEDIR environment variable."
                        (file-name-nondirectory file))))
   (copy-file file to))
 
-;; Summary score file commands
-
-;; Much modification of the kill (ahem, score) code and lots of the
-;; functions are written by Per Abrahamsen <amanda@iesd.auc.dk>.
-
-(defun gnus-summary-header (header)
-  ;; Return HEADER for current articles, or error.
-  (let ((article (gnus-summary-article-number)))
-    (if article
-       (aref (gnus-get-header-by-number article)
-             (nth 1 (assoc header gnus-header-index)))
-      (error "No article on current line"))))
-
-(defun gnus-summary-score-entry (header match type score date &optional prompt)
-  "Enter score file entry.
-HEADER is the header being scored.
-MATCH is the string we are looking for.
-TYPE is a flag indicating if it is a regexp or substring.
-SCORE is the score to add.
-DATE is the expire date."
-  (interactive
-   (list (completing-read "Header: "
-                         gnus-header-index
-                         (lambda (x) (fboundp (nth 2 x)))
-                         t)
-        (read-string "Match: ")
-        (y-or-n-p "Use regexp match? ")
-        (prefix-numeric-value current-prefix-arg)
-        (if (y-or-n-p "Expire kill? ")
-            (current-time-string)
-          nil)))
-  (let ((score (gnus-score-default score))
-       (header (downcase header)))
-    (and prompt (setq match (read-string 
-                            (format "Match %s on %s, %s: " 
-                                    (if date "temp" "permanent") 
-                                    header
-                                    (if (< score 0) "lower" "raise"))
-                            match)))
-    (and (>= (nth 1 (assoc header gnus-header-index)) 0)
-        (gnus-summary-score-effect header match type score))
-    (and (= score gnus-score-interactive-default-score)
-        (setq score nil))
-    (let ((new (cond (type
-                 (list match score (and date (gnus-day-number date)) type))
-                (date
-                 (list match score (gnus-day-number date)))
-                (score
-                 (list match score))
-                (t
-                 (list match))))
-         (old (gnus-score-get header)))
-      (gnus-score-set
-       header
-       (if old (cons new old) (list new))))
-    (gnus-score-set 'touched '(t))))
-
-(defun gnus-summary-score-effect (header match type score)
-  "Simulate the effect of a score file entry.
-HEADER is the header being scored.
-MATCH is the string we are looking for.
-TYPE is a flag indicating if it is a regexp or substring.
-SCORE is the score to add."
-  (interactive (list (completing-read "Header: "
-                                     gnus-header-index
-                                     (lambda (x) (fboundp (nth 2 x)))
-                                     t)
-                    (read-string "Match: ")
-                    (y-or-n-p "Use regexp match? ")
-                    (prefix-numeric-value current-prefix-arg)))
-  (save-excursion
-    (or (and (stringp match) (> (length match) 0))
-      (error "No match"))
-    (goto-char (point-min))
-    (let ((regexp (if type
-                     match
-                   (concat "\\`.*" (regexp-quote match) ".*\\'"))))
-      (while (not (eobp))
-       (let ((content (gnus-summary-header header))
-             (case-fold-search t))
-         (and content
-              (if (string-match regexp content)
-                  (gnus-summary-raise-score score))))
-       (beginning-of-line 2)))))
-
-(defun gnus-summary-score-crossposting (score date)
-   ;; Enter score file entry for current crossposting.
-   ;; SCORE is the score to add.
-   ;; DATE is the expire date.
-   (let ((xref (gnus-summary-header "xref"))
-        (start 0)
-        group)
-     (or xref (error "This article is not crossposted"))
-     (while (string-match " \\([^ \t]+\\):" xref start)
-       (setq start (match-end 0))
-       (if (not (string= 
-                (setq group 
-                      (substring xref (match-beginning 1) (match-end 1)))
-                gnus-newsgroup-name))
-          (gnus-summary-score-entry
-           "xref" (concat " " group ":") nil score date t)))))
-
-(defun gnus-summary-temporarily-lower-by-subject (level)
-  "Temporarily lower score by LEVEL for current subject.
-See `gnus-score-expiry-days'."
-  (interactive "P")
-  (gnus-summary-score-entry
-   "subject" (gnus-simplify-subject-re (gnus-summary-header "subject"))
-   nil (- (gnus-score-default level))
-   (current-time-string) t))
-
-(defun gnus-summary-temporarily-lower-by-author (level)
-  "Temporarily lower score by LEVEL for current author.
-See `gnus-score-expiry-days'."
-  (interactive "P")
-  (gnus-summary-score-entry
-   "from" (gnus-summary-header "from") nil (- (gnus-score-default level)) 
-   (current-time-string) t))
-
-(defun gnus-summary-temporarily-lower-by-body (level)
-  "Temporarily lower score by LEVEL for a match on the body of the article.
-See `gnus-score-expiry-days'."
-  (interactive "P")
-  (gnus-summary-score-entry
-   "body" "" nil (- (gnus-score-default level)) (current-time-string) t))
-
-(defun gnus-summary-temporarily-lower-by-id (level)
-  "Temporarily lower score by LEVEL for current message-id.
-See `gnus-score-expiry-days'."
-  (interactive "P")
-  (gnus-summary-score-entry
-   "message-id" (gnus-summary-header "message-id") 
-   nil (- (gnus-score-default level)) 
-   (current-time-string)))
-
-(defun gnus-summary-temporarily-lower-by-xref (level)
-  "Temporarily lower score by LEVEL for current xref.
-See `gnus-score-expiry-days'."
-  (interactive "P")
-  (gnus-summary-score-crossposting 
-   (- (gnus-score-default level)) (current-time-string)))
-
-(defun gnus-summary-temporarily-lower-by-thread (level)
-  "Temporarily lower score by LEVEL for current thread.
-See `gnus-score-expiry-days'."
-  (interactive "P")
-  (gnus-summary-score-entry
-   "references" (gnus-summary-header "message-id")
-   nil (- (gnus-score-default level)) (current-time-string)))
-
-(defun gnus-summary-lower-by-subject (level)
-  "Lower score by LEVEL for current subject."
-  (interactive "P")
-  (gnus-summary-score-entry
-   "subject" (gnus-simplify-subject-re (gnus-summary-header "subject"))
-   nil (- (gnus-score-default level)) 
-   nil t))
-
-(defun gnus-summary-lower-by-author (level)
-  "Lower score by LEVEL for current author."
-  (interactive "P")
-  (gnus-summary-score-entry
-   "from" (gnus-summary-header "from") nil 
-   (- (gnus-score-default level)) nil t))
-
-(defun gnus-summary-lower-by-body (level)
-  "Lower score by LEVEL for a match on the body of the article."
-  (interactive "P")
-  (gnus-summary-score-entry
-   "body" "" nil (- (gnus-score-default level)) nil t))
-
-(defun gnus-summary-lower-by-id (level)
-  "Lower score by LEVEL for current message-id."
-  (interactive "P")
-  (gnus-summary-score-entry
-   "message-id" (gnus-summary-header "message-id") nil 
-   (- (gnus-score-default level)) nil))
-
-(defun gnus-summary-lower-by-xref (level)
-  "Lower score by LEVEL for current xref."
-  (interactive "P")
-  (gnus-summary-score-crossposting (- (gnus-score-default level)) nil))
-
-(defun gnus-summary-lower-followups-to-author (level)
-  "Lower score by LEVEL for all followups to the current author."
-  (interactive "P")
-  (gnus-summary-raise-followups-to-author
-   (- (gnus-score-default level))))
-
-(defun gnus-summary-temporarily-raise-by-subject (level)
-  "Temporarily raise score by LEVEL for current subject.
-See `gnus-score-expiry-days'."
-  (interactive "P")
-  (gnus-summary-score-entry
-   "subject" (gnus-simplify-subject-re (gnus-summary-header "subject"))
-   nil level (current-time-string) t))
-
-(defun gnus-summary-temporarily-raise-by-author (level)
-  "Temporarily raise score by LEVEL for current author.
-See `gnus-score-expiry-days'."
-  (interactive "P")
-  (gnus-summary-score-entry
-   "from" (gnus-summary-header "from") nil level (current-time-string) t))
-
-(defun gnus-summary-temporarily-raise-by-body (level)
-  "Temporarily raise score by LEVEL for a match on the body of the article.
-See `gnus-score-expiry-days'."
-  (interactive "P")
-  (gnus-summary-score-entry "body" "" nil level (current-time-string) t))
-
-(defun gnus-summary-temporarily-raise-by-id (level)
-  "Temporarily raise score by LEVEL for current message-id.
-See `gnus-score-expiry-days'."
-  (interactive "P")
-  (gnus-summary-score-entry
-   "message-id" (gnus-summary-header "message-id") 
-   nil level (current-time-string)))
-
-(defun gnus-summary-temporarily-raise-by-xref (level)
-  "Temporarily raise score by LEVEL for current xref.
-See `gnus-score-expiry-days'."
-  (interactive "P")
-  (gnus-summary-score-crossposting level (current-time-string)))
-
-(defun gnus-summary-temporarily-raise-by-thread (level)
-  "Temporarily raise score by LEVEL for current thread.
-See `gnus-score-expiry-days'."
-  (interactive "P")
-  (gnus-summary-score-entry
-   "references" (gnus-summary-header "message-id")
-   nil level (current-time-string)))
-
-(defun gnus-summary-raise-by-subject (level)
-  "Raise score by LEVEL for current subject."
-  (interactive "P")
-  (gnus-summary-score-entry
-   "subject" (gnus-simplify-subject-re (gnus-summary-header "subject"))
-   nil level nil t))
-
-(defun gnus-summary-raise-by-author (level)
-  "Raise score by LEVEL for current author."
-  (interactive "P")
-  (gnus-summary-score-entry
-   "from" (gnus-summary-header "from") nil level nil t))
-
-(defun gnus-summary-raise-by-body (level)
-  "Raise score by LEVEL for a match on the body of the article."
-  (interactive "P")
-  (gnus-summary-score-entry "body" "" nil level nil t))
-
-(defun gnus-summary-raise-by-id (level)
-  "Raise score by LEVEL for current message-id."
-  (interactive "P")
-  (gnus-summary-score-entry
-   "message-id" (gnus-summary-header "message-id") nil level nil))
-
-(defun gnus-summary-raise-by-xref (level)
-  "Raise score by LEVEL for current xref."
-  (interactive "P")
-  (gnus-summary-score-crossposting level nil))
-
-(defun gnus-summary-raise-followups-to-author (level)
-  "Raise score by LEVEL for all followups to the current author."
-  (interactive "P")
-  (let ((article (gnus-summary-article-number)))
-    (if article (setq gnus-current-headers (gnus-get-header-by-number article))
-      (error "No article on current line")))
-  (gnus-kill-file-raise-followups-to-author
-   (gnus-score-default level)))
-
 ;; Summary kill commands.
 
 (defun gnus-summary-edit-global-kill (article)
-  "Edit the global score file."
+  "Edit the \"global\" kill file."
   (interactive (list (gnus-summary-article-number)))
   (gnus-group-edit-global-kill article))
 
 (defun gnus-summary-edit-local-kill ()
-  "Edit a local score file applied to the current newsgroup."
+  "Edit a local kill file applied to the current newsgroup."
   (interactive)
   (setq gnus-current-headers 
        (gnus-gethash 
@@ -9196,20 +9394,29 @@ See `gnus-score-expiry-days'."
   (define-key gnus-article-mode-map "\C-c\C-m" 'gnus-article-mail)
   (define-key gnus-article-mode-map "\C-c\C-M" 'gnus-article-mail-with-original)
   (define-key gnus-article-mode-map "?" 'gnus-article-describe-briefly)
+  (define-key gnus-article-mode-map gnus-mouse-2 'gnus-article-push-button)
+  (define-key gnus-article-mode-map "\r" 'gnus-article-press-button)
+  (define-key gnus-article-mode-map "\t" 'gnus-article-next-button)
   
   ;; Duplicate almost all summary keystrokes in the article mode map.
   (let ((commands 
-        (list "#" "\M-#" "\C-c\M-#" "\r" "n" "p"
+        (list "#" "\M-#" "\C-c\M-#" "n" "p"
               "N" "P" "\M-\C-n" "\M-\C-p" "." "\M-s" "\M-r"
               "<" ">" "l" "j" "^" "\M-^" "-" "u" "U" "d" "D"
-              "\M-u" "\M-U" "k" "\C-k" "\M-\C-k" "c" "x" "X" 
+              "\M-u" "\M-U" "k" "\C-k" "\M-\C-k""x" "X" 
               "\M-\C-x" "\M-\177" "b" "B" "$" "w" "\C-c\C-r"
-              "t" "\M-t" "a" "f" "F" "C" "S" "r" "R" "\C-c\C-f"
-              "m" "o" "\C-o" "|" "\M-m" "\M-\C-m" "\M-k" "m" "M"
-              "V" "\C-c\C-d" "q" "Q")))
+              "t" "\M-t" "C" "S"
+              "m" "o" "\C-o" "|" "\M-m" "\M-\C-m" "\M-k" "M"
+              "V" "\C-c\C-d")))
     (while commands
       (define-key gnus-article-mode-map (car commands) 
        'gnus-article-summary-command)
+      (setq commands (cdr commands))))
+
+  (let ((commands (list "q" "Q"  "c" "r" "R" "\C-c\C-f" "m"  "a" "f" "F")))
+    (while commands
+      (define-key gnus-article-mode-map (car commands) 
+       'gnus-article-summary-command-nosave)
       (setq commands (cdr commands)))))
 
 
@@ -9258,9 +9465,13 @@ The following commands are available:
        (gnus-add-current-to-buffer-list)
        (gnus-article-mode))))
 
-(defun gnus-request-article-this-buffer (article &optional group)
+(defun gnus-request-article-this-buffer (article group)
   "Get an article and insert it into this buffer."
   (setq group (or group gnus-newsgroup-name))
+
+  ;; Open server if it has closed.
+  (gnus-check-news-server (gnus-find-method-for-group group))
+
   ;; Using `gnus-request-article' directly will insert the article into
   ;; `nntp-server-buffer' - so we'll save some time by not having to
   ;; copy it from the server buffer into the article buffer.
@@ -9285,15 +9496,21 @@ The following commands are available:
            ;; It is an extracted pseudo-article.
            (setq article nil)
            (gnus-request-pseudo-article header)))))
-  ;; Get the article and into the article buffer.
-  (if article
-      (progn
-       (erase-buffer)
-       (let ((gnus-override-method 
-             (and (stringp article) gnus-refer-article-method)))
-        (and (gnus-request-article article group (current-buffer))
-             'article)))
-    'pseudo))
+
+  ;; Check the cache.
+  (if (and gnus-use-cache
+          (numberp article)
+          (gnus-cache-request-article article group))
+      'article
+    ;; Get the article and into the article buffer.
+    (if article
+       (progn
+         (erase-buffer)
+         (let ((gnus-override-method 
+                (and (stringp article) gnus-refer-article-method)))
+           (and (gnus-request-article article group (current-buffer))
+                'article)))
+      'pseudo)))
 
 (defun gnus-read-header (id)
   "Read the headers of article ID and enter them into the Gnus system."
@@ -9337,101 +9554,104 @@ If ALL-HEADERS is non-nil, no headers are hidden."
     (let* ((article (if header (header-number header) article))
           (summary-buffer (current-buffer))
           (internal-hook gnus-article-internal-prepare-hook)
-          (bookmark (cdr (assq article gnus-newsgroup-bookmarks)))
           (group gnus-newsgroup-name)
           result)
       (save-excursion
        (gnus-article-setup-buffer)
        (set-buffer gnus-article-buffer)
-       (let ((buffer-read-only nil))
-         (if (not (setq result (gnus-request-article-this-buffer 
-                                article group)))
-             ;; There is no such article.
+       (if (not (setq result (let ((buffer-read-only nil))
+                               (gnus-request-article-this-buffer 
+                                article group))))
+           ;; There is no such article.
+           (progn
+             (save-excursion
+               (set-buffer gnus-summary-buffer)
+               (setq gnus-current-article 0)
+               (and (numberp article) 
+                    (gnus-summary-mark-as-read article gnus-canceled-mark))
+               (gnus-message 1 "No such article (may be canceled)")
+               (and (numberp article)
+                    (setq gnus-current-article article))
+               (ding))
+             (and (numberp article)
+                  (setq gnus-article-current 
+                        (cons gnus-newsgroup-name article)))
+             nil)
+         (if (not (eq result 'article))
              (progn
                (save-excursion
-                 (set-buffer gnus-summary-buffer)
-                 (setq gnus-current-article 0)
-                 (and (numberp article) 
-                      (gnus-summary-mark-as-read article gnus-canceled-mark))
-                 (message "No such article (may be canceled)")
-                 (ding))
-               (setq gnus-article-current nil)
-               nil)
-           (if (not (eq result 'article))
-               (progn
-                 (save-excursion
-                   (set-buffer summary-buffer)
-                   (setq gnus-last-article gnus-current-article
-                         gnus-newsgroup-history (cons gnus-current-article
-                                                      gnus-newsgroup-history)
-                         gnus-current-article 0
-                         gnus-current-headers nil
-                         gnus-article-current nil)
-                   (gnus-configure-windows 'article)
-                   (gnus-set-global-variables))
-                 (gnus-set-mode-line 'article))
-             ;; The result from the `request' was an actual article -
-             ;; or at least some text that is now displayed in the
-             ;; article buffer.
-             (if (and (numberp article)
-                      (not (eq article gnus-current-article)))
-                 ;; Seems like a new article has been selected.
-                 ;; `gnus-current-article' must be an article number.
-                 (save-excursion
-                   (set-buffer summary-buffer)
-                   (setq gnus-last-article gnus-current-article
-                         gnus-newsgroup-history (cons gnus-current-article
-                                                      gnus-newsgroup-history)
-                         gnus-current-article article
-                         gnus-current-headers 
-                         (gnus-get-header-by-number gnus-current-article)
-                         gnus-article-current 
-                         (cons gnus-newsgroup-name gnus-current-article))
-                   (run-hooks 'gnus-mark-article-hook)
-                   (gnus-set-mode-line 'summary)
-                   (and gnus-visual 
-                        (run-hooks 'gnus-visual-mark-article-hook))
-                   ;; Set the global newsgroup variables here.
-                   ;; Suggested by Jim Sisolak
-                   ;; <sisolak@trans4.neep.wisc.edu>.
-                   (gnus-set-global-variables)))
-             ;; gnus-have-all-headers must be either T or NIL.
-             (setq gnus-have-all-headers
-                   (not (not (or all-headers gnus-show-all-headers))))
-             ;; Hooks for getting information from the article.
-             ;; This hook must be called before being narrowed.
-             (run-hooks 'internal-hook)
-             (run-hooks 'gnus-article-prepare-hook)
-             ;; Decode MIME message.
-             (if (and gnus-show-mime
-                      (gnus-fetch-field "Mime-Version"))
-                 (funcall gnus-show-mime-method))
-             ;; Perform the article display hooks.
-             (let ((buffer-read-only nil))
-               (run-hooks 'gnus-article-display-hook))
-             ;; Do page break.
-             (goto-char (point-min))
-             (and gnus-break-pages (gnus-narrow-to-page))
-             (gnus-set-mode-line 'article)
-             (gnus-configure-windows 'article)
-             (goto-char 1)
-             (set-window-start 
-              (get-buffer-window gnus-article-buffer) (point-min))
-             (if bookmark
-                 (progn
-                   (message "Moved to bookmark")
-                   (search-forward "\n\n" nil t)
-                   (forward-line bookmark)))
-             t)))))))
+                 (set-buffer summary-buffer)
+                 (setq gnus-last-article gnus-current-article
+                       gnus-newsgroup-history (cons gnus-current-article
+                                                    gnus-newsgroup-history)
+                       gnus-current-article 0
+                       gnus-current-headers nil
+                       gnus-article-current nil)
+                 (gnus-configure-windows 'article)
+                 (gnus-set-global-variables))
+               (gnus-set-mode-line 'article))
+           ;; The result from the `request' was an actual article -
+           ;; or at least some text that is now displayed in the
+           ;; article buffer.
+           (if (and (numberp article)
+                    (not (eq article gnus-current-article)))
+               ;; Seems like a new article has been selected.
+               ;; `gnus-current-article' must be an article number.
+               (save-excursion
+                 (set-buffer summary-buffer)
+                 (setq gnus-last-article gnus-current-article
+                       gnus-newsgroup-history (cons gnus-current-article
+                                                    gnus-newsgroup-history)
+                       gnus-current-article article
+                       gnus-current-headers 
+                       (gnus-get-header-by-number gnus-current-article)
+                       gnus-article-current 
+                       (cons gnus-newsgroup-name gnus-current-article))
+                 (run-hooks 'gnus-mark-article-hook)
+                 (gnus-set-mode-line 'summary)
+                 (and gnus-visual 
+                      (run-hooks 'gnus-visual-mark-article-hook))
+                 ;; Set the global newsgroup variables here.
+                 ;; Suggested by Jim Sisolak
+                 ;; <sisolak@trans4.neep.wisc.edu>.
+                 (gnus-set-global-variables)
+                 (and gnus-use-cache 
+                      (gnus-cache-possibly-enter-article
+                       group article
+                       (gnus-get-header-by-number article)
+                       (memq article gnus-newsgroup-marked)
+                       (memq article gnus-newsgroup-dormant)
+                       (memq article gnus-newsgroup-unreads)))))
+           ;; gnus-have-all-headers must be either T or NIL.
+           (setq gnus-have-all-headers
+                 (not (not (or all-headers gnus-show-all-headers))))
+           ;; Hooks for getting information from the article.
+           ;; This hook must be called before being narrowed.
+           (run-hooks 'internal-hook)
+           (run-hooks 'gnus-article-prepare-hook)
+           ;; Decode MIME message.
+           (if (and gnus-show-mime
+                    (gnus-fetch-field "Mime-Version"))
+               (funcall gnus-show-mime-method))
+           ;; Perform the article display hooks.
+           (let ((buffer-read-only nil))
+             (run-hooks 'gnus-article-display-hook))
+           ;; Do page break.
+           (goto-char (point-min))
+           (and gnus-break-pages (gnus-narrow-to-page))
+           (gnus-set-mode-line 'article)
+           (gnus-configure-windows 'article)
+           (goto-char (point-min))
+           t))))))
 
 (defun gnus-article-show-all-headers ()
   "Show all article headers in article mode buffer."
   (save-excursion 
-    (setq gnus-have-all-headers t)
     (gnus-article-setup-buffer)
     (set-buffer gnus-article-buffer)
     (let ((buffer-read-only nil))
-      (remove-text-properties 1 (point-max) '(invisible t)))))
+      (remove-text-properties (point-min) (point-max) 
+                             gnus-hidden-properties))))
 
 (defun gnus-article-hide-headers-if-wanted ()
   "Hide unwanted headers if `gnus-have-all-headers' is nil.
@@ -9450,12 +9670,12 @@ Provided for backwards compatability."
            want want-list beg want-l)
        ;; First we narrow to just the headers.
        (widen)
-       (goto-char 1)
+       (goto-char (point-min))
        ;; Hide any "From " lines at the beginning of (mail) articles. 
-       (while (looking-at rmail-unix-mail-delimiter)
+       (while (looking-at "From ")
          (forward-line 1))
-       (if (/= (point) 1
-           (add-text-properties 1 (point) '(invisible t)))
+       (if (bobp
+           (add-text-properties (point-min) (point) gnus-hidden-properties))
        ;; Then treat the rest of the header lines.
        (narrow-to-region 
         (point) 
@@ -9464,7 +9684,7 @@ Provided for backwards compatability."
        ;; `gnus-ignored-headers' and `gnus-visible-headers' to
        ;; select which header lines is to remain visible in the
        ;; article buffer.
-       (goto-char 1)
+       (goto-char (point-min))
        (while (re-search-forward "^[^ \t]*:" nil t)
          (beginning-of-line)
          ;; We add the headers we want to keep to a list and delete
@@ -9487,7 +9707,7 @@ Provided for backwards compatability."
            (forward-line 1)))
        ;; Next we perform the sorting by looking at
        ;; `gnus-sorted-header-list'. 
-       (goto-char 1)
+       (goto-char (point-min))
        (while (and sorted want-list)
          (setq want-l want-list)
          (while (and want-l
@@ -9507,41 +9727,7 @@ Provided for backwards compatability."
        (if delete
            (delete-region (point) (point-max))
          ;; Suggested by Sudish Joseph <joseph@cis.ohio-state.edu>.
-         (add-text-properties (point) (point-max) '(invisible t)))))))
-
-(defun gnus-article-hide-signature ()
-  "Hides the signature in an article.
-It does this by hiding everyting after \"^-- *$\", which is what all
-signatures should be preceded by. Note that this may mean that parts
-of an article may disappear if the article has such a line in the
-middle of the text."
-  (interactive)
-  (save-excursion
-    (set-buffer gnus-article-buffer)
-    (let ((buffer-read-only nil))
-      (goto-char (point-max))
-      (if (re-search-backward "^-- *$" nil t)
-         (progn
-           (add-text-properties (point) (point-max) '(invisible t)))))))
-
-(defun gnus-article-hide-citation ()
-  "Hide all cited text.
-This function uses the famous, extremely intelligent \"shoot in foot\"
-algorithm - which is simply deleting all lines that start with
-\">\". Your mileage may vary. If you come up with anything better,
-please do mail it to me."
-  (interactive)
-  (save-excursion
-    (set-buffer gnus-article-buffer)
-    (let ((buffer-read-only nil))
-      (goto-char 1)
-      (search-forward "\n\n" nil t)
-      (while (not (eobp))
-       (if (looking-at ">")
-           (add-text-properties 
-            (point) (save-excursion (forward-line 1) (point))
-            '(invisible t)))
-       (forward-line 1)))))
+         (add-text-properties (point) (point-max) gnus-hidden-properties))))))
 
 ;; Written by Per Abrahamsen <amanda@iesd.auc.dk>.
 (defun gnus-article-treat-overstrike ()
@@ -9572,7 +9758,7 @@ please do mail it to me."
   (save-excursion
     (set-buffer gnus-article-buffer)
     (let ((buffer-read-only nil))
-      (goto-char 1)
+      (goto-char (point-min))
       (search-forward "\n\n" nil t)
       (end-of-line 1)
       (let ((paragraph-start "^\\W"))
@@ -9590,66 +9776,143 @@ please do mail it to me."
     (let ((buffer-read-only nil))
       (goto-char (point-min))
       (while (search-forward "\r" nil t)
-       (replace-match "")))))
+       (replace-match "" t t)))))
 
-(defun gnus-article-display-x-face ()
+(defun gnus-article-display-x-face (&optional force)
   "Look for an X-Face header and display it if present."
-  (interactive)
+  (interactive (list 'force))
   (save-excursion
     (set-buffer gnus-article-buffer)
-    (goto-char (point-min))
-    (if (or (not gnus-article-x-face-command)
-           (not (re-search-forward "^X-Face: " nil t)))
-       ()
-      (let ((face
-            (buffer-substring
-             (point) 
-             (progn
-               (forward-line 1)
-               (while (and (looking-at "[ \t]") 
-                           (zerop (forward-line 1))))
-               (point))))
-           (command gnus-article-x-face-command))
-       (if (symbolp command)
-           (and (or (fboundp command) (error "%s is not a function" command))
-                (funcall command face))
-         (let ((process (start-process "gnus-x-face" nil "sh" "-c" command)))
-           (if process
+    (let ((inhibit-point-motion-hooks t)
+         (case-fold-search nil))
+      (save-restriction
+       (goto-char (point-min))
+       (search-forward "\n\n")
+       (narrow-to-region (point-min) (point))
+       (goto-char (point-min))
+       (if (or (not gnus-article-x-face-command)
+               (and (not force)
+                    (or (not gnus-article-x-face-too-ugly)
+                        (string-match gnus-article-x-face-too-ugly
+                                      (mail-fetch-field "from"))))
                (progn
-                 (process-send-string process face)
-                 (process-send-eof process))
-             (error "Couldn't start process"))))))))
-             
-(defun gnus-article-de-quoted-unreadable ()
-  "Do a naive translation of a quoted-printable-encoded article.
+                 (goto-char (point-min))
+                 (not (re-search-forward "^X-Face: " nil t))))
+           nil
+         (let ((beg (point))
+               (end (1- (re-search-forward "^\\($\\|[^ \t]\\)" nil t))))
+           (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))
+             (call-process-region beg end "sh" nil 0 nil
+                                  "-c" gnus-article-x-face-command))))))))
+
+(defun gnus-article-de-quoted-unreadable (&optional force)
+  "Do a naïve translation of a quoted-printable-encoded article.
 This is in no way, shape or form meant as a replacement for real MIME
 processing, but is simply a stop-gap measure until MIME support is
-written."
-  (interactive)
+written.
+If FORCE, decode the article whether it is marked as quoted-printable
+or not." 
+  (interactive (list 'force))
   (save-excursion
-    (save-restriction
+    (set-buffer gnus-article-buffer)
+    (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)))))))
+
+(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))
+           ((gnus-message 3 "Malformed MIME quoted-printable message"))))))
+
+(defun gnus-article-date-ut (&optional type)
+  "Convert DATE date to universal time in the current article.
+If TYPE is `local', convert to local time; if it is `lapsed', output
+how much time has lapsed since DATE."
+  (interactive (list 'ut))
+  (let ((date (header-date (or gnus-current-headers 
+                              (gnus-get-header-by-number
+                               (gnus-summary-article-number)))))
+       (date-regexp "^Date: \\|^X-Sent: "))
+    (save-excursion
       (set-buffer gnus-article-buffer)
       (let ((buffer-read-only nil))
-       (widen)
        (goto-char (point-min))
-       (while (re-search-forward "=[0-9A-F][0-9A-F]" nil t)
-         (replace-match 
-          (char-to-string 
-           (+
-            (* 16 (gnus-hex-char-to-integer 
-                   (char-after (1+ (match-beginning 0)))))
-            (gnus-hex-char-to-integer
-             (char-after (1- (match-end 0))))))))))))
-
-;; Taken from hexl.el.
-(defun gnus-hex-char-to-integer (character)
-  "Take a char and return its value as if it was a hex digit."
-  (if (and (>= character ?0) (<= character ?9))
-      (- character ?0)
-    (let ((ch (logior character 32)))
-      (if (and (>= ch ?a) (<= ch ?f))
-         (- ch (- ?a 10))
-       (error (format "Invalid hex digit `%c'." ch))))))
+       (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: " (timezone-make-date-arpa-standard date) "\n"))
+         ((eq type 'ut)
+          (concat "Date: " (timezone-make-date-arpa-standard date nil "UT")
+                  "\n"))
+         ((eq type 'lapsed)
+          (let* ((sec (- (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"))))
+                 (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)))
+                 num prev)
+            (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))))
+              units "")
+             " ago\n")))
+         (t
+          (error "Unknown conversion type: %s" type))))))))
+
+(defun gnus-article-date-local ()
+  "Convert the current article date to the local timezone."
+  (interactive)
+  (gnus-article-date-ut 'local))
+
+(defun gnus-article-date-lapsed ()
+  "Convert the current article date to time lapsed since it was sent."
+  (interactive)
+  (gnus-article-date-ut 'lapsed))
+
+(defun gnus-article-maybe-highlight ()
+  (if gnus-visual (gnus-article-highlight)))
 
 ;; Article savers.
 
@@ -9687,7 +9950,7 @@ written."
          (set-buffer outbuf)
          (let ((buffer-read-only nil)
                (msg (and (boundp 'rmail-current-message)
-                         rmail-current-message)))
+                         (symbol-value 'rmail-current-message))))
            ;; If MSG is non-nil, buffer is in RMAIL mode.
            (if msg
                (progn (widen)
@@ -9729,7 +9992,7 @@ written."
     (goto-char (point-min))
     (insert "\^L\n0, unseen,,\n*** EOOH ***\n")
     (while (search-forward "\n\^_" nil t) ;single char
-      (replace-match "\n^_"))          ;2 chars: "^" and "_"
+      (replace-match "\n^_" t t))              ;2 chars: "^" and "_"
     (goto-char (point-max))
     (insert "\^_")))
 
@@ -9840,50 +10103,42 @@ Argument LINES specifies lines to be scrolled down."
        (gnus-summary-refer-article message-id))
     (error "No references around point")))
 
-(defun gnus-article-mail (yank)
-  "Send a reply to the address near point.
-If YANK is non-nil, include the original article."
-  (interactive "P")
-  (let ((address 
-        (buffer-substring
-         (save-excursion (re-search-backward "[ \t\n]" nil t) (1+ (point)))
-         (save-excursion (re-search-forward "[ \t\n]" nil t) (1- (point))))))
-    (and address
-        (progn
-          (switch-to-buffer gnus-summary-buffer)
-          (funcall gnus-mail-reply-method yank address)))))
-
-(defun gnus-article-mail-with-original ()
-  "Send a reply to the address near point and include the original article."
-  (interactive)
-  (gnus-article-mail 'yank))
-
 (defun gnus-article-show-summary ()
   "Reconfigure windows to show summary buffer."
   (interactive)
   (gnus-configure-windows 'article)
-  (pop-to-buffer gnus-summary-buffer)
   (gnus-summary-goto-subject gnus-current-article))
 
 (defun gnus-article-describe-briefly ()
   "Describe article mode commands briefly."
   (interactive)
-  (message
+  (gnus-message 6
    (substitute-command-keys "\\<gnus-article-mode-map>\\[gnus-article-next-page]:Next page  \\[gnus-article-prev-page]:Prev page  \\[gnus-article-show-summary]:Show summary  \\[gnus-info-find-node]:Run Info  \\[gnus-article-describe-briefly]:This help")))
 
 (defun gnus-article-summary-command ()
   "Execute the last keystroke in the summary buffer."
   (interactive)
-  (message "                                                                              ")
   (let ((obuf (current-buffer))
-       (owin (current-window-configuration)))
+       (owin (current-window-configuration))
+       func)
     (switch-to-buffer gnus-summary-buffer 'norecord)
-    (execute-kbd-macro (this-command-keys))
+    (setq func (lookup-key (current-local-map) (this-command-keys)))
+    (call-interactively func)
     (set-buffer obuf)
     (let ((npoint (point)))
       (set-window-configuration owin)
       (set-window-start (get-buffer-window (current-buffer)) (point)))))
 
+(defun gnus-article-summary-command-nosave ()
+  "Execute the last keystroke in the summary buffer."
+  (interactive)
+  (let ((obuf (current-buffer))
+       (owin (current-window-configuration))
+       func)
+    (switch-to-buffer gnus-summary-buffer 'norecord)
+    (setq func (lookup-key (current-local-map) (this-command-keys)))
+    (call-interactively func)))
+
 ;; caesar-region written by phr@prep.ai.mit.edu  Nov 86
 ;; Modified by tower@prep Nov 86
 ;; Modified by umerin@flab.flab.Fujitsu.JUNET for ROT47.
@@ -9904,7 +10159,7 @@ ROT47 will be performed for Japanese text in any case."
            (let ((i 0) 
                  (lower "abcdefghijklmnopqrstuvwxyz")
                  upper)
-             (message "Building caesar-translate-table...")
+             (gnus-message 9 "Building caesar-translate-table...")
              (setq caesar-translate-table (make-vector 256 0))
              (while (< i 256)
                (aset caesar-translate-table i i)
@@ -9928,7 +10183,7 @@ ROT47 will be performed for Japanese text in any case."
                          (if (<= v t1) (if (< v t2) v (+ v 47))
                            (if (<= v t3) (- v 47) v))))
                  (setq i (1+ i))))
-             (message "Building caesar-translate-table... done")))
+             (gnus-message 9 "Building caesar-translate-table... done")))
        (let ((from (region-beginning))
              (to (region-end))
              (i 0) str len)
@@ -9955,7 +10210,7 @@ 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
-         (gnus-parse-n-options
+         (gnus-newsrc-parse-options
           (apply (function concat)
                  (mapcar (lambda (g) (concat g " "))
                          command-line-args-left))))
@@ -9972,11 +10227,11 @@ score the alt hierarchy, you'd say \"!alt.all\"."
     ;; Start Gnus.
     (gnus)
     ;; Apply kills to specified newsgroups in command line arguments.
-    (setq newsrc (cdr gnus-newsrc-assoc))
+    (setq newsrc (cdr gnus-newsrc-alist))
     (while newsrc
       (setq group (car (car newsrc)))
       (setq entry (gnus-gethash group gnus-newsrc-hashtb))
-      (if (and (<= (nth 1 (car newsrc)) 5)
+      (if (and (<= (nth 1 (car newsrc)) gnus-level-subscribed)
               (and (car entry)
                    (or (eq (car entry) t)
                        (not (zerop (car entry)))))
@@ -10031,2089 +10286,13 @@ If NEWSGROUP is nil, return the global kill file name instead."
 
 \f
 ;;;
-;;; Gnus Score Files
+;;; Dribble file
 ;;;
 
-;; All score code written by Per Abrahamsen <abraham@iesd.auc.dk>.
+(defvar gnus-dribble-ignore nil)
 
-;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
-(defun gnus-score-set-mark-below (score)
-  "Automatically mark articles with score below SCORE as read."
-  (interactive 
-   (list (or (and current-prefix-arg (prefix-numeric-value current-prefix-arg))
-            (string-to-int (read-string "Mark below: ")))))
-  (setq score (or score gnus-summary-default-score 0))
-  (gnus-score-set 'mark (list score))
-  (gnus-score-set 'touched '(t))
-  (setq gnus-summary-mark-below score)
-  (gnus-summary-update-lines))
-
-(defun gnus-score-set-expunge-below (score)
-  "Automatically expunge articles with score below SCORE."
-  (interactive 
-   (list (or (and current-prefix-arg (prefix-numeric-value current-prefix-arg))
-            (string-to-int (read-string "Expunge below: ")))))
-  (setq score (or score gnus-summary-default-score 0))
-  (gnus-score-set 'expunge (list score))
-  (gnus-score-set 'touched '(t)))
-
-(defun gnus-score-default (level)
-  (if level (prefix-numeric-value level) 
-    gnus-score-interactive-default-score))
-
-(defun gnus-score-set (symbol value &optional alist)
-  ;; Set SYMBOL to VALUE in ALIST.
-  (let* ((alist 
-         (or alist 
-             gnus-score-alist
-             (progn
-               (gnus-score-load (gnus-score-file-name gnus-newsgroup-name))
-               gnus-score-alist)))
-        (entry (assoc symbol alist)))
-    (cond ((gnus-score-get 'read-only alist)
-          ;; This is a read-only score file, so we do nothing.
-          )
-         (entry
-          (setcdr entry value))
-         ((null alist)
-          (error "Empty alist"))
-         (t
-          (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
-   (list (completing-read "Score file: " gnus-score-cache)))
-  (setq gnus-current-score-file file)
-  (gnus-score-load-file file))
-
-(defun gnus-score-edit-alist (file)
-  "Edit the current score alist."
-  (interactive (list gnus-current-score-file))
-  (and (buffer-name gnus-summary-buffer) (gnus-score-save))
-  (setq gnus-winconf-edit-score (current-window-configuration))
-  (gnus-configure-windows 'article)
-  (pop-to-buffer (find-file-noselect file))
-  (message (substitute-command-keys 
-           "\\<gnus-score-mode-map>\\[gnus-score-edit-done] to save edits"))
-  (gnus-score-mode))
-  
-(defun gnus-score-edit-file (file)
-  "Edit a score file."
-  (interactive 
-   (list (read-file-name "Edit score file: " gnus-kill-files-directory)))
-  (and (buffer-name gnus-summary-buffer) (gnus-score-save))
-  (setq gnus-winconf-edit-score (current-window-configuration))
-  (gnus-configure-windows 'article)
-  (pop-to-buffer (find-file-noselect file))
-  (message (substitute-command-keys 
-           "\\<gnus-score-mode-map>\\[gnus-score-edit-done] to save edits"))
-  (gnus-score-mode))
-  
-(defun gnus-score-load-file (file)
-  ;; Load score file FILE.  Returns a list a retrieved score-alists.
-  (setq gnus-kill-files-directory (or gnus-kill-files-directory "~/News/"))
-  (let* ((file (expand-file-name 
-               (or (and (string-match
-                         (concat "^" (expand-file-name
-                                      gnus-kill-files-directory)) 
-                         (expand-file-name file))
-                        file)
-                   (concat gnus-kill-files-directory file))))
-        (cached (assoc file gnus-score-cache))
-        (global (member file gnus-internal-global-score-files))
-        lists alist)
-    (if cached
-       ;; The score file was already loaded.
-       (setq alist (cdr cached))
-      ;; We load the score file.
-      (setq gnus-score-alist nil)
-      (setq alist (gnus-score-load-score-alist file))
-      ;; We add '(touched) to the alist to signify that it hasn't been
-      ;; touched (yet). 
-      (or (assq 'touched alist) (setq alist (cons (list 'touched nil) alist)))
-      ;; If it is a global score file, we make it read-only.
-      (and global
-          (not (assq 'read-only alist))
-          (setq alist (cons (list 'read-only t) alist)))
-      ;; Update cache.
-      (setq gnus-score-cache
-           (cons (cons file alist) gnus-score-cache)))
-    ;; If there are actual scores in the alist, we add it to the
-    ;; return value of this function.
-    (if (memq t (mapcar (lambda (e) (stringp (car e))) alist))
-       (setq lists (list alist)))
-    ;; Treat the other possible atoms in the score alist.
-    (let ((mark (car (gnus-score-get 'mark alist)))
-         (expunge (car (gnus-score-get 'expunge alist)))
-         (mark-and-expunge 
-          (car (gnus-score-get 'mark-and-expunge alist)))
-         (read-only (gnus-score-get 'read-only alist))
-         (files (gnus-score-get 'files alist))
-         (exclude-files (gnus-score-get 'exclude-files alist))
-          (orphan (gnus-score-get 'orphan alist))
-         (eval (gnus-score-get 'eval alist)))
-      ;; We do not respect eval and files atoms from global score
-      ;; files. 
-      (and files (not global)
-          (setq lists (apply 'append lists
-                             (mapcar (lambda (file)
-                                       (gnus-score-load-file file)) 
-                                     files))))
-      (and eval (not global) (eval eval))
-      (setq gnus-scores-exclude-files exclude-files)
-      (if orphan (setq gnus-orphan-score (car orphan)))
-      (setq gnus-summary-mark-below 
-           (or mark mark-and-expunge gnus-summary-mark-below))
-      (setq gnus-summary-expunge-below 
-           (or expunge mark-and-expunge gnus-summary-expunge-below)))
-    (setq gnus-current-score-file file)
-    (setq gnus-score-alist alist)
-    lists))
-
-(defun gnus-score-load (file)
-  ;; Load score FILE.
-  (let ((cache (assoc file gnus-score-cache)))
-    (if cache
-       (setq gnus-score-alist (cdr cache))
-      (setq gnus-score-alist nil)
-      (gnus-score-load-score-alist file)
-      (or gnus-score-alist
-         (setq gnus-score-alist (copy-alist '((touched nil)))))
-      (setq gnus-score-cache
-           (cons (cons file gnus-score-alist) gnus-score-cache)))))
-
-(defun gnus-score-remove-from-cache (file)
-  (setq gnus-score-cache 
-       (delq (assoc file gnus-score-cache) gnus-score-cache)))
-
-(defun gnus-score-load-score-alist (file)
-  (let (alist)
-    (if (file-readable-p file)
-       (progn
-         (save-excursion
-           (set-buffer (get-buffer-create " *gnus work*"))
-           (buffer-disable-undo (current-buffer))
-           (erase-buffer)
-           (insert-file-contents file)
-           (goto-char (point-min))
-           ;; Only do the loading if the score file isn't empty.
-           (if (save-excursion (re-search-forward "[()0-9a-zA-Z]" nil t))
-               (setq alist
-                     (condition-case ()
-                         (read (current-buffer))
-                       (error 
-                        (progn
-                          (message "Problem with score file %s" file)
-                          (ding) 
-                          (sit-for 2)
-                          nil))))))
-         (if (eq (car alist) 'setq)
-             (setq gnus-score-alist (gnus-score-transform-old-to-new alist))
-           (setq gnus-score-alist alist))
-         (setq gnus-score-alist
-               (gnus-score-check-syntax gnus-score-alist)))
-      (setq gnus-score-alist nil))))
-
-(defun gnus-score-check-syntax (alist)
-  (cond 
-   ((null alist)
-    nil)
-   ((not (consp alist))
-    (message "Score file is not a list: %s" alist)
-    (ding)
-    nil)
-   (t
-    (let ((a alist)
-         err)
-      (while (and a (not err))
-       (cond ((not (listp (car a)))
-              (message "Illegal score element: %s" (car a))
-              (setq err t))
-             ((and (stringp (car (car a)))
-                   (not (listp (nth 1 (car a)))))
-              (message "Illegal header match: %s" (nth 1 (car a)))
-              (setq err t))
-             (t
-              (setq a (cdr a)))))
-      (if err
-         (progn
-           (ding)
-           nil)
-       alist)))))    
-
-(defun gnus-score-transform-old-to-new (alist)
-  (let* ((alist (nth 2 alist))
-        out entry)
-    (if (eq (car alist) 'quote)
-       (setq alist (nth 1 alist)))
-    (while alist
-      (setq entry (car alist))
-      (if (stringp (car entry))
-         (let ((scor (cdr entry)))
-           (setq out (cons entry out))
-           (while scor
-             (setcar scor
-                     (list (car (car scor)) (nth 2 (car scor))
-                           (and (nth 3 (car scor))
-                                (gnus-day-number (nth 3 (car scor))))
-                           (if (nth 1 (car scor)) 'r 's)))
-             (setq scor (cdr scor))))
-       (setq out (cons (if (not (listp (cdr entry))) 
-                           (list (car entry) (cdr entry))
-                         entry)
-                       out)))
-      (setq alist (cdr alist)))
-    (cons (list 'touched t) (nreverse out))))
-  
-(defun gnus-score-save ()
-  ;; Save all SCORE information.
-  (let ((cache gnus-score-cache))
-    (save-excursion
-      (setq gnus-score-alist nil)
-      (set-buffer (get-buffer-create "*Score*"))
-      (buffer-disable-undo (current-buffer))
-      (let (entry score file)
-       (while cache
-         (setq entry (car cache)
-               cache (cdr cache)
-               file (car entry)
-               score (cdr entry))
-         (if (or (not (equal (gnus-score-get 'touched score) '(t)))
-                 (gnus-score-get 'read-only score)
-                 (not (file-writable-p file)))
-             ()
-           (setq score (delq (assq 'touched score) score))
-           (erase-buffer)
-           (let (emacs-lisp-mode-hook)
-             (pp score (current-buffer)))
-           (gnus-make-directory (file-name-directory file))
-           (write-region (point-min) (point-max) file nil 'silent))))
-      (kill-buffer (current-buffer)))))
-  
-(defun gnus-score-headers ()
-  ;; Score `gnus-newsgroup-headers'.
-  (let ((func gnus-score-find-score-files-function)
-       score-files scores)
-    (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.
-    (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)))
-    ;; PLM: probably this is not the best place to clear orphan-score
-    (setq gnus-orphan-score nil)
-    ;; Load the SCORE files.
-    (while score-files
-      (if (stringp (car score-files))
-         ;; It is a string, which means that it's a score file name,
-         ;; so we load the score file and add the score alist to
-         ;; the list of alists.
-         (setq scores (nconc (gnus-score-load-file (car score-files)) scores))
-       ;; It is an alist, so we just add it to the list directly.
-       (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)
-       ()
-      (let ((s scores)
-           c)
-       (while s
-         (and (setq c (rassq (car s) gnus-score-cache))
-              (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))))
-       ()
-      (let* ((entries gnus-header-index)
-            (now (gnus-day-number (current-time-string)))
-            (expire (- now gnus-score-expiry-days))
-            (headers gnus-newsgroup-headers)
-            entry header)
-       (message "Scoring...")
-       ;; Create articles, an alist of the form `(HEADER . SCORE)'.
-       (while headers
-         (setq header (car headers)
-               headers (cdr headers))
-         ;; WARNING: The assq makes the function O(N*S) while it could
-         ;; be written as O(N+S), where N is (length gnus-newsgroup-headers)
-         ;; and S is (length gnus-newsgroup-scored).
-         (or (assq (header-number header) gnus-newsgroup-scored)
-             (setq gnus-scores-articles       ;Total of 2 * N cons-cells used.
-                   (cons (cons header (or gnus-summary-default-score 0))
-                         gnus-scores-articles))))
-
-       (save-excursion
-         (set-buffer (get-buffer-create "*Headers*"))
-         (buffer-disable-undo (current-buffer))
-          ;; score orphans
-          (if gnus-orphan-score 
-              (progn
-                (setq gnus-score-index 
-                      (nth 1 (assoc "references" gnus-header-index)))
-                (gnus-score-orphans gnus-orphan-score)))
-         ;; Run each header through the score process.
-         (while entries
-           (setq entry (car entries)
-                 header (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)))
-               (funcall (nth 2 entry) scores header now expire)))
-         ;; Remove the buffer.
-         (kill-buffer (current-buffer)))
-
-       ;; Add articles to `gnus-newsgroup-scored'.
-       (while gnus-scores-articles
-         (or (= gnus-summary-default-score (cdr (car gnus-scores-articles)))
-             (setq gnus-newsgroup-scored
-                   (cons (cons (header-number 
-                                (car (car gnus-scores-articles)))
-                               (cdr (car gnus-scores-articles)))
-                         gnus-newsgroup-scored)))
-         (setq gnus-scores-articles (cdr gnus-scores-articles)))
-
-       (message "Scoring...done")))))
-
-
-(defun gnus-get-new-thread-ids (articles)
-  (let ((index (nth 1 (assoc "message-id" gnus-header-index)))
-        (refind gnus-score-index)
-        id-list art this tref)
-    (while articles
-      (setq art (car articles)
-            this (aref (car art) index)
-            tref (aref (car art) refind)
-            articles (cdr articles))
-      (if (string-equal tref "")        ;no references line
-          (setq id-list (cons this id-list))))
-    id-list))
-
-;; Orphan functions written by plm@atcmp.nl (Peter Mutsaers).
-(defun gnus-score-orphans (score)
-  (let ((new-thread-ids (gnus-get-new-thread-ids gnus-scores-articles))
-        (index (nth 1 (assoc "references" gnus-header-index)))
-        alike articles art arts this last this-id)
-    
-    (setq gnus-scores-articles (sort gnus-scores-articles 'gnus-score-string<)
-         articles gnus-scores-articles)
-
-    ;;more or less the same as in gnus-score-string
-    (erase-buffer)
-    (while articles
-      (setq art (car articles)
-            this (aref (car art) gnus-score-index)
-            articles (cdr articles))
-      ;;completely skip if this is empty (not a child, so not an orphan)
-      (if (not (string= this ""))
-          (if (equal last this)
-              ;; O(N*H) cons-cells used here, where H is the number of
-              ;; headers.
-              (setq alike (cons art alike))
-            (if last
-                (progn
-                  ;; Insert the line, with a text property on the
-                  ;; terminating newline refering to the articles with
-                  ;; this line.
-                  (insert last ?\n)
-                  (put-text-property (1- (point)) (point) 'articles alike)))
-            (setq alike (list art)
-                  last this))))
-    (and last                           ; Bwadr, duplicate code.
-         (progn
-           (insert last ?\n)                    
-           (put-text-property (1- (point)) (point) 'articles alike)))
-
-    ;; PLM: now delete those lines that contain an entry from new-thread-ids
-    (while new-thread-ids
-      (setq this-id (car new-thread-ids)
-            new-thread-ids (cdr new-thread-ids))
-      (goto-char (point-min))
-      (while (search-forward this-id nil t)
-        ;; found a match. remove this line
-        (progn
-          (beginning-of-line)
-          (kill-line 1))))
-
-    ;; now for each line: update its articles with score by moving to
-    ;; every end-of-line in the buffer and read the articles property
-    (goto-char (point-min))
-    (while (eq 0 (progn
-                   (end-of-line)
-                   (setq arts (get-text-property (point) 'articles))
-                   (while arts
-                     (setq art (car arts)
-                           arts (cdr arts))
-                     (setcdr art (+ score (cdr art))))
-                   (forward-line))))))
-             
-
-(defun gnus-score-integer (scores header now expire)
-  (let ((gnus-score-index (nth 1 (assoc header gnus-header-index)))
-       alike last this art entries alist articles)
-
-    ;; Find matches.
-    (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) '>))
-              (score (or (nth 1 kill) gnus-score-interactive-default-score))
-              (date (nth 2 kill))
-              (found nil)
-              (match-func (if (or (eq type '>) (eq type '<) (eq type '<=)
-                                  (eq type '>=) (eq type '=))
-                              type
-                            (error "Illegal match type: %s" type)))
-              (articles gnus-scores-articles)
-              arts art)
-         ;; Instead of doing all the clever stuff that
-         ;; `gnus-score-string' does to minimize searches and stuff,
-         ;; I will assume that people generally will put so few
-         ;; matches on numbers that any cleverness will take more
-         ;; time than one would gain.
-         (while articles
-           (and (funcall match-func match 
-                         (or (aref (car (car articles)) gnus-score-index) 0))
-                (progn
-                  (setq found t)
-                  (setcdr (car articles) (+ score (cdr (car articles))))))
-           (setq articles (cdr articles)))
-         ;; 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))))))
-
-(defun gnus-score-date (scores header now expire)
-  (let ((gnus-score-index (nth 1 (assoc header gnus-header-index)))
-       alike last this art entries alist articles)
-
-    ;; Find matches.
-    (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 (timezone-make-date-sortable (nth 0 kill)))
-              (type (or (nth 3 kill) 'before))
-              (score (or (nth 1 kill) gnus-score-interactive-default-score))
-              (date (nth 2 kill))
-              (found nil)
-              (match-func 
-               (cond ((eq type 'after) 'string<)
-                     ((eq type 'before) 'gnus-string>)
-                     ((eq type 'at) 'string=)
-                     (t (error "Illegal match type: %s" type))))
-              (articles gnus-scores-articles)
-              arts art l)
-         ;; Instead of doing all the clever stuff that
-         ;; `gnus-score-string' does to minimize searches and stuff,
-         ;; I will assume that people generally will put so few
-         ;; matches on numbers that any cleverness will take more
-         ;; time than one would gain.
-         (while articles
-           (and
-            (setq l (aref (car (car articles)) gnus-score-index))
-            (funcall match-func match (timezone-make-date-sortable l))
-            (progn
-              (setq found t)
-              (setcdr (car articles) (+ score (cdr (car articles))))))
-           (setq articles (cdr articles)))
-         ;; 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))))))
-
-(defun gnus-score-body (scores header now expire)
-  (save-excursion
-    (set-buffer nntp-server-buffer)
-    (save-restriction
-      (let* ((buffer-read-only nil)
-            (articles gnus-scores-articles)
-            (all-scores scores)
-            (request-func (cond ((string= "head" (downcase header))
-                                 'gnus-request-head)
-                                ((string= "body" (downcase header))
-                                 'gnus-request-body)
-                                (t 'gnus-request-article)))
-            alike last this art entries alist ofunc article)
-       ;; Not all backends support partial fetching.  In that case,
-       ;; we just fetch the entire article.
-       (or (gnus-check-backend-function request-func gnus-newsgroup-name)
-           (progn
-             (setq ofunc request-func)
-             (setq request-func 'gnus-request-article)))
-       (while articles
-         (setq article (header-number (car (car articles))))
-         (message "Scoring on article %s..." article)
-         (if (not (funcall request-func article gnus-newsgroup-name))
-             ()
-           (widen)
-           (goto-char (point-min))
-           ;; If just parts of the article is to be searched, but the
-           ;; backend didn't support partial fetching, we just narrow
-           ;; to the relevant parts.
-           (if ofunc
-               (if (eq ofunc 'gnus-request-head)
-                   (narrow-to-region
-                    (point)
-                    (or (search-forward "\n\n" nil t) (point-max)))
-                 (narrow-to-region
-                  (or (search-forward "\n\n" nil t) (point))
-                  (point-max))))
-           (setq scores all-scores)
-           ;; Find matches.
-           (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)
-                      (case-fold-search 
-                       (not (or (eq type 'R) (eq type 'S)
-                                (eq type 'Regexp) (eq type 'String))))
-                      (search-func 
-                       (cond ((or (eq type 'r) (eq type 'R)
-                                  (eq type 'regexp) (eq type 'Regexp))
-                              're-search-forward)
-                             ((or (eq type 's) (eq type 'S)
-                                  (eq type 'string) (eq type 'String))
-                              'search-forward)
-                             (t
-                              (error "Illegal match type: %s" type))))
-                      arts art)
-                 (goto-char (point-min))
-                 (if (funcall search-func match nil t)
-                     ;; Found a match, update scores.
-                     (progn
-                       (setcdr (car articles) (+ score (cdr (car articles))))
-                       (setq found t)))
-                 ;; 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)))))
-         (setq articles (cdr articles)))))))
-
-(defun gnus-score-string (scores header now expire)
-  ;; Score ARTICLES according to HEADER in SCORES.
-  ;; Update matches entries to NOW and remove unmatched entried older
-  ;; than EXPIRE.
-  
-  ;; Insert the unique article headers in the buffer.
-  (let ((gnus-score-index (nth 1 (assoc header gnus-header-index)))
-       ;; gnus-score-index is used as a free variable.
-       alike last this art entries alist articles)
-
-    ;; Sorting the articles costs os O(N*log N) but will allow us to
-    ;; only match with each unique header.  Thus the actual matching
-    ;; will be O(M*U) where M is the number of strings to match with,
-    ;; and U is the number of unique headers.  It is assumed (but
-    ;; untested) this will be a net win because of the large constant
-    ;; factor involved with string matching.
-    (setq gnus-scores-articles (sort gnus-scores-articles 'gnus-score-string<)
-         articles gnus-scores-articles)
-
-    (erase-buffer)
-    (while articles
-      (setq art (car articles)
-           this (aref (car art) gnus-score-index)
-           articles (cdr articles))
-      (if (equal last this)
-         ;; O(N*H) cons-cells used here, where H is the number of
-         ;; headers.
-         (setq alike (cons art alike))
-       (if last
-           (progn
-             ;; Insert the line, with a text property on the
-             ;; terminating newline refering to the articles with
-             ;; this line.
-             (insert last ?\n)
-             (put-text-property (1- (point)) (point) 'articles alike)))
-       (setq alike (list art)
-             last this)))
-    (and last                          ; Bwadr, duplicate code.
-        (progn
-          (insert last ?\n)                    
-          (put-text-property (1- (point)) (point) 'articles alike)))
-  
-    ;; Find matches.
-    (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)
-              (case-fold-search 
-               (not (or (eq type 'R) (eq type 'S)
-                        (eq type 'Regexp) (eq type 'String))))
-              (search-func (cond ((or (eq type 'r) (eq type 'R)
-                                      (eq type 'regexp) (eq type 'Regexp))
-                                  're-search-forward)
-                                 ((or (eq type 's) (eq type 'S)
-                                      (eq type 'string) (eq type 'String))
-                                  'search-forward)
-                                 (t
-                                  (error "Illegal match type: %s" type))))
-              arts art)
-         (goto-char (point-min))
-         (while (funcall search-func match nil t)
-           (end-of-line 1)
-           (setq found t
-                 arts (get-text-property (point) 'articles))
-           ;; Found a match, update scores.
-           (while arts
-             (setq art (car arts)
-                   arts (cdr arts))
-             (setcdr art (+ score (cdr art)))))
-         ;; 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))))))
-
-(defun gnus-score-string< (a1 a2)
-  ;; Compare headers in articles A2 and A2.
-  ;; The header index used is the free variable `gnus-score-index'.
-  (string-lessp (aref (car a1) gnus-score-index)
-               (aref (car a2) gnus-score-index)))
-
-(defun gnus-score-build-cons (article)
-  ;; Build a `gnus-newsgroup-scored' type cons from ARTICLE.
-  (cons (header-number (car article)) (cdr article)))
-
-(defconst gnus-header-index
-  ;; Name to index alist.
-  '(("number" 0 gnus-score-integer)
-    ("subject" 1 gnus-score-string)
-    ("from" 2 gnus-score-string)
-    ("date" 3 gnus-score-date)
-    ("message-id" 4 gnus-score-string) 
-    ("references" 5 gnus-score-string) 
-    ("chars" 6 gnus-score-integer) 
-    ("lines" 7 gnus-score-integer) 
-    ("xref" 8 gnus-score-string)
-    ("head" -1 gnus-score-body)
-    ("body" -1 gnus-score-body)
-    ("all" -1 gnus-score-body)))
-
-(defun gnus-score-file-name (newsgroup)
-  "Return the name of a score file for NEWSGROUP."
-  (cond  ((or (null newsgroup)
-             (string-equal newsgroup ""))
-         ;; The global score file is placed at top of the directory.
-         (expand-file-name gnus-score-file-suffix
-                           (or gnus-kill-files-directory "~/News")))
-        ((gnus-use-long-file-name 'not-score)
-         ;; Append ".SCORE" to newsgroup name.
-         (expand-file-name (concat newsgroup "." gnus-score-file-suffix)
-                           (or gnus-kill-files-directory "~/News")))
-        (t
-         ;; Place "SCORE" under the hierarchical directory.
-         (expand-file-name (concat (gnus-newsgroup-directory-form newsgroup)
-                                   "/" gnus-score-file-suffix)
-                           (or gnus-kill-files-directory "~/News")))))
-
-(defun gnus-score-score-files (group)
-  "Return a list of all possible score files."
-  (and gnus-global-score-files 
-       (or gnus-internal-global-score-files
-          (gnus-score-search-global-directories gnus-global-score-files)))
-  (setq gnus-kill-files-directory 
-       (file-name-as-directory
-        (or gnus-kill-files-directory "~/News/")))
-  (if (not (file-readable-p gnus-kill-files-directory))
-      (setq gnus-score-file-list nil)
-    (if (gnus-use-long-file-name 'not-score)
-       (if (or (not 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
-                           (concat gnus-score-file-suffix "$"))))))
-      (let ((dir (expand-file-name
-                 (concat gnus-kill-files-directory
-                         (gnus-replace-chars-in-string group ?. ?/))))
-           (mdir (length (expand-file-name gnus-kill-files-directory)))
-           files)
-       (if (file-exists-p (concat dir "/" gnus-score-file-suffix))
-           (setq files (list (concat dir "/" gnus-score-file-suffix))))
-       (while (>= (1+ (length dir)) mdir)
-         (and (file-exists-p (concat dir "/all/" gnus-score-file-suffix))
-              (setq files (cons (concat dir "/all/" gnus-score-file-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-find-single (group)
-  "Return list containing the score file for GROUP."
-  (list (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))
-    (mapcar 'gnus-score-file-name (nreverse all))))
-
-(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 1)
-       ;; First remove the suffix itself.
-       (re-search-forward (concat "." gnus-score-file-suffix "$"))
-       (replace-match "") 
-       (goto-char 1)
-       (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)))
-       ;; Translate "all" to ".*".
-       (while (search-forward "all" nil t)
-         (replace-match ".*"))
-       (goto-char 1)
-       ;; 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
-            (expand-file-name
-             (if (gnus-use-long-file-name 'not-score)
-                 (concat gnus-kill-files-directory group "." 
-                         gnus-score-file-suffix)
-               (concat gnus-kill-files-directory
-                       (gnus-replace-chars-in-string group ?. ?/)
-                       "/" gnus-score-file-suffix)))))
-       (and (member localscore ofiles)
-            (delete localscore ofiles))
-       (setq ofiles (cons localscore ofiles)))
-      (nreverse ofiles))))
-
-(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-suffix "$"))))
-       (setq out (cons (car files) out)))
-      (setq files (cdr files)))
-    (setq gnus-internal-global-score-files out)))
-
-;;;
-;;; Score mode.
-;;;
-
-(defvar gnus-score-mode-map nil)
-(defvar gnus-score-mode-hook nil)
-
-(if gnus-score-mode-map
-    ()
-  (setq gnus-score-mode-map (copy-keymap emacs-lisp-mode-map))
-  (define-key gnus-score-mode-map "\C-c\C-c" 'gnus-score-edit-done)
-  (define-key gnus-score-mode-map "\C-c\C-d" 'gnus-score-edit-insert-date))
-
-(defun gnus-score-mode ()
-  "Mode for editing score files.
-This mode is an extended emacs-lisp mode.
-
-\\{gnus-score-mode-map}"
-  (interactive)
-  (kill-all-local-variables)
-  (use-local-map gnus-score-mode-map)
-  (set-syntax-table emacs-lisp-mode-syntax-table)
-  (setq major-mode 'gnus-score-mode)
-  (setq mode-name "Score")
-  (lisp-mode-variables nil)
-  (run-hooks 'emacs-lisp-mode-hook 'gnus-score-mode-hook))
-
-(defun gnus-score-edit-insert-date ()
-  "Insert date in numerical format."
-  (interactive)
-  (insert (int-to-string (gnus-day-number (current-time-string)))))
-
-(defun gnus-score-edit-done ()
-  "Save the score file and return to the summary buffer."
-  (interactive)
-  (let ((bufnam (buffer-file-name (current-buffer))))
-    (save-buffer)
-    (kill-buffer (current-buffer))
-    (and gnus-winconf-edit-score
-        (set-window-configuration gnus-winconf-edit-score))
-    (gnus-score-remove-from-cache bufnam)
-    (gnus-score-load-file bufnam)))
-
-\f
-;;;
-;;; Gnus Posting Functions
-;;;
-
-(defvar gnus-organization-file "/usr/lib/news/organization"
-  "*Local news organization file.")
-
-(defvar gnus-post-news-buffer "*post-news*")
-(defvar gnus-winconf-post-news nil)
-
-;;; Post news commands of Gnus group mode and summary mode
-
-(defun gnus-group-post-news ()
-  "Post an article."
-  (interactive)
-  (gnus-set-global-variables)
-  ;; Save window configuration.
-  (setq gnus-winconf-post-news (current-window-configuration))
-  (let ((gnus-newsgroup-name nil))
-    (unwind-protect
-       (gnus-post-news 'post)
-      (or (and (eq (current-buffer) (get-buffer gnus-post-news-buffer))
-              (not (zerop (buffer-size))))
-         ;; Restore last window configuration.
-         (and gnus-winconf-post-news
-              (set-window-configuration gnus-winconf-post-news)))))
-  ;; We don't want to return to summary buffer nor article buffer later.
-  (setq gnus-winconf-post-news nil)
-  (if (get-buffer gnus-summary-buffer)
-      (bury-buffer gnus-summary-buffer))
-  (if (get-buffer gnus-article-buffer)
-      (bury-buffer gnus-article-buffer)))
-
-(defun gnus-summary-post-news ()
-  "Post an article."
-  (interactive)
-  (gnus-set-global-variables)
-  ;; Save window configuration.
-  (setq gnus-winconf-post-news (current-window-configuration))
-  (unwind-protect
-      (gnus-post-news 'post gnus-newsgroup-name)
-    (or (and (eq (current-buffer) (get-buffer gnus-post-news-buffer))
-            (not (zerop (buffer-size))))
-       ;; Restore last window configuration.
-       (and gnus-winconf-post-news
-            (set-window-configuration gnus-winconf-post-news))))
-  ;; We don't want to return to article buffer later.
-  (if (get-buffer gnus-article-buffer)
-      (bury-buffer gnus-article-buffer)))
-
-(defun gnus-summary-followup (yank)
-  "Compose a followup to an article.
-If prefix argument YANK is non-nil, original article is yanked automatically."
-  (interactive "P")
-  (gnus-set-global-variables)
-  (save-window-excursion
-    (gnus-summary-select-article t))
-  (let ((headers gnus-current-headers)
-       (gnus-newsgroup-name gnus-newsgroup-name))
-    ;; Check Followup-To: poster.
-    (set-buffer gnus-article-buffer)
-    (if (and gnus-use-followup-to
-            (string-equal "poster" (gnus-fetch-field "followup-to"))
-            (or (not (eq gnus-use-followup-to t))
-                (not (gnus-y-or-n-p 
-                      "Do you want to ignore `Followup-To: poster'? "))))
-       ;; Mail to the poster.  Gnus is now RFC1036 compliant.
-       (gnus-summary-reply yank)
-      ;; Save window configuration.
-      (setq gnus-winconf-post-news (current-window-configuration))
-      (unwind-protect
-         (gnus-post-news nil gnus-newsgroup-name
-                         headers gnus-article-buffer yank)
-       (or (and (eq (current-buffer) (get-buffer gnus-post-news-buffer))
-                (not (zerop (buffer-size))))
-           ;; Restore last window configuration.
-           (and gnus-winconf-post-news
-                (set-window-configuration gnus-winconf-post-news))))
-      ;; We don't want to return to article buffer later.
-      (bury-buffer gnus-article-buffer)))
-  (gnus-article-hide-headers-if-wanted))
-
-(defun gnus-summary-followup-with-original ()
-  "Compose a followup to an article and include the original article."
-  (interactive)
-  (gnus-summary-followup t))
-
-;; Suggested by Daniel Quinlan <quinlan@best.com>.
-(defun gnus-summary-followup-and-reply (yank)
-  "Compose a followup and do an auto mail to author."
-  (interactive "P")
-  (let ((gnus-auto-mail-to-author t))
-    (gnus-summary-followup yank)))
-
-(defun gnus-summary-followup-and-reply-with-original ()
-  "Compose a followup, include the original, and do an auto mail to author."
-  (interactive)
-  (gnus-summary-followup-and-reply t))
-
-(defun gnus-summary-cancel-article ()
-  "Cancel an article you posted."
-  (interactive)
-  (gnus-set-global-variables)
-  (gnus-summary-select-article t)
-  (gnus-eval-in-buffer-window gnus-article-buffer (gnus-cancel-news))
-  (gnus-article-hide-headers-if-wanted))
-
-(defun gnus-summary-supersede-article ()
-  "Compose an article that will supersede a previous article.
-This is done simply by taking the old article and adding a Supersedes
-header line with the old Message-ID."
-  (interactive)
-  (gnus-set-global-variables)
-  (if (not
-       (string-equal
-       (downcase (mail-strip-quoted-names 
-                  (header-from gnus-current-headers)))
-       (downcase (mail-strip-quoted-names (gnus-inews-user-name)))))
-      (error "This article is not yours."))
-  (gnus-summary-select-article t)
-  (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 gnus-article-buffer)
-       (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")
-         (replace-match "Supersedes: "))
-       (search-forward "\n\n")
-       (forward-line -1)
-       (insert mail-header-separator))))
-
-\f
-;;;###autoload
-(fset 'sendnews 'gnus-post-news)
-
-;;;###autoload
-(fset 'postnews 'gnus-post-news)
-
-(defun gnus-post-news (post &optional group header article-buffer yank)
-  "Begin editing a new USENET news article to be posted.
-Type \\[describe-mode] in the buffer to get a list of commands."
-  (interactive (list t))
-  (if (or (not gnus-novice-user)
-         gnus-expert-user
-         (not (eq 'post 
-                  (nth 1 (assoc 
-                          (format "%s" (car (gnus-find-method-for-group 
-                                             gnus-newsgroup-name)))
-                          gnus-valid-select-methods))))
-         (assq 'to-address (gnus-find-method-for-group gnus-newsgroup-name))
-         (gnus-y-or-n-p "Are you sure you want to post to all of USENET? "))
-      (let ((sumart (if (not post)
-                       (save-excursion
-                         (set-buffer gnus-summary-buffer)
-                         (cons (current-buffer) gnus-current-article))))
-           (from (and header (header-from header)))
-           subject follow-to real-group)
-       (and gnus-interactive-post
-            (not gnus-expert-user)
-            post (not group)
-            (progn
-              (setq group 
-                    (completing-read "Group: " gnus-active-hashtb nil t))
-              (setq subject (read-string "Subject: "))))
-       (setq mail-reply-buffer article-buffer)
-
-       (let ((gnus-newsgroup-name (or group gnus-newsgroup-name "")))
-         (setq real-group (and group (gnus-group-real-name group)))
-         (setq gnus-post-news-buffer 
-               (gnus-request-post-buffer 
-                post real-group subject header article-buffer
-                (nth 2 (and group (gnus-gethash group gnus-newsrc-hashtb)))
-                (if (and (boundp 'gnus-followup-to-function)
-                         gnus-followup-to-function)
-                    (setq follow-to
-                          (save-excursion
-                            (set-buffer article-buffer)
-                            (funcall gnus-followup-to-function group))))
-                (eq gnus-use-followup-to t)))
-         (if post
-             (progn
-               (gnus-configure-windows '(1 0 0))
-               (switch-to-buffer gnus-post-news-buffer))
-           (gnus-configure-windows '(0 1 0))
-           (if (not yank)
-               (progn
-                 (switch-to-buffer article-buffer)
-                 (pop-to-buffer gnus-post-news-buffer))
-             (switch-to-buffer gnus-post-news-buffer)))
-         (gnus-overload-functions)
-         (make-local-variable 'gnus-article-reply)
-         (make-local-variable 'gnus-article-check-size)
-         (setq gnus-article-reply sumart)
-         ;; Handle `gnus-auto-mail-to-author'.
-         ;; Suggested by Daniel Quinlan <quinlan@best.com>.
-         (let ((to (if (eq gnus-auto-mail-to-author 'ask)
-                       (and (y-or-n-p "Also send mail to author? ") from)
-                     (and gnus-auto-mail-to-author from))))
-           (if to
-               (progn
-                 (if (mail-fetch-field "To")
-                     (progn
-                       (beginning-of-line)
-                       (insert "Cc: " to "\n"))
-                   (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)))
-         (goto-char (point-min))
-         (if post 
-             (cond ((not group)
-                    (re-search-forward "^Newsgroup:" nil t)
-                    (end-of-line))
-                   ((not subject)
-                    (re-search-forward "^Subject:" nil t)
-                    (end-of-line))
-                   (t
-                    (re-search-forward 
-                     (concat "^" (regexp-quote mail-header-separator) "$"))
-                    (forward-line 1)))
-           (re-search-forward 
-            (concat "^" (regexp-quote mail-header-separator) "$"))
-           (forward-line 1)
-           (and yank (save-excursion (news-reply-yank-original nil)))
-           (if gnus-post-prepare-function
-               (funcall gnus-post-prepare-function group))))))
-  (setq gnus-article-check-size (cons (buffer-size) (gnus-article-checksum)))
-  (message "")
-  t)
-
-(defun gnus-inews-news (&optional use-group-method)
-  "Send a news message.
-If given a prefix, and the group is a foreign group, this function
-will attempt to use the foreign server to post the article."
-  (interactive "P")
-  ;; Check whether the article is a good Net Citizen.
-  (if (and gnus-article-check-size (not (gnus-inews-check-post)))
-      ;; Aber nein!
-      ()
-    ;; Looks ok, so we do the nasty.
-    (let* ((case-fold-search nil)
-          (server-running (gnus-server-opened gnus-select-method))
-          (reply gnus-article-reply))
-      (save-excursion
-       ;; Connect to default NNTP server if necessary.
-       ;; Suggested by yuki@flab.fujitsu.junet.
-       (gnus-start-news-server)        ;Use default server.
-       ;; NNTP server must be opened before current buffer is modified.
-       (widen)
-       (goto-char (point-min))
-       (run-hooks 'news-inews-hook)
-       (save-restriction
-         (narrow-to-region
-          (point-min)
-          (progn
-            (goto-char (point-min))
-            (re-search-forward 
-             (concat "^" (regexp-quote mail-header-separator) "$"))))
-
-         ;; Correct newsgroups field: change sequence of spaces to comma and 
-         ;; eliminate spaces around commas.  Eliminate imbedded line breaks.
-         (goto-char (point-min))
-         (if (search-forward-regexp "^Newsgroups: +" nil t)
-             (save-restriction
-               (narrow-to-region
-                (point)
-                (if (re-search-forward "^[^ \t]" nil 'end)
-                    (match-beginning 0)
-                  (point-max)))
-               (goto-char (point-min))
-               (replace-regexp "\n[ \t]+" " ") ;No line breaks (too confusing)
-               (goto-char (point-min))
-               (replace-regexp "[ \t\n]*,[ \t\n]*\\|[ \t]+" ",")))
-
-         ;; Added by Per Abrahamsen <abraham@iesd.auc.dk>.
-         ;; Help save the the world!
-         (or 
-          gnus-expert-user
-          (let ((newsgroups (mail-fetch-field "newsgroups"))
-                (followup-to (mail-fetch-field "followup-to"))
-                groups to)
-            (if (and (string-match "," newsgroups) (not followup-to))
-                (progn
-                  (while (string-match "," newsgroups)
-                    (setq groups
-                          (cons (list (substring newsgroups
-                                                 0 (match-beginning 0)))
-                                groups))
-                    (setq newsgroups (substring newsgroups (match-end 0))))
-                  (setq groups (nreverse (cons (list newsgroups) groups)))
-
-                  (setq to
-                        (completing-read "Followups to: (default all groups) "
-                                         groups))
-                  (if (> (length to) 0)
-                      (progn
-                        (goto-char (point-min))
-                        (insert "Followup-To: " to "\n")))))))
-
-         ;; Cleanup Followup-To.
-         (goto-char (point-min))
-         (if (search-forward-regexp "^Followup-To: +" nil t)
-             (save-restriction
-               (narrow-to-region
-                (point)
-                (if (re-search-forward "^[^ \t]" nil 'end)
-                    (match-beginning 0)
-                  (point-max)))
-               (goto-char (point-min))
-               (replace-regexp "\n[ \t]+" " ") ;No line breaks (too confusing)
-               (goto-char (point-min))
-               (replace-regexp "[ \t\n]*,[ \t\n]*\\|[ \t]+" ",")))
-
-         ;; Mail the message too if To:, Bcc:. or Cc: exists.
-         (if (or (mail-fetch-field "to" nil t)
-                 (mail-fetch-field "bcc" nil t)
-                 (mail-fetch-field "cc" nil t))
-             (if gnus-mail-send-method
-                 (save-excursion
-                   (save-restriction
-                     (widen)
-                     (message "Sending via mail...")
-                     
-                     (if gnus-mail-courtesy-message
-                         (progn
-                           ;; Insert "courtesy" mail message.
-                           (goto-char 1)
-                           (re-search-forward
-                            (concat "^" (regexp-quote
-                                         mail-header-separator) "$"))
-                           (forward-line 1)
-                           (insert gnus-mail-courtesy-message)
-                           (funcall gnus-mail-send-method)
-                           (goto-char 1)
-                           (search-forward gnus-mail-courtesy-message)
-                           (replace-match ""))
-                       (funcall gnus-mail-send-method))
-
-                     (message "Sending via mail... done")
-                     
-                     (goto-char 1)
-                     (narrow-to-region
-                      1 (re-search-forward 
-                         (concat "^" (regexp-quote 
-                                      mail-header-separator) "$")))
-                     (goto-char 1)
-                     (delete-matching-lines "BCC:.*")))
-               (ding)
-               (message "No mailer defined.  To: and/or Cc: fields ignored.")
-               (sit-for 1))))
-
-       ;; Send to NNTP server. 
-       (message "Posting to USENET...")
-       (if (gnus-inews-article use-group-method)
-           (progn
-             (message "Posting to USENET... done")
-             (if (and reply
-                      (get-buffer (car reply))
-                      (buffer-name (car reply)))
-                 (progn
-                   (save-excursion
-                     (set-buffer gnus-summary-buffer)
-                     (gnus-summary-mark-article-as-replied 
-                      (cdr reply))))))
-         ;; We cannot signal an error.
-         (ding) (message "Article rejected: %s" 
-                         (gnus-status-message gnus-select-method)))
-       (set-buffer-modified-p nil))
-      ;; If NNTP server is opened by gnus-inews-news, close it by myself.
-      (or server-running
-         (gnus-close-server (gnus-find-method-for-group gnus-newsgroup-name)))
-      (and (fboundp 'bury-buffer) (bury-buffer))
-      ;; Restore last window configuration.
-      (and gnus-winconf-post-news
-          (set-window-configuration gnus-winconf-post-news))
-      (setq gnus-winconf-post-news nil))))
-
-(defun gnus-inews-check-post ()
-  "Check whether the post looks ok."
-  (and 
-   ;; Check excessive size.
-   (if (> (buffer-size) 60000)
-       (gnus-y-or-n-p (format "The article is %d octets long. Really post? "
-                             (buffer-size)))
-     t)
-   ;; Check for commands in Subject.
-   (save-excursion
-     (save-restriction
-       (goto-char (point-min))
-       (narrow-to-region 
-       (point) 
-       (re-search-forward 
-        (concat "^" (regexp-quote mail-header-separator) "$")))
-       (if (string-match "^cmsg " (mail-fetch-field "subject"))
-          (gnus-y-or-n-p
-           "The control code \"cmsg \" is in the subject. Really post? ")
-        t)))
-   ;; Check for control characters.
-   (save-excursion
-     (if (re-search-forward "[\000-\007\013\015-\037\200-\237]" nil t)
-        (gnus-y-or-n-p 
-         "The article contains control characters. Really post? ")
-       t))
-   ;; Check for multiple identical headers.
-   (let (found)
-     (save-excursion
-       (save-restriction
-        (goto-char (point-min))
-        (narrow-to-region
-         (point) 
-         (re-search-forward 
-          (concat "^" (regexp-quote mail-header-separator) "$")))
-        (goto-char (point-min))
-        (while (and (not found) (re-search-forward "^[^ \t:]+: " nil t))
-          (save-excursion
-            (or (re-search-forward 
-                 (concat "^" (setq found
-                                   (buffer-substring (match-beginning 0) 
-                                                     (match-end 0))))
-                 nil t)
-                (setq found nil))))
-        (if found
-            (gnus-y-or-n-p 
-             (format "Multiple %s headers. Really post? " found))
-          t))))
-   ;; Check for version and sendsys.
-   (save-excursion
-     (save-restriction
-       (goto-char (point-min))
-       (narrow-to-region
-       (point) 
-       (re-search-forward 
-        (concat "^" (regexp-quote mail-header-separator) "$")))
-       (if (re-search-backward "^Sendsys:\\|^Version:" nil t)
-          (gnus-yes-or-no-p
-           (format "The article contains a %s command. Really post? "
-                   (buffer-substring (match-beginning 0) (match-end 0))))
-        t)))
-   ;; Check the From header.
-   (save-excursion
-     (save-restriction
-       (goto-char (point-min))
-       (narrow-to-region
-       (point)
-       (re-search-forward
-        (concat "^" (regexp-quote mail-header-separator) "$")))
-       (let* ((case-fold-search t)
-             (from (mail-fetch-field "from")))
-        (if (and from
-                 (string-match "@" from)
-                 (not (string-match "@[^\\.]*\\." from)))
-            (gnus-yes-or-no-p
-             (format "The domain looks strange: \"%s\". Really post? "
-                     from))
-          t))))
-   ;; Check for long lines.
-   (save-excursion
-     (save-restriction
-       (goto-char (point-min))
-       (narrow-to-region
-       (point)
-       (re-search-forward
-        (concat "^" (regexp-quote mail-header-separator) "$")))
-       (while 
-          (and
-           (progn
-             (end-of-line)
-             (< (current-column) 80))
-           (zerop (forward-line 1))))
-       (or (eobp)
-          (gnus-yes-or-no-p
-           (format
-            "You have lines longer than 79 characters.  Really post? ")))))
-   ;; Use the (size . checksum) variable to see whether the
-   ;; article is empty or has only quoted text.
-   (if (and (= (buffer-size) (car gnus-article-check-size))
-           (= (gnus-article-checksum) (cdr gnus-article-check-size)))
-       (gnus-yes-or-no-p
-       "It looks like there's no new text in your article. Really post? ")
-     t)))
-
-(defun gnus-article-checksum ()
-  (let ((sum 0))
-    (save-excursion
-      (while (not (eobp))
-       (setq sum (logxor sum (following-char)))
-       (forward-char 1)))
-    sum))
-
-(defun gnus-cancel-news ()
-  "Cancel an article you posted."
-  (interactive)
-  (if (or gnus-expert-user
-         (gnus-yes-or-no-p "Do you really want to cancel this article? "))
-      (let ((from nil)
-           (newsgroups nil)
-           (message-id nil)
-           (distribution nil))
-       (save-excursion
-         ;; Get header info. from original article.
-         (save-restriction
-           (gnus-article-show-all-headers)
-           (goto-char (point-min))
-           (search-forward "\n\n" nil 'move)
-           (narrow-to-region (point-min) (point))
-           (setq from (mail-fetch-field "from"))
-           (setq newsgroups (mail-fetch-field "newsgroups"))
-           (setq message-id (mail-fetch-field "message-id"))
-           (setq distribution (mail-fetch-field "distribution")))
-         ;; Verify if the article is absolutely user's by comparing
-         ;; user id with value of its From: field.
-         (if (not
-              (string-equal
-               (downcase (mail-strip-quoted-names from))
-               (downcase (mail-strip-quoted-names (gnus-inews-user-name)))))
-             (progn
-               (ding) (message "This article is not yours."))
-           ;; Make control article.
-           (set-buffer (get-buffer-create " *Gnus-canceling*"))
-           (buffer-disable-undo (current-buffer))
-           (erase-buffer)
-           (insert "Newsgroups: " newsgroups "\n"
-                   "Subject: cancel " message-id "\n"
-                   "Control: cancel " message-id "\n"
-                   mail-header-separator "\n"
-                   "This is a cancel message from " from ".\n")
-           ;; Send the control article to NNTP server.
-           (message "Canceling your article...")
-           (if (gnus-inews-article)
-               (message "Canceling your article... done")
-             (ding) 
-             (message "Cancel failed; %s" 
-                      (gnus-status-message gnus-newsgroup-name)))
-           ;; Kill the article buffer.
-           (kill-buffer (current-buffer)))))))
-
-\f
-;;; Lowlevel inews interface
-
-(defun gnus-inews-article (&optional use-group-method)
-  "Post an article in current buffer using NNTP protocol."
-  (let ((artbuf (current-buffer))
-       (tmpbuf (get-buffer-create " *Gnus-posting*")))
-    (widen)
-    (goto-char (point-max))
-    ;; require a newline at the end for inews to append .signature to
-    (or (= (preceding-char) ?\n)
-       (insert ?\n))
-    ;; Prepare article headers.  All message body such as signature
-    ;; must be inserted before Lines: field is prepared.
-    (save-restriction
-      (goto-char (point-min))
-      (narrow-to-region 
-       (point-min) 
-       (save-excursion
-        (re-search-forward 
-         (concat "^" (regexp-quote mail-header-separator) "$"))
-        (match-beginning 0)))
-      (gnus-inews-insert-headers)
-      (run-hooks gnus-inews-article-header-hook)
-      (widen))
-    (save-excursion
-      (set-buffer tmpbuf)
-      (buffer-disable-undo (current-buffer))
-      (erase-buffer)
-      (insert-buffer-substring artbuf)
-      ;; Remove the header separator.
-      (goto-char (point-min))
-      (re-search-forward
-       (concat "^" (regexp-quote mail-header-separator) "$"))
-      (replace-match "")
-      ;; This hook may insert a signature.
-      (run-hooks 'gnus-prepare-article-hook)
-      ;; Run final inews hooks.  This hook may do FCC.
-      ;; The article must be saved before being posted because
-      ;; `gnus-request-post' modifies the buffer.
-      (run-hooks 'gnus-inews-article-hook)
-      ;; Post an article to NNTP server.
-      ;; Return NIL if post failed.
-      (prog1
-         (gnus-request-post 
-          (if use-group-method
-              (gnus-find-method-for-group gnus-newsgroup-name)
-            gnus-select-method) use-group-method)
-       (kill-buffer (current-buffer))))))
-
-(defun gnus-inews-insert-headers ()
-  "Prepare article headers.
-Headers already prepared in the buffer are not modified.
-Headers in `gnus-required-headers' will be generated."
-  (let ((Date (gnus-inews-date))
-       (Message-ID (gnus-inews-message-id))
-       (Organization (gnus-inews-organization))
-       (From (gnus-inews-user-name))
-       (Path (gnus-inews-path))
-       (Subject nil)
-       (Newsgroups nil)
-       (Distribution nil)
-       (Lines (gnus-inews-lines))
-       (X-Newsreader gnus-version)
-       (headers gnus-required-headers)
-       (case-fold-search t)
-       header value elem)
-    ;; First we remove any old Message-IDs. This might be slightly
-    ;; fascist, but if the user really wants to generate Message-IDs
-    ;; by herself, she should remove it from the `gnus-required-list'. 
-    (goto-char (point-min))
-    (and (memq 'Message-ID headers)
-        (re-search-forward "^Message-ID:" nil t)
-        (delete-region (progn (beginning-of-line) (point))
-                       (progn (forward-line 1) (point))))
-    ;; Remove NNTP-posting-host.
-    (goto-char (point-min))
-    (and (re-search-forward "^nntp-posting-host:" nil t)
-        (delete-region (progn (beginning-of-line) (point))
-                       (progn (forward-line 1) (point))))
-    ;; Insert new Sender if the From is strange. 
-    (let ((from (mail-fetch-field "from")))
-      (if (and from (not (string= (downcase from) (downcase From))))
-         (progn
-           (goto-char (point-min))    
-           (and (re-search-forward "^Sender:" nil t)
-                (delete-region (progn (beginning-of-line) (point))
-                               (progn (forward-line 1) (point))))
-           (insert "Sender: " From "\n"))))
-    ;; If there are References, and no "Re: ", then the thread has
-    ;; changed name. See Son-of-1036.
-    (if (and (mail-fetch-field "references")
-            (get-buffer gnus-article-buffer))
-       (let ((psubject (gnus-simplify-subject-re
-                        (mail-fetch-field "subject")))
-             subject)
-         (save-excursion
-           (set-buffer (get-buffer gnus-article-buffer))
-           (save-restriction
-             (gnus-narrow-to-headers)
-             (if (setq subject (mail-fetch-field "subject"))
-                 (progn
-                   (and gnus-summary-gather-subject-limit
-                        (numberp gnus-summary-gather-subject-limit)
-                        (> (length subject) gnus-summary-gather-subject-limit)
-                        (setq subject
-                              (substring subject 0
-                                         gnus-summary-gather-subject-limit)))
-                   (setq subject (gnus-simplify-subject-re subject))))))
-         (or (and psubject subject (string= subject psubject))
-             (progn
-               (string-match "@" Message-ID)
-               (setq Message-ID
-                     (concat (substring Message-ID 0 (match-beginning 0))
-                             "_-_" 
-                             (substring Message-ID (match-beginning 0))))))))
-    ;; Go through all the required headers and see if they are in the
-    ;; articles already. If they are not, or are empty, they are
-    ;; inserted automatically - except for Subject, Newsgroups and
-    ;; Distribution. 
-    (while headers
-      (goto-char (point-min))
-      (setq elem (car 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
-               (if (= (following-char) ? ) (forward-char 1) (insert " "))
-               (looking-at "[ \t]*$")))
-         (progn
-           (setq value 
-                 (or (if (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))))
-                       ;; The element is a symbol.  We insert the
-                       ;; value of this symbol, if any.
-                       (and (boundp header) (symbol-value header)))
-                     ;; 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))))
-           (if (bolp)
-               (save-excursion
-                 (goto-char (point-max))
-                 (insert (symbol-name header) ": " value "\n"))
-             (replace-match value))))
-      (setq headers (cdr headers)))))
-
-(defun gnus-inews-insert-signature ()
-  "Insert a signature file.
-If `gnus-signature-function' is bound and returns a string, this
-string is used instead of the variable `gnus-signature-file'.
-In either case, if the string is a file name, this file is
-inserted. If the string is not a file name, the string itself is
-inserted. 
-If you never want any signature inserted, set both those variables to
-nil."
-  (save-excursion
-    (let ((signature 
-          (or (and gnus-signature-function
-                   (fboundp gnus-signature-function)
-                   (funcall gnus-signature-function gnus-newsgroup-name))
-              gnus-signature-file))
-         b)
-      (if (and signature
-              (or (file-exists-p signature)
-                  (string-match " " signature)
-                  (not (string-match 
-                        "^/[^/]+/" (expand-file-name signature)))))
-         (progn
-           (goto-char (point-max))
-           ;; Delete any previous signatures.
-           (if (and mail-signature (search-backward "\n-- \n" nil t))
-               (delete-region (1+ (point)) (point-max)))
-           (insert "\n-- \n")
-           (and (< 4 (setq b (count-lines 
-                              (point)
-                              (progn
-                                (if (file-exists-p signature)
-                                    (insert-file-contents signature)
-                                  (insert signature))
-                                (goto-char (point-max))
-                                (or (bolp) (insert "\n"))
-                                (point)))))
-                (not gnus-expert-user)
-                (not
-                 (gnus-y-or-n-p
-                  (format
-                   "Your .sig is %d lines; it should be max 4. Really post? "
-                   b)))
-                (if (file-exists-p signature)
-                    (error (format "Edit %s." signature))
-                  (error "Trim your signature."))))))))
-
-(defun gnus-inews-do-fcc ()
-  "Process FCC: fields in current article 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
-a program specified by the rest of the value."
-  (let ((fcc-list nil)
-       (fcc-file nil)
-       (case-fold-search t))           ;Should ignore case.
-    (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))))
-       ;; 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
-                ;; Suggested by hyoko@flab.fujitsu.junet.
-                ;; Save article in Unix mail format by default.
-                (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))))))))))
-
-(defun gnus-inews-path ()
-  "Return uucp path."
-  (let ((login-name (gnus-inews-login-name)))
-    (cond ((null gnus-use-generic-path)
-          (concat (nth 1 gnus-select-method) "!" login-name))
-         ((stringp gnus-use-generic-path)
-          ;; Support GENERICPATH.  Suggested by vixie@decwrl.dec.com.
-          (concat gnus-use-generic-path "!" login-name))
-         (t login-name))))
-
-(defun gnus-inews-user-name ()
-  "Return user's network address as \"NAME@DOMAIN (FULL-NAME)\"."
-  (let ((full-name (gnus-inews-full-name)))
-    (or gnus-user-from-line
-       (concat (if (or gnus-user-login-name gnus-use-generic-from
-                       gnus-local-domain (getenv "DOMAINNAME"))
-                   (concat (gnus-inews-login-name) "@"
-                           (gnus-inews-domain-name gnus-use-generic-from))
-                 user-mail-address)
-               ;; User's full name.
-               (cond ((string-equal full-name "") "")
-                     ((string-equal full-name "&") ;Unix hack.
-                      (concat " (" (user-login-name) ")"))
-                     (t
-                      (concat " (" full-name ")")))))))
-
-(defun gnus-inews-login-name ()
-  "Return login name."
-  (or gnus-user-login-name (getenv "LOGNAME") (user-login-name)))
-
-(defun gnus-inews-full-name ()
-  "Return full user name."
-  (or gnus-user-full-name (getenv "NAME") (user-full-name)))
-
-(defun gnus-inews-domain-name (&optional genericfrom)
-  "Return user's domain name.
-If optional argument GENERICFROM is a string, use it as the domain
-name; if it is non-nil, strip off local host name from the domain name.
-If the function `system-name' returns full internet name and the
-domain is undefined, the domain name is got from it."
-  (if (or genericfrom gnus-local-domain (getenv "DOMAINNAME"))
-      (let* ((system-name (system-name))
-            (domain 
-             (or (if (stringp genericfrom) genericfrom)
-                 (getenv "DOMAINNAME")
-                 gnus-local-domain
-                 ;; Function `system-name' may return full internet name.
-                 ;; Suggested by Mike DeCorte <mrd@sun.soe.clarkson.edu>.
-                 (if (string-match "\\." system-name)
-                     (substring system-name (match-end 0)))
-                 (read-string "Domain name (no host): ")))
-            (host (or (if (string-match "\\." system-name)
-                          (substring system-name 0 (match-beginning 0)))
-                      system-name)))
-       (if (string-equal "." (substring domain 0 1))
-           (setq domain (substring domain 1)))
-       ;; Support GENERICFROM as same as standard Bnews system.
-       ;; Suggested by ohm@kaba.junet and vixie@decwrl.dec.com.
-       (cond ((null genericfrom)
-              (concat host "." domain))
-             ;;((stringp genericfrom) genericfrom)
-             (t domain)))
-    (if (string-match "\\." (system-name))
-       (system-name)
-      (substring user-mail-address 
-                (1+ (string-match "@" user-mail-address))))))
-
-(defun gnus-inews-full-address ()
-  (let ((domain (gnus-inews-domain-name))
-       (system (system-name))
-       (case-fold-search t))
-    (if (string-match "\\." system) system
-      (if (string-match (concat "^" (regexp-quote system)) domain) domain
-       (concat system "." domain)))))
-
-(defun gnus-inews-message-id ()
-  "Generate unique Message-ID for user."
-  ;; Message-ID should not contain a slash and should be terminated by
-  ;; a number.  I don't know the reason why it is so.
-  (concat "<" (gnus-inews-unique-id) "@" (gnus-inews-full-address) ">"))
-
-(defun gnus-inews-unique-id ()
-  "Generate unique ID from user name and current time."
-  (concat (downcase (gnus-inews-login-name))
-         (mapconcat 
-          (lambda (num) (gnus-number-base-x num 3 31))
-          (current-time) "")))
-
-(defun gnus-inews-date ()
-  "Current time string."
-  (timezone-make-date-arpa-standard 
-   (current-time-string) (current-time-zone)))
-
-(defun gnus-inews-organization ()
-  "Return user's organization.
-The ORGANIZATION environment variable is used if defined.
-If not, the variable `gnus-local-organization' is used instead.
-If it is a function, the function will be called with the current
-newsgroup name as the argument.
-If this is a file name, the contents of this file will be used as the
-organization."
-  (let* ((organization 
-         (or (getenv "ORGANIZATION")
-             (if gnus-local-organization
-                 (if (and (symbolp gnus-local-organization)
-                          (fboundp gnus-local-organization))
-                     (funcall gnus-local-organization gnus-newsgroup-name)
-                   gnus-local-organization))
-             gnus-organization-file
-             "~/.organization")))
-    (and (stringp organization)
-        (> (length organization) 0)
-        (or (file-exists-p organization)
-            (string-match " " organization)
-            (not (string-match  "^/[^/]+/" (expand-file-name organization))))
-        (save-excursion
-          (set-buffer (get-buffer-create " *Gnus organization*"))
-          (buffer-disable-undo (current-buffer))
-          (erase-buffer)
-          (if (file-exists-p organization)
-              (insert-file-contents organization)
-            (insert organization))
-          (goto-char (point-min))
-          (while (re-search-forward " *\n *" nil t)
-            (replace-match " "))
-          (buffer-substring (point-min) (point-max))))))
-
-(defun gnus-inews-lines ()
-  "Count the number of lines and return numeric string."
-  (save-excursion
-    (save-restriction
-      (widen)
-      (goto-char (point-min))
-      (search-forward "\n\n" nil 'move)
-      (int-to-string (count-lines (point) (point-max))))))
-
-\f
-;;;
-;;; Gnus Mail Functions 
-;;;
-
-;;; Mail reply commands of Gnus summary mode
-
-(defun gnus-summary-reply (yank)
-  "Reply mail to news author.
-If prefix argument YANK is non-nil, original article is yanked automatically.
-Customize the variable gnus-mail-reply-method to use another mailer."
-  (interactive "P")
-  ;; Bug fix by jbw@bigbird.bu.edu (Joe Wells)
-  ;; Stripping headers should be specified with mail-yank-ignored-headers.
-  (gnus-set-global-variables)
-  (gnus-summary-select-article t)
-  (setq gnus-winconf-post-news (current-window-configuration))
-  (let ((gnus-newsgroup-name gnus-newsgroup-name))
-    (bury-buffer gnus-article-buffer)
-    (funcall gnus-mail-reply-method yank))
-  (gnus-article-hide-headers-if-wanted))
-
-(defun gnus-summary-reply-with-original ()
-  "Reply mail to news author with original article.
-Customize the variable gnus-mail-reply-method to use another mailer."
-  (interactive)
-  (gnus-summary-reply t))
-
-(defun gnus-summary-mail-forward ()
-  "Forward the current message to another user.
-Customize the variable gnus-mail-forward-method to use another mailer."
-  (interactive)
-  (gnus-summary-select-article t)
-  (setq gnus-winconf-post-news (current-window-configuration))
-  (set-buffer gnus-article-buffer)
-  (let ((gnus-newsgroup-name gnus-newsgroup-name))
-    (funcall gnus-mail-forward-method))
-  (gnus-article-hide-headers-if-wanted))
-
-(defun gnus-summary-mail-other-window ()
-  "Compose mail in other window.
-Customize the variable `gnus-mail-other-window-method' to use another
-mailer."
-  (interactive)
-  (setq gnus-winconf-post-news (current-window-configuration))
-  (let ((gnus-newsgroup-name gnus-newsgroup-name))
-    (funcall gnus-mail-other-window-method)))
-
-(defun gnus-mail-reply-using-mail (&optional yank to-address)
-  (save-excursion
-    (set-buffer gnus-summary-buffer)
-    (let ((info (nth 2 (gnus-gethash gnus-newsgroup-name gnus-newsrc-hashtb)))
-         (group (gnus-group-real-name gnus-newsgroup-name))
-         (cur (cons (current-buffer) (cdr gnus-article-current)))
-         from subject date to reply-to message-of
-         references message-id sender follow-to cc)
-      (set-buffer (get-buffer-create "*mail*"))
-      (mail-mode)
-      (make-local-variable 'gnus-article-reply)
-      (setq gnus-article-reply cur)
-      (use-local-map (copy-keymap mail-mode-map))
-      (local-set-key "\C-c\C-c" 'gnus-mail-send-and-exit)
-      (if (and (buffer-modified-p)
-              (> (buffer-size) 0)
-              (not (gnus-y-or-n-p 
-                    "Unsent article being composed; erase it? ")))
-         ()
-       (erase-buffer)
-       (save-excursion
-         (set-buffer gnus-article-buffer)
-         (let ((buffer-read-only nil))
-           (goto-char (point-min))
-           (narrow-to-region (point-min)
-                             (progn (search-forward "\n\n") (point)))
-           (add-text-properties (point-min) (point-max) '(invisible nil)))
-         (if (and (boundp 'gnus-reply-to-function)
-                  gnus-reply-to-function)
-             (save-excursion
-               (save-restriction
-                 (gnus-narrow-to-headers)
-                 (setq follow-to (funcall gnus-reply-to-function group)))))
-         (setq from (mail-fetch-field "from"))
-         (setq date (mail-fetch-field "date"))
-         (and from
-              (let ((stop-pos 
-                     (string-match "  *at \\|  *@ \\| *(\\| *<" from)))
-                (setq message-of
-                      (concat (if stop-pos (substring from 0 stop-pos) from)
-                              "'s message of " date))))
-         (setq sender (mail-fetch-field "sender"))
-         (setq subject (or (mail-fetch-field "subject")
-                           "Re: none"))
-         (or (string-match "^[Rr][Ee]:" subject)
-             (setq subject (concat "Re: " subject)))
-         (setq cc (mail-fetch-field "cc"))
-         (setq reply-to (mail-fetch-field "reply-to"))
-         (setq references (mail-fetch-field "references"))
-         (setq message-id (mail-fetch-field "message-id"))
-         (widen))
-       (setq news-reply-yank-from from)
-       (setq news-reply-yank-message-id message-id)
-       (mail-setup (or to-address 
-                       (if (and follow-to (not (stringp follow-to))) ""
-                         (or follow-to reply-to from sender "")))
-                   subject message-of nil gnus-article-buffer nil)
-       (if (and follow-to (listp follow-to))
-           (progn
-             (goto-char (point-min))
-             (while follow-to
-               (insert (car (car follow-to)) ": " (cdr (car follow-to)) "\n")
-               (setq follow-to (cdr follow-to)))))
-       ;; Fold long references line to follow RFC1036.
-       (mail-position-on-field "References")
-       (let ((begin (- (point) (length "References: ")))
-             (fill-column 78)
-             (fill-prefix "\t"))
-         (if references (insert references))
-         (if (and references message-id) (insert " "))
-         (if message-id (insert message-id))
-         ;; The region must end with a newline to fill the region
-         ;; without inserting extra newline.
-         (fill-region-as-paragraph begin (1+ (point))))
-       (goto-char (point-min))
-       (re-search-forward
-        (concat "^" (regexp-quote mail-header-separator) "$"))
-       (forward-line 1)
-       (if yank
-           (let ((last (point)))
-             (run-hooks 'news-reply-header-hook)
-             (mail-yank-original nil)
-             (goto-char last))))
-      (if (not yank)
-         (let ((mail (current-buffer)))
-           (gnus-configure-windows '(0 0 1))
-           (switch-to-buffer-other-window mail))
-       (gnus-configure-windows '(0 1 0))
-       (switch-to-buffer (current-buffer))))))
-
-(defun gnus-mail-yank-original ()
-  (interactive)
-  (run-hooks 'news-reply-header-hook)
-  (mail-yank-original nil))
-
-(defun gnus-mail-send-and-exit ()
-  (interactive)
-  (let ((cbuf (current-buffer)))
-    (mail-send-and-exit nil)
-    (if (get-buffer gnus-group-buffer)
-       (progn
-         (save-excursion
-           (set-buffer cbuf)
-           (let ((reply gnus-article-reply))
-             (if (and reply
-                      (get-buffer (car reply))
-                      (buffer-name (car reply)))
-                 (progn
-                   (set-buffer (car reply))
-                   (and (cdr reply)
-                        (gnus-summary-mark-article-as-replied 
-                         (cdr reply)))))))
-         (and gnus-winconf-post-news
-              (set-window-configuration gnus-winconf-post-news))
-         (setq gnus-winconf-post-news nil)))))
-
-(defun gnus-mail-forward-using-mail ()
-  "Forward the current message to another user using mail."
-  ;; This is almost a carbon copy of rmail-forward in rmail.el.
-  (let ((forward-buffer (current-buffer))
-       (subject
-        (concat "[" (if (memq 'mail (assoc (symbol-name 
-                                            (car (gnus-find-method-for-group 
-                                                  gnus-newsgroup-name)))
-                                           gnus-valid-select-methods))
-                        (gnus-fetch-field "From")
-                      gnus-newsgroup-name)
-                "] " (or (gnus-fetch-field "Subject") "")))
-       beg)
-    ;; If only one window, use it for the mail buffer.
-    ;; Otherwise, use another window for the mail buffer
-    ;; so that the Rmail buffer remains visible
-    ;; and sending the mail will get back to it.
-    (if (if (one-window-p t)
-           (mail nil nil subject)
-         (mail-other-window nil nil subject))
-       (save-excursion
-         (use-local-map (copy-keymap emacs-lisp-mode-map))
-         (local-set-key "\C-c\C-c" 'gnus-mail-send-and-exit)
-         (setq beg (goto-char (point-max)))
-         (insert "------- Start of forwarded message -------\n")
-         (insert-buffer forward-buffer)
-         (goto-char (point-max))
-         (insert "------- End of forwarded message -------\n")
-         ;; Suggested by Sudish Joseph <joseph@cis.ohio-state.edu>. 
-         (goto-char beg)
-         (while (setq beg (next-single-property-change (point) 'invisible))
-           (goto-char beg)
-           (delete-region beg (or (next-single-property-change 
-                                   (point) 'invisible)
-                                  (point-max))))
-         ;; You have a chance to arrange the message.
-         (run-hooks 'gnus-mail-forward-hook)))))
-
-(defun gnus-mail-other-window-using-mail ()
-  "Compose mail other window using mail."
-  (mail-other-window nil nil nil nil nil (get-buffer gnus-article-buffer))
-  (use-local-map (copy-keymap (current-local-map)))
-  (local-set-key "\C-c\C-c" 'gnus-mail-send-and-exit))
-
-\f
-;;;
-;;; Dribble file
-;;;
-
-(defvar gnus-dribble-ignore nil)
-
-(defun gnus-dribble-file-name ()
-  (concat gnus-startup-file "-dribble"))
+(defun gnus-dribble-file-name ()
+  (concat gnus-startup-file "-dribble"))
 
 (defun gnus-dribble-open ()
   (save-excursion 
@@ -12158,9 +10337,9 @@ mailer."
              (if (gnus-y-or-n-p 
                   "Auto-save file exists. Do you want to read it? ")
                  (progn
-                   (message "Reading %s..." dribble-file) 
+                   (gnus-message 5 "Reading %s..." dribble-file) 
                    (eval-current-buffer)
-                   (message "Reading %s...done" dribble-file)))))))))
+                   (gnus-message 5 "Reading %s...done" dribble-file)))))))))
 
 (defun gnus-dribble-delete-file ()
   (if (file-exists-p (gnus-dribble-file-name))
@@ -12183,8 +10362,7 @@ mailer."
 
 (defun gnus-dribble-clear ()
   (save-excursion
-    (if (and gnus-dribble-buffer
-            (buffer-name (get-buffer gnus-dribble-buffer)))
+    (if (gnus-buffer-exists-p gnus-dribble-buffer)
        (progn
          (set-buffer gnus-dribble-buffer)
          (erase-buffer)
@@ -12258,6 +10436,13 @@ mailer."
 ;; Should return a status string (not in the nntp buffer, but as the
 ;; result of the function).
 ;;
+;; `choke-retrieve-groups GROUPS &optional SERVER'
+;; Optional function for retrieving active file info on all groups in
+;; GROUPS.  Two return formats are supported: The normal active file
+;; format, and a list of GROUP lines.  This function should return (as
+;; a function value) either `active' or `group', depending on what
+;; format it returns.
+;;
 ;; The following functions are optional and apply only to backends
 ;; that are able to control the contents of their groups totally
 ;; (ie. mail backends.)  Backends that aren't able to do that
@@ -12339,8 +10524,13 @@ If CONFIRM is non-nil, the user will be asked for an NNTP server."
                (cond ((or (string= gnus-nntp-server "")
                           (string= gnus-nntp-server "::"))
                       (list 'nnspool (system-name)))
-                     ((string-match ":" gnus-nntp-server)
-                      (list 'nnmh gnus-nntp-server))
+                     ((string-match "^:" gnus-nntp-server)
+                      (list 'nnmh gnus-nntp-server 
+                            (list 'nnmh-directory 
+                                  (file-name-as-directory
+                                   (expand-file-name
+                                    (concat "~/" (substring
+                                                  gnus-nntp-server 1)))))))
                      (t
                       (list 'nntp gnus-nntp-server)))))
 
@@ -12348,10 +10538,10 @@ If CONFIRM is non-nil, the user will be asked for an NNTP server."
       (setq where (car (cdr gnus-select-method)))
       (cond ((eq how 'nnspool)
             (require 'nnspool)
-            (message "Looking up local news spool..."))
+            (gnus-message 5 "Looking up local news spool..."))
            ((eq how 'nnmh)
             (require 'nnmh)
-            (message "Looking up mh spool..."))
+            (gnus-message 5 "Looking up mh spool..."))
            (t
             (require 'nntp)))
       (setq gnus-current-select-method gnus-select-method)
@@ -12365,11 +10555,12 @@ If CONFIRM is non-nil, the user will be asked for an NNTP server."
         "%s server on %s can't be opened. Continue? "
         (car gnus-select-method) (nth 1 gnus-select-method)))
        (progn
-        (message "Couldn't open server on %s" (nth 1 gnus-select-method))
+        (gnus-message 1 "Couldn't open server on %s" 
+                      (nth 1 gnus-select-method))
         (ding)
         nil)))))
 
-(defun gnus-check-news-server (method)
+(defun gnus-check-news-server (&optional method)
   "If the news server is down, start it up again."
   (let ((method (if method method gnus-select-method)))
     (and (stringp method)
@@ -12378,7 +10569,7 @@ If CONFIRM is non-nil, the user will be asked for an NNTP server."
        ;; Stream is already opened.
        t
       ;; Open server.
-      (message "Opening server %s on %s..." (car method) (nth 1 method))
+      (gnus-message 5 "Opening server %s on %s..." (car method) (nth 1 method))
       (run-hooks 'gnus-open-server-hook)
       (or (gnus-server-opened method)
          (gnus-open-server method))
@@ -12437,6 +10628,11 @@ is returned insted of the status string."
     (funcall (gnus-get-function method 'request-group) 
             (gnus-group-real-name group) (nth 1 method) dont-check)))
 
+(defun gnus-request-asynchronous (group &optional articles)
+  (let ((method (gnus-find-method-for-group group)))
+    (funcall (gnus-get-function method 'request-asynchronous) 
+            (gnus-group-real-name group) (nth 1 method) articles)))
+
 (defun gnus-list-active-group (group)
   (let ((method (gnus-find-method-for-group group))
        (func 'list-active-group))
@@ -12458,8 +10654,13 @@ is returned insted of the status string."
 
 (defun gnus-retrieve-headers (articles group)
   (let ((method (gnus-find-method-for-group group)))
-    (funcall (gnus-get-function method 'retrieve-headers) 
-            articles (gnus-group-real-name group) (nth 1 method))))
+    (if gnus-use-cache
+       (gnus-cache-retrieve-headers articles group)
+      (funcall (gnus-get-function method 'retrieve-headers) 
+              articles (gnus-group-real-name group) (nth 1 method)))))
+
+(defun gnus-retrieve-groups (groups method)
+  (funcall (gnus-get-function method 'retrieve-groups) groups (nth 1 method)))
 
 (defun gnus-request-article (article group &optional buffer)
   (let ((method (gnus-find-method-for-group group)))
@@ -12485,6 +10686,9 @@ is returned insted of the status string."
                                        gnus-valid-select-methods)))
               gnus-post-method
             (gnus-find-method-for-group gnus-newsgroup-name))))
+     (or (gnus-server-opened method)
+        (gnus-open-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) 
@@ -12531,11 +10735,16 @@ is returned insted of the status string."
     (funcall (gnus-get-function method 'request-create-group) 
             (gnus-group-real-name group) (nth 1 method))))
 
-(defun gnus-find-method-for-group (group)
+(defun gnus-member-of-valid (symbol group)
+  (memq symbol (assoc
+               (format "%s" (car (gnus-find-method-for-group group)))
+               gnus-valid-select-methods)))
+
+(defun gnus-find-method-for-group (group &optional info)
   (or gnus-override-method
       (and (not group)
           gnus-select-method)
-      (let ((info (nth 2 (gnus-gethash group gnus-newsrc-hashtb)))
+      (let ((info (or info (nth 2 (gnus-gethash group gnus-newsrc-hashtb))))
            method)
        (if (or (not info)
                (not (setq method (nth 4 info))))
@@ -12547,18 +10756,7 @@ is returned insted of the status string."
                       (gnus-server-extend-method group method))
                      (t
                       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)))
-             (setq method 
-                   (append method 
-                           (list (list (intern (concat 
-                                                method-name "-address"))
-                                       (nth 1 method)))))))
-       method)))
-
+       (gnus-server-add-address method))))
 
 (defun gnus-check-backend-function (func group)
   (let ((method (if (stringp group) (car (gnus-find-method-for-group group))
@@ -12579,7 +10777,7 @@ is returned insted of the status string."
 ;;;
 
 ;; Newsrc related functions.
-;; Gnus internal format of gnus-newsrc-assoc:
+;; Gnus internal format of gnus-newsrc-alist:
 ;; (("alt.general" 3 (1 . 1))
 ;;  ("alt.misc"    3 ((1 . 10) (12 . 15)))
 ;;  ("alt.test"    7 (1 . 99) (45 57 93)) ...)
@@ -12592,8 +10790,8 @@ is returned insted of the status string."
 ;; (95 ("alt.general" 3 (1 . 1)) ("alt.misc" 3 ((1 . 10) (12 . 15))) ...)
 ;; This is the entry for "alt.misc". The first element is the number
 ;; of unread articles in "alt.misc". The cdr of this entry is the
-;; element *before* "alt.misc" in gnus-newsrc-assoc, which makes is
-;; trivial to remove or add new elements into gnus-newsrc-assoc
+;; 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
 ;; of "alt.misc", you'd say something like 
 ;; (nth 2 (gnus-gethash "alt.misc" gnus-newsrc-hashtb))
@@ -12613,9 +10811,13 @@ is returned insted of the status string."
   "Setup news information.
 If RAWFILE is non-nil, the .newsrc file will also be read.
 If LEVEL is non-nil, the news will be set up at level LEVEL."
-  (let ((init (not (and gnus-newsrc-assoc gnus-active-hashtb (not rawfile)))))
+  (let ((init (not (and gnus-newsrc-alist gnus-active-hashtb (not rawfile)))))
     ;; Clear some variables to re-initialize news information.
-    (if init (setq gnus-newsrc-assoc nil gnus-active-hashtb nil))
+    (if init (setq gnus-newsrc-alist nil gnus-active-hashtb nil))
+
+    ;; Read the newsrc file and create `gnus-newsrc-hashtb'.
+    (if init (gnus-read-newsrc-file rawfile))
+
     ;; 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
@@ -12626,10 +10828,10 @@ If LEVEL is non-nil, the news will be set up at level LEVEL."
        (gnus-read-active-file)
       (setq gnus-active-hashtb (make-vector 4095 0)))
 
-    ;; Read the newsrc file and create `gnus-newsrc-hashtb'.
-    (if init (gnus-read-newsrc-file rawfile))
+    (and init gnus-use-dribble-file (gnus-dribble-read-file))
+
     ;; Find the number of unread articles in each non-dead group.
-    (gnus-get-unread-articles (or level 6))
+    (gnus-get-unread-articles (or level (1+ gnus-level-subscribed)))
     ;; Find new newsgroups and treat them.
     (if (and init gnus-check-new-newsgroups gnus-read-active-file (not level)
             (gnus-server-opened gnus-select-method))
@@ -12680,8 +10882,8 @@ The `-n' option line from .newsrc is respected."
              (gnus-subscribe-hierarchical-interactive new-newsgroups))
          ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
          (if (> groups 0)
-             (message "%d new newsgroup%s arrived." 
-                      groups (if (> groups 1) "s have" " has")))))))
+             (gnus-message 6 "%d new newsgroup%s arrived." 
+                           groups (if (> groups 1) "s have" " has")))))))
 
 (defun gnus-matches-options-n (group)
   ;; Returns `subscribe' if the group is to be uncoditionally
@@ -12690,10 +10892,10 @@ The `-n' option line from .newsrc is respected."
 
   ;; First we check the two user variables.
   (cond
-   ((and gnus-options-not-subscribe
+   ((and gnus-options-subscribe
         (string-match gnus-options-not-subscribe group))
     'subscribe)
-   ((and gnus-options-subscribe
+   ((and gnus-options-not-subscribe
         (string-match gnus-options-subscribe group))
     'ignore)
    ;; Then we go through the list that was retrieved from the .newsrc
@@ -12759,17 +10961,17 @@ The `-n' option line from .newsrc is respected."
        (gnus-subscribe-hierarchical-interactive new-newsgroups))
     ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
     (if (> groups 0)
-       (message "%d new newsgroup%s arrived." 
-                groups (if (> groups 1) "s have" " has")))
+       (gnus-message 6 "%d new newsgroup%s arrived." 
+                     groups (if (> groups 1) "s have" " has")))
     got-new))
 
 (defun gnus-check-first-time-used ()
-  (if (or (> (length gnus-newsrc-assoc) 1)
+  (if (or (> (length gnus-newsrc-alist) 1)
          (file-exists-p gnus-startup-file)
          (file-exists-p (concat gnus-startup-file ".el"))
          (file-exists-p (concat gnus-startup-file ".eld")))
       nil
-    (message "First time user; subscribing you to default groups")
+    (gnus-message 6 "First time user; subscribing you to default groups")
     (or gnus-have-read-active-file (gnus-read-active-file))
     (setq gnus-newsrc-last-checked-date (current-time-string))
     (let ((groups gnus-default-subscribed-newsgroups)
@@ -12792,11 +10994,12 @@ The `-n' option line from .newsrc is respected."
         gnus-active-hashtb)
        (while groups
          (if (gnus-gethash (car groups) gnus-active-hashtb)
-             (gnus-group-change-level (car groups) 3 9))
+             (gnus-group-change-level 
+              (car groups) gnus-level-default-subscribed gnus-level-killed))
          (setq groups (cdr groups)))
        (gnus-group-make-help-group)
        (and gnus-novice-user
-            (message (substitute-command-keys "\\<gnus-group-mode-map>\\[gnus-group-list-killed] to list killed groups")))))))
+            (gnus-message 7 "`A k' to list killed groups"))))))
 
 ;; `gnus-group-change-level' is the fundamental function for changing
 ;; subscription levels of newsgroups. This might mean just changing
@@ -12825,7 +11028,7 @@ The `-n' option line from .newsrc is respected."
       (setq group entry))
     (if (and (stringp entry)
             oldlevel 
-            (< oldlevel 8))
+            (< oldlevel gnus-level-zombie))
        (setq entry (gnus-gethash entry gnus-newsrc-hashtb)))
     (if (and (not oldlevel)
             (listp entry))
@@ -12841,12 +11044,12 @@ The `-n' option line from .newsrc is respected."
     ;; 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
     ;; it from the newsrc hash table and assoc.
-    (cond ((>= oldlevel 8)
-          (if (= oldlevel 8)
+    (cond ((>= oldlevel gnus-level-zombie)
+          (if (= oldlevel gnus-level-zombie)
               (setq gnus-zombie-list (delete group gnus-zombie-list))
             (setq gnus-killed-list (delete group gnus-killed-list))))
          (t
-          (if (>= level 8)
+          (if (>= level gnus-level-zombie)
               (progn
                 (gnus-sethash (car (nth 2 entry))
                               nil gnus-newsrc-hashtb)
@@ -12859,16 +11062,16 @@ The `-n' option line from .newsrc is respected."
     ;; Finally we enter (if needed) the list where it is supposed to
     ;; go, and change the subscription level. If it is to be killed,
     ;; we enter it into the killed or zombie list.
-    (cond ((>= level 8)
+    (cond ((>= level gnus-level-zombie)
           (and (string= group (gnus-group-real-name group))
-               (if (= level 8)
+               (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
           ;; hashtb format and fix the pointers in the newsrc assoc.
-          (if (>= oldlevel 8)
+          (if (>= oldlevel gnus-level-zombie)
               (progn
                 (if (listp entry)
                     (progn
@@ -12883,13 +11086,21 @@ The `-n' option line from .newsrc is respected."
                     (if (eq method gnus-select-method)
                         (setq info (list group level nil))
                       (setq info (list group level nil nil method)))))
-                (setq entry (cons info (if previous (cdr (cdr previous))
-                                         (cdr gnus-newsrc-assoc))))
-                (setcdr (if previous (cdr previous) gnus-newsrc-assoc)
-                        entry)
-                (gnus-sethash group (cons num (if previous (cdr previous)
-                                                gnus-newsrc-assoc))
-                              gnus-newsrc-hashtb)
+                (or previous 
+                    (setq previous 
+                          (let ((p gnus-newsrc-alist))
+                            (while (cdr (cdr p))
+                              (setq p (cdr p)))
+                            p)))
+                (setq entry (cons info (cdr (cdr previous))))
+                (if (cdr previous)
+                    (progn
+                      (setcdr (cdr previous) entry)
+                      (gnus-sethash group (cons num (cdr previous)) 
+                                    gnus-newsrc-hashtb))
+                  (setcdr previous entry)
+                  (gnus-sethash group (cons num previous)
+                                gnus-newsrc-hashtb))
                 (if (cdr entry)
                     (setcdr (gnus-gethash (car (car (cdr entry)))
                                           gnus-newsrc-hashtb)
@@ -12901,15 +11112,16 @@ The `-n' option line from .newsrc is respected."
 
 (defun gnus-kill-newsgroup (newsgroup)
   "Obsolete function. Kills a newsgroup."
-  (gnus-group-change-level (gnus-gethash newsgroup gnus-newsrc-hashtb) 9))
+  (gnus-group-change-level
+   (gnus-gethash newsgroup gnus-newsrc-hashtb) gnus-level-killed))
 
 (defun gnus-check-bogus-newsgroups (&optional confirm)
   "Remove bogus newsgroups.
 If CONFIRM is non-nil, the user has to confirm the deletion of every
 newsgroup." 
-  (let ((newsrc (cdr gnus-newsrc-assoc))
+  (let ((newsrc (cdr gnus-newsrc-alist))
        bogus group)
-    (message "Checking bogus newsgroups...")
+    (gnus-message 5 "Checking bogus newsgroups...")
     (or gnus-have-read-active-file (gnus-read-active-file))
     ;; Find all bogus newsgroup that are subscribed.
     (while newsrc
@@ -12928,7 +11140,7 @@ newsgroup."
     ;; then removing them from the list of killed groups.
     (while bogus
       (gnus-group-change-level 
-       (gnus-gethash (car bogus) gnus-newsrc-hashtb) 9)
+       (gnus-gethash (car bogus) gnus-newsrc-hashtb) gnus-level-killed)
       (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
@@ -12945,24 +11157,25 @@ newsgroup."
                   (delete group (symbol-value (car dead-lists)))))
          (setq killed (cdr killed)))
        (setq dead-lists (cdr dead-lists))))
-    (message "Checking bogus newsgroups... done")))
+    (gnus-message 5 "Checking bogus newsgroups... done")))
 
 (defun gnus-check-duplicate-killed-groups ()
   "Remove duplicates from the list of killed groups."
   (interactive)
   (let ((killed gnus-killed-list))
     (while killed
-      (message "%d" (length killed))
+      (gnus-message 9 "%d" (length killed))
       (setcdr killed (delete (car killed) (cdr killed)))
       (setq killed (cdr killed)))))
 
-;; Go though `gnus-newsrc-assoc' and compare with `gnus-active-hashtb'
+;; Go though `gnus-newsrc-alist' and compare with `gnus-active-hashtb'
 ;; and compute how many unread articles there are in each group.
 (defun gnus-get-unread-articles (&optional level)
-  (let ((newsrc (cdr gnus-newsrc-assoc))
-       (level (or level 6))
-       info group active virtuals)
-    (message "Checking new news...")
+  (let* ((newsrc (cdr gnus-newsrc-alist))
+        (conditional level)
+        (level (or level (1+ gnus-level-subscribed)))
+        info group active virtuals method)
+    (gnus-message 5 "Checking new news...")
     (while newsrc
       (setq info (car newsrc))
       (setq group (car info))
@@ -12973,13 +11186,17 @@ newsgroup."
       ;; be reached) we just set the number of unread articles in this
       ;; newsgroup to t. This means that Gnus thinks that there are
       ;; unread articles, but it has no idea how many.
-      (if (nth 4 info)
+      (if (and (setq method (nth 4 info))
+              (not (gnus-server-equal gnus-select-method
+                                      (gnus-server-get-method nil method))))
          (if (or (and gnus-activate-foreign-newsgroups 
                       (not (numberp gnus-activate-foreign-newsgroups)))
                  (and (numberp gnus-activate-foreign-newsgroups)
                       (<= (nth 1 info) gnus-activate-foreign-newsgroups)
                       (<= (nth 1 info) level)))
-             (if (eq (car (nth 4 info)) 'nnvirtual)
+             (if (eq (car (if (stringp method) 
+                              (gnus-server-to-method method)
+                            (nth 4 info))) 'nnvirtual)
                  (setq virtuals (cons info virtuals))
                (setq active (gnus-activate-newsgroup (car info)))))
        (if (and (not gnus-read-active-file)
@@ -12989,7 +11206,10 @@ newsgroup."
       
       (or active (progn (gnus-sethash group nil gnus-active-hashtb)
                        (setcar (gnus-gethash group gnus-newsrc-hashtb) t)))
-      (and active (gnus-get-unread-articles-in-group info active))
+      (and active 
+          (gnus-get-unread-articles-in-group info active)
+          ;; Close the groups as we look at them!
+          (gnus-close-group group))
       (setq newsrc (cdr newsrc)))
 
     ;; Activate the virtual groups. This has to be done after all the
@@ -13001,16 +11221,16 @@ newsgroup."
           (gnus-get-unread-articles-in-group (car virtuals) active))
       (setq virtuals (cdr virtuals)))
 
-    (message "Checking new news... done")))
+    (gnus-message 5 "Checking new news... done")))
 
 ;; Create a hash table out of the newsrc alist. The `car's of the
 ;; alist elements are used as keys.
 (defun gnus-make-hashtable-from-newsrc-alist ()
-  (let ((alist gnus-newsrc-assoc)
+  (let ((alist gnus-newsrc-alist)
         prev)
     (setq gnus-newsrc-hashtb (gnus-make-hashtable (length alist)))
     (setq alist 
-         (setq prev (setq gnus-newsrc-assoc 
+         (setq prev (setq gnus-newsrc-alist 
                           (cons (list "dummy.group" 0 nil) alist))))
     (while alist
       (gnus-sethash (car (car alist)) (cons nil prev) gnus-newsrc-hashtb)
@@ -13036,6 +11256,9 @@ newsgroup."
         (num 0)
         (marked (nth 3 info))
         srange lowest group highest)
+    ;; 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))
     ;; 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.
@@ -13131,7 +11354,7 @@ newsgroup."
         (gnus-request-group group)
         (save-excursion
           (set-buffer nntp-server-buffer)
-          (goto-char 1)
+          (goto-char (point-min))
           (and (looking-at "[0-9]+ [0-9]+ \\([0-9]+\\) [0-9]+")
                (progn
                  (goto-char (match-beginning 1))
@@ -13207,33 +11430,60 @@ Returns whether the updating was successful."
 (defun gnus-read-active-file ()
   "Get active file from NNTP server."
   (gnus-group-set-mode-line)
-  (let ((methods (cons gnus-select-method gnus-secondary-select-methods)))
+  (let ((methods (cons gnus-select-method gnus-secondary-select-methods))
+       (not-first nil)
+       list-type)
     (setq gnus-have-read-active-file nil)
-    (while methods
-      (let* ((where (nth 1 (car methods)))
-            (mesg (format "Reading active file%s via %s..."
-                          (if (and where (not (zerop (length where))))
-                              (concat " from " where) "")
-                          (car (car methods)))))
-       (message mesg)
-       (gnus-check-news-server (car methods))
-       (if (gnus-request-list (car methods)) ; Get active 
-           (save-excursion
-             (set-buffer nntp-server-buffer)
+    (save-excursion
+      (set-buffer nntp-server-buffer)
+      (while methods
+       (let* ((where (nth 1 (car methods)))
+              (mesg (format "Reading active file%s via %s..."
+                            (if (and where (not (zerop (length where))))
+                                (concat " from " where) "")
+                            (car (car methods)))))
+         (gnus-message 5 mesg)
+         (gnus-check-news-server (car methods))
+         (cond 
+          ((and (eq gnus-read-active-file 'some)
+                (gnus-check-backend-function
+                 'retrieve-groups (car (car methods))))
+           (let ((newsrc (cdr gnus-newsrc-alist))
+                 groups)
+             (while newsrc
+               (and (gnus-server-equal 
+                     (gnus-find-method-for-group
+                      (car (car newsrc)) (car newsrc))
+                     (gnus-server-get-method nil (car methods)))
+                    (setq groups (cons (car (car newsrc)) groups)))
+               (setq newsrc (cdr newsrc)))
+             (setq list-type (gnus-retrieve-groups groups (car methods)))
+             (cond ((not list-type)
+                    (gnus-message 
+                     1 "Cannot read partial active file from %s server." 
+                     (car (car methods)))
+                    (ding)
+                    (sit-for 2))
+                   ((eq list-type 'active)
+                    (gnus-active-to-gnus-format (and not-first (car methods)))
+                    (setq not-first t))
+                   (t
+                    (gnus-groups-to-gnus-format (and not-first (car methods)))
+                    (setq not-first t)))))
+          (t
+           (if (not (gnus-request-list (car methods)))
+               (progn
+                 (gnus-message 1 "Cannot read active file from %s server." 
+                               (car (car methods)))
+                 (ding))
              (gnus-active-to-gnus-format 
               (and gnus-have-read-active-file (car methods)))
              (setq gnus-have-read-active-file t)
-             (message "%s...done" mesg))
-         (message "Cannot read active file from %s server." 
-                  (car (car methods)))
-         (ding)))
-      (setq methods (cdr methods)))))
+             (gnus-message 5 "%s...done" mesg)))))
+       (setq methods (cdr methods))))))
 
-;; rewritten by jwz based on ideas from Rick Sladkey <jrs@world.std.com>
-;; Further rewrites by lmi.
+;; Read an active file and place the results in `gnus-active-hashtb'.
 (defun gnus-active-to-gnus-format (method &optional hashtb)
-  "Convert active file format to internal format.
-Lines matching `gnus-ignored-newsgroups' are ignored."
   (let ((cur (current-buffer))
        (hashtb (or hashtb 
                    (if method
@@ -13243,7 +11493,12 @@ Lines matching `gnus-ignored-newsgroups' are ignored."
                             (count-lines (point-min) (point-max))))))))
     ;; Delete unnecessary lines.
     (goto-char (point-min))
-    (delete-matching-lines gnus-ignored-newsgroups)
+    (while (search-forward "\nto." nil t)
+      (delete-region (match-beginning 0) (progn (forward-line 1) (point))))
+    (or (string= gnus-ignored-newsgroups "")
+       (progn
+         (goto-char (point-min))
+         (delete-matching-lines gnus-ignored-newsgroups)))
     (and method (not (eq method gnus-select-method))
         (let ((prefix (gnus-group-prefixed-name "" method)))
           (goto-char (point-min))
@@ -13252,47 +11507,90 @@ Lines matching `gnus-ignored-newsgroups' are ignored."
                       (zerop (forward-line 1))))))
     (goto-char (point-min))
     ;; Store active file in hashtable.
-    (save-restriction
-      (if (or (re-search-forward "\n.\r?$" nil t)
-             (goto-char (point-max)))
-         (progn
-           (beginning-of-line)
-           (narrow-to-region (point-min) (point))))
-      (goto-char (point-min))
-      (if (string-match "%[oO]" gnus-group-line-format)
-         ;; Suggested by Brian Edmonds <edmonds@cs.ubc.ca>.
-         ;; If we want information on moderated groups, we use this
-         ;; loop...   
-         (condition-case ()
-             (let ((mod-hashtb (make-vector 7 0))
-                   group max mod)
-               (while (not (eobp))
-                 (setq group (let ((obarray hashtb))
-                               (read cur)))
+    (goto-char (point-min))
+    (if (string-match "%[oO]" gnus-group-line-format)
+       ;; Suggested by Brian Edmonds <edmonds@cs.ubc.ca>.
+       ;; If we want information on moderated groups, we use this
+       ;; loop...   
+       (let* ((mod-hashtb (make-vector 7 0))
+              (m (intern "m" mod-hashtb))
+              group max mod)
+         (while (not (eobp))
+           (condition-case nil
+               (progn
+                 (narrow-to-region (point) (gnus-point-at-eol))
+                 (setq group (let ((obarray hashtb)) (read cur)))
                  (setq max (read cur))
                  (set group (cons (read cur) max))
                  ;; Enter moderated groups into a list.
-                 (if (string= 
-                      (symbol-name  (let ((obarray mod-hashtb)) (read cur)))
-                      "m")
+                 (if (eq (let ((obarray mod-hashtb)) (read cur)) m)
                      (setq gnus-moderated-list 
-                           (cons (symbol-name group) gnus-moderated-list)))
-                 (forward-line 1)))
-           (error 
-            (progn (ding) (message "Possible error in active file."))))
-       ;; And if we do not care about moderation, we use this loop,
-       ;; which is faster.
-       (condition-case ()
-           (let (group max)
-             (while (not (eobp))
+                           (cons (symbol-name group) gnus-moderated-list))))
+             (error nil))
+           (widen)
+           (forward-line 1)))
+      ;; And if we do not care about moderation, we use this loop,
+      ;; which is faster.
+      (let (group max)
+       (while (not (eobp))
+         (condition-case ()
+             (progn
+               (narrow-to-region (point) (gnus-point-at-eol))
                ;; group gets set to a symbol interned in the hash table
                ;; (what a hack!!)
                (setq group (let ((obarray hashtb)) (read cur)))
                (setq max (read cur))
-               (set group (cons (read cur) max))
+               (set group (cons (read cur) max)))
+           (error 
+            (progn (ding) 
+                   (gnus-message 3 "Illegal active: %s"
+                                 (buffer-substring 
+                                  (gnus-point-at-bol) (gnus-point-at-eol)))
+                   nil)))
+         (widen)
+         (forward-line 1))))))
+
+(defun gnus-groups-to-gnus-format (method &optional hashtb)
+  ;; Parse a "groups" active file.
+  (let ((cur (current-buffer))
+       (hashtb (or hashtb 
+                   (if method
+                       gnus-active-hashtb
+                     (setq gnus-active-hashtb
+                           (gnus-make-hashtable 
+                            (count-lines (point-min) (point-max)))))))
+       (prefix (and method (not (eq method gnus-select-method))
+                    (gnus-group-prefixed-name "" method))))
+
+    (goto-char (point-min))
+    (condition-case ()
+       ;; We split this into to separate loops, one with the prefix
+       ;; and one without to speed the reading up somewhat.
+       (if prefix
+           (let (min max opoint)
+             (while (not (eobp))
+               (read cur) (read cur)
+               (setq min (read cur)
+                     max (read cur)
+                     opoint (point))
+               (skip-chars-forward " \t")
+               (insert prefix)
+               (goto-char opoint)
+               (set (let ((obarray hashtb)) (read cur)) 
+                    (cons min max))
                (forward-line 1)))
-         (error 
-          (progn (ding) (message "Possible error in active file."))))))))
+         (let (min max opoint)
+           (while (not (eobp))
+             (if (= (following-char) ?2)
+                 (progn
+                   (read cur) (read cur)
+                   (setq min (read cur)
+                         max (read cur))
+                   (set (let ((obarray hashtb)) (read cur)) 
+                        (cons min max))))
+             (forward-line 1))))
+      (error 
+       (progn (ding) (gnus-message 3 "Possible error in active file."))))))
 
 (defun gnus-read-newsrc-file (&optional force)
   "Read startup file.
@@ -13315,7 +11613,7 @@ If FORCE is non-nil, the .newsrc file is read."
              (and (file-newer-than-file-p newsrc-file quick-file)
                   (file-newer-than-file-p newsrc-file 
                                           (concat quick-file "d")))
-             (not gnus-newsrc-assoc))
+             (not gnus-newsrc-alist))
          ;; 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
@@ -13324,27 +11622,29 @@ If FORCE is non-nil, the .newsrc file is read."
          ;; ie. reading the .newsrc file will not trash the data
          ;; already read (except for read articles).
          (save-excursion
-           (message "Reading %s..." newsrc-file)
+           (gnus-message 5 "Reading %s..." newsrc-file)
            (set-buffer (find-file-noselect newsrc-file))
            (buffer-disable-undo (current-buffer))
            (gnus-newsrc-to-gnus-format)
            (kill-buffer (current-buffer))
-           (message "Reading %s... done" newsrc-file)))
-      (and gnus-use-dribble-file (gnus-dribble-read-file)))))
+           (gnus-message 5 "Reading %s... done" newsrc-file))))))
 
 (defun gnus-read-newsrc-el-file (file)
   (let ((ding-file (concat file "d")))
     ;; We always, always read the .eld file.
-    (message "Reading %s..." ding-file)
-    (condition-case nil
-       (load ding-file t t t)
-      (error nil))
-    (gnus-uncompress-newsrc-assoc)
+    (gnus-message 5 "Reading %s..." ding-file)
+    (let (gnus-newsrc-assoc)
+      (condition-case nil
+         (load ding-file t t t)
+       (error nil))
+      (and gnus-newsrc-assoc (setq gnus-newsrc-alist gnus-newsrc-assoc)))
+    (let ((inhibit-quit t))
+      (gnus-uncompress-newsrc-assoc))
     (gnus-make-hashtable-from-newsrc-alist)
     (if (not (file-newer-than-file-p file ding-file))
        ()
       ;; Old format quick file
-      (message "Reading %s..." file)
+      (gnus-message 5 "Reading %s..." file)
       ;; The .el file is newer than the .eld file, so we read that one
       ;; as well. 
       (gnus-read-old-newsrc-el-file file))))
@@ -13353,7 +11653,8 @@ If FORCE is non-nil, the .newsrc file is read."
 (defun gnus-read-old-newsrc-el-file (file)
   (let (newsrc killed marked group g m len info)
     (prog1
-       (let (gnus-killed-assoc gnus-marked-assoc gnus-newsrc-assoc)
+       (let ((gnus-killed-assoc nil)
+             gnus-marked-assoc gnus-newsrc-alist gnus-newsrc-assoc)
          (prog1
              (condition-case nil
                  (load file t t t)
@@ -13361,21 +11662,25 @@ If FORCE is non-nil, the .newsrc file is read."
            (setq newsrc gnus-newsrc-assoc
                  killed gnus-killed-assoc
                  marked gnus-marked-assoc)))
-      (setq gnus-newsrc-assoc nil)
+      (setq gnus-newsrc-alist nil)
       (while newsrc
        (setq group (car newsrc))
        (let ((info (nth 2 (gnus-gethash (car group) gnus-newsrc-hashtb))))
          (if info
              (progn
                (setcar (nthcdr 2 info) (cdr (cdr group)))
-               (setcar (cdr info) (if (nth 1 group) 3 6))
-               (setq gnus-newsrc-assoc (cons info gnus-newsrc-assoc)))
-           (setq gnus-newsrc-assoc
+               (setcar (cdr 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 
                   (setq info
                         (list (car group)
-                              (if (nth 1 group) 3 6) (cdr (cdr group))))
-                  gnus-newsrc-assoc)))
+                              (if (nth 1 group) gnus-level-default-subscribed
+                                gnus-level-default-unsubscribed) 
+                              (cdr (cdr group))))
+                  gnus-newsrc-alist)))
          (if (setq m (assoc (car group) marked))
            (setcdr (cdr (cdr info)) (cons (list (cons 'tick (cdr m))) nil))))
        (setq newsrc (cdr newsrc)))
@@ -13384,7 +11689,7 @@ If FORCE is non-nil, the .newsrc file is read."
        (setcar newsrc (car (car newsrc)))
        (setq newsrc (cdr newsrc)))
       (setq gnus-killed-list killed))
-    (setq gnus-newsrc-assoc (nreverse gnus-newsrc-assoc))
+    (setq gnus-newsrc-alist (nreverse gnus-newsrc-alist))
     (gnus-make-hashtable-from-newsrc-alist)))
       
 (defun gnus-make-newsrc-file (file)
@@ -13396,7 +11701,7 @@ If FORCE is non-nil, the .newsrc file is read."
 
 (defun gnus-uncompress-newsrc-assoc ()
   ;; Uncompress all lists of marked articles in the newsrc assoc.
-  (let ((newsrc gnus-newsrc-assoc)
+  (let ((newsrc gnus-newsrc-alist)
        marked)
     (while newsrc
       (if (not (setq marked (nth 3 (car newsrc))))
@@ -13411,7 +11716,7 @@ If FORCE is non-nil, the .newsrc file is read."
 
 (defun gnus-compress-newsrc-assoc ()
   ;; Compress all lists of marked articles in the newsrc assoc.
-  (let ((newsrc gnus-newsrc-assoc)
+  (let ((newsrc gnus-newsrc-alist)
        marked)
     (while newsrc
       (if (not (setq marked (nth 3 (car newsrc))))
@@ -13425,208 +11730,249 @@ If FORCE is non-nil, the .newsrc file is read."
          (setq marked (cdr marked))))
       (setq newsrc (cdr newsrc)))))
 
-;; jwz: rewrote this function to be much more efficient, and not be
-;; subject to regexp overflow errors when it encounters very long
-;; lines -- the old behavior was to blow off the rest of the *file*
-;; when a line was encountered that was too long to match!!  Now it
-;; uses only simple looking-at calls, and doesn't create as many
-;; temporary strings.  It also now handles multiple consecutive
-;; options lines (before it only handled the first.)
-;; Tiny rewrite by lmi. 
 (defun gnus-newsrc-to-gnus-format ()
-  "Parse current buffer as .newsrc file."
-  ;; We have to re-initialize these variables (except for
-  ;; gnus-killed-list) because the quick startup file may contain bogus
-  ;; values.
-  (setq gnus-newsrc-options nil)
-  (setq gnus-newsrc-options-n nil)
-  (gnus-parse-options-lines)
-  (gnus-parse-newsrc-body))
-
-(defun gnus-parse-options-lines ()
-  ;; newsrc.5 seems to indicate that the options line can come anywhere
-  ;; in the file, and that there can be any number of them:
-  ;;
-  ;;       An  options  line  starts  with  the  word  options (left-
-  ;;       justified).  Then there are the list of  options  just  as
-  ;;       they would be on the readnews command line.  For instance:
-  ;;
-  ;;       options -n all !net.sf-lovers !mod.human-nets -r
-  ;;       options -c -r
-  ;;
-  ;;       A string of lines beginning with a space or tab after  the
-  ;;       initial  options  line  will  be  considered  continuation
-  ;;       lines.
-  ;;
-  ;; For now, we only accept it at the beginning of the file.
-
-  (goto-char (point-min))
-  (skip-chars-forward " \t\n")
-  (setq gnus-newsrc-options nil)
-  (while (looking-at "^options[ \t]*\\(.*\\)\n")
-    ;; handle consecutive options lines
-    (setq gnus-newsrc-options (concat gnus-newsrc-options
-                                     (if gnus-newsrc-options "\n\t")
-                                     (buffer-substring (match-beginning 1)
-                                                       (match-end 1))))
-    (forward-line 1)
-    (while (looking-at "[ \t]+\\(.*\\)\n")
-      ;; handle subsequent continuation lines of this options line
-      (setq gnus-newsrc-options (concat gnus-newsrc-options "\n\t"
-                                       (buffer-substring (match-beginning 1)
-                                                         (match-end 1))))
-      (forward-line 1)))
-  ;; Gather all "-n" options lines.
-  (let ((start 0)
-       (result nil))
-    (if gnus-newsrc-options
-       (while (and (string-match "^[ \t]*-n\\([^\n]*\\)$"
-                                 gnus-newsrc-options
-                                 start)
-                   (setq start (match-end 0)))
-         (setq result (concat result
-                              (and result " ")
-                              (substring gnus-newsrc-options
-                                         (match-beginning 1)
-                                         (match-end 1))))))
-
-    (and result (gnus-parse-n-options result))
-    nil))
-
-(defun gnus-parse-newsrc-body ()
-  ;; Point has been positioned after the options lines.  We shouldn't
-  ;; see any more in here.
-
-  (let ((subscribe nil)
-       (read-list nil)
-       (line (1+ (count-lines (point-min) (point))))
-       newsgroup
-       p p2)
-    (save-restriction
-      (skip-chars-forward " \t")
-      (while (not (eobp))
-       (cond
-        ((= (following-char) ?\n)
-         ;; skip blank lines
-         nil)
-        (t
-         (setq p (point))
-         (skip-chars-forward "^:!\n")
-         (if (= (following-char) ?\n)
-             (error "line %d is unparsable in %s" line (buffer-name)))
-         (setq p2 (point))
-         (skip-chars-backward " \t")
-
-         ;; #### note: we could avoid consing a string here by binding obarray
-         ;; and reading the newsgroup directly into the gnus-newsrc-hashtb,
-         ;; then setq'ing newsgroup to symbol-name of that, like we do in
-         ;; gnus-active-to-gnus-format.
-         (setq newsgroup (buffer-substring p (point)))
-         (goto-char p2)
-
-         (setq subscribe (= (following-char) ?:))
-         (setq read-list nil)
-
-         (forward-char 1)              ; after : or !
-         (skip-chars-forward " \t")
-         (while (not (= (following-char) ?\n))
-           (skip-chars-forward " \t")
-           (or
-            (and (cond
-                  ((looking-at "\\([0-9]+\\)-\\([0-9]+\\)") ; a range
-                   (setq read-list
-                         (cons
-                          (cons
-                           (progn
-                             ;; faster that buffer-substring/string-to-int
-                             (narrow-to-region (point-min) (match-end 1))
-                             (read (current-buffer)))
-                           (progn
-                             (narrow-to-region (point-min) (match-end 2))
-                             (forward-char) ; skip over "-"
-                             (prog1
-                                 (read (current-buffer))
-                               (widen))))
-                          read-list))
-                   t)
-                  ((looking-at "[0-9]+")
-                   ;; faster that buffer-substring/string-to-int
-                   (narrow-to-region (point-min) (match-end 0))
-                   (setq p (read (current-buffer)))
-                   (widen)
-                   (setq read-list (cons (cons p p) read-list))
-                   t)
-                  (t
-                   ;; bogus chars in ranges
-                   nil))
+  (setq gnus-newsrc-options "")
+  (or gnus-active-hashtb
+      (setq gnus-active-hashtb (make-vector 4095 0)))
+  (let ((buf (current-buffer))
+       (already-read (> (length gnus-newsrc-alist) 1))
+       group level subscribed info options-symbol newsrc
+       symbol reads num1)
+    (goto-char (point-min))
+    ;; We intern the symbol `options' in the active hashtb so that we
+    ;; can `eq' against it later.
+    (setq options-symbol (intern "options" gnus-active-hashtb))
+  
+    (while (not (eobp))
+      ;; We first read the first word on the line by narrowing and
+      ;; then reading into `gnus-active-hashtb'.  Most groups will
+      ;; already exist in that hashtb, so this will save some string
+      ;; space.
+      (narrow-to-region
+       (point)
+       (progn (skip-chars-forward "^ \t!:\n") (point)))
+      (goto-char (point-min))
+      (setq symbol 
+           (and (/= (point-min) (point-max))
+                (let ((obarray gnus-active-hashtb)) (read buf))))
+      (widen)
+      ;; Now, the symbol we have read is either `options' or a group
+      ;; name.  If it is an options line, we just add it to a string. 
+      (cond 
+       ((eq symbol options-symbol)
+       (setq gnus-newsrc-options
+             ;; This concatting is quite inefficient, but since our
+             ;; thorough studies show that approx 99.37% of all
+             ;; .newsrc files only contain a single options line, we
+             ;; don't give a damn, frankly, my dear.
+             (concat gnus-newsrc-options
+                     (buffer-substring 
+                      (gnus-point-at-bol)
+                      ;; Options may continue on the next line.
+                      (or (and (re-search-forward "^[^ \t]" nil 'move)
+                               (progn (beginning-of-line) (point)))
+                          (point))))))
+       (symbol
+       ;; It was a group name.
+       (setq subscribed (= (following-char) ?:)
+             group (symbol-name symbol)
+             reads nil)
+       (if (eolp)
+           ;; If the line ends here, this is clearly a buggy line, so
+           ;; we put point a the beginning of line and let the cond
+           ;; below do the error handling.
+           (beginning-of-line)
+         ;; We skip to the beginning of the ranges.
+         (skip-chars-forward "!: \t"))
+       ;; We are now at the beginning of the list of read articles.
+       ;; We read them range by range.
+       (while
+           (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
+             ;; faster than save-restriction/narrow, and save-restriction
+             ;; produces a garbage object.
+             (setq num1 (progn
+                          (narrow-to-region (match-beginning 0) (match-end 0))
+                          (read buf)))
+             (widen)
+             ;; If the next character is a dash, then this is a range.
+             (if (= (following-char) ?-)
                  (progn
-                   (goto-char (match-end 0))
-                   (skip-chars-forward " \t")
-                   (cond ((= (following-char) ?,)
-                          (forward-char 1)
-                          t)
-                         ((= (following-char) ?\n)
-                          t)
-                         (t
-                          ;; bogus char after range
-                          nil))))
-            ;; if we get here, the parse failed
-            (progn
-              (end-of-line)            ; give up on this line
-              (ding)
-              (message "Ignoring bogus line %d for %s in %s"
-                       line newsgroup (buffer-name))
-              (sleep-for 1))))
-         ;; We have already read .newsrc.eld, so we gently update the
-         ;; data in the hash table with the information we have just
-         ;; read. 
-         (let ((info (nth 2 (gnus-gethash newsgroup gnus-newsrc-hashtb))))
+                   ;; We read the upper bound of the range.
+                   (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
+                       ;; dinged? 
+                       (setq reads (cons num1 reads))
+                     (setq reads 
+                           (cons 
+                            (cons num1 (progn
+                                         (narrow-to-region (match-beginning 0) 
+                                                           (match-end 0))
+                                         (read buf)))
+                            reads))
+                     (widen)))
+               ;; It was just a simple number, so we add it to the
+               ;; list of ranges.
+               (setq reads (cons num1 reads)))
+             ;; If the next char in ?\n, then we have reached the end
+             ;; of the line and return nil.
+             (/= (following-char) ?\n))
+            ((= (following-char) ?\n)
+             ;; End of line, so we end.
+             nil)
+            (t
+             ;; Not numbers and not eol, so this might be a buggy
+             ;; line... 
+             (or (eobp) ; If it was eob instead of ?\n, we allow it.
+                 (progn
+                   ;; The line was buggy.
+                   (setq group nil)
+                   (gnus-message 3 "Mangled line: %s" 
+                                 (buffer-substring (gnus-point-at-bol) 
+                                                   (gnus-point-at-eol)))
+                   (ding)
+                   (sit-for 1)))
+             nil))
+         ;; 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 ", "))
+
+       ;; 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)))
+               level)
            (if info
+               ;; There is an entry for this file in the alist.
                (progn
-                 (setcar (nthcdr 2 info) (nreverse read-list))
-                 (setcar (cdr info) (if subscribe 3 (if read-list 6 7))))
-             (setq gnus-newsrc-assoc
-                   (cons (list newsgroup (if subscribe 3 (if read-list 6 7))
-                               (nreverse read-list))
-                         gnus-newsrc-assoc))))))
-       (setq line (1+ line))
+                 (setcar (nthcdr 2 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))
+                 (cond ((and (<= level gnus-level-subscribed)
+                             (not subscribed))
+                        (setq level (if reads
+                                        gnus-level-default-unsubscribed 
+                                      (1+ gnus-level-default-unsubscribed))))
+                       ((and (> level gnus-level-subscribed) subscribed)
+                        (setq level gnus-level-default-subscribed)))
+                 (setcar (cdr info) level))
+             ;; This is a new group.
+             (setq info (list group 
+                              (if subscribed
+                                  gnus-level-default-subscribed 
+                                (if reads
+                                    (1+ gnus-level-subscribed)
+                                  gnus-level-default-unsubscribed))
+                              (nreverse reads))))
+           (setq newsrc (cons info newsrc))))
        (forward-line 1))))
-  (setq gnus-newsrc-assoc (cdr gnus-newsrc-assoc))
-  (gnus-make-hashtable-from-newsrc-alist)
-  nil)
+    
+    (setq newsrc (nreverse newsrc))
 
-(defun gnus-parse-n-options (options)
-  "Parse -n NEWSGROUPS options and return a cons of YES and NO regexps."
-  (let (yes no yes-or-no out newsgroup)
-    ;; Parse each newsgroup description such as "comp.all".  Commas
-    ;; and white spaces can be a newsgroup separator.
-    (while
-       (string-match "^[ \t\n,]*\\(!?\\)\\([^- \t\n,][^ \t\n,]*\\)" options)
-      (setq yes-or-no
-           (substring options (match-beginning 1) (match-end 1)))
-      (setq newsgroup
-           (regexp-quote
-            (substring options
-                       (match-beginning 2) (match-end 2))))
-      (setq options (substring options (match-end 2)))
-      ;; Rewrite "all" to ".+" not ".*".  ".+" requires at least one
-      ;; character.
-      (while (string-match "\\(^\\|\\\\[.]\\)all\\(\\\\[.]\\|$\\)" newsgroup)
-       (setq newsgroup
-             (concat (substring newsgroup 0 (match-end 1))
-                     ".+"
-                     (substring newsgroup (match-beginning 2)))))
-      ;; It is yes or no.
-      (setq out (cons (cons (if (string= yes-or-no "!") 'ignore 'subscribe)
-                           (concat "^" newsgroup "$")) 
-                     out)))
-    (setq gnus-newsrc-options-n out)))
+    (if (not already-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
+      ;; gnus-newsrc-alist to the (native) group that precedes them. 
+      (let ((rc (cdr gnus-newsrc-alist))
+           (prev gnus-newsrc-alist)
+           entry mentry)
+       (while rc
+         (or (assoc (car (car rc)) newsrc)
+             (if (setq entry (assoc (car (car prev)) newsrc))
+                 (setcdr (setq mentry (memq entry newsrc))
+                         (cons (car rc) (cdr mentry)))
+               (setq newsrc (cons (car rc) newsrc))))
+         (setq prev rc
+               rc (cdr rc)))))
+
+    (setq gnus-newsrc-alist newsrc)
+    ;; We make the newsrc hashtb.
+    (gnus-make-hashtable-from-newsrc-alist)
+
+    ;; Finally, if we read some options lines, we parse them.
+    (or (string= gnus-newsrc-options "")
+       (gnus-newsrc-parse-options gnus-newsrc-options))
+    ))
+
+;; Parse options lines to find "options -n !all rec.all" and stuff.
+;; The return value will be a list on the form
+;; ((regexp1 . ignore)
+;;  (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
+;; 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
+;; different from "options -n rec.all !all". 
+(defun gnus-newsrc-parse-options (options)
+  (let (out eol)
+    (save-excursion
+      (gnus-set-work-buffer)
+      (insert (regexp-quote options))
+      ;; First we treat all continuation lines.
+      (goto-char (point-min))
+      (while (re-search-forward "\n[ \t]+" nil t)
+       (replace-match " " t t))
+      ;; Then we transform all "all"s into ".+"s.
+      (goto-char (point-min))
+      (while (re-search-forward "\\ball\\b" nil t)
+       (replace-match ".+" t t))
+      (goto-char (point-min))
+      ;; We remove all other options than the "-n" ones.
+      (while (re-search-forward "[ \t]-[^n][^-]*" nil t)
+       (replace-match " ")
+       (forward-char -1))
+      (goto-char (point-min))
+
+      ;; We are only interested in "options -n" lines - we
+      ;; ignore the other option lines.
+      (while (re-search-forward "[ \t]-n" nil t)
+       (setq eol 
+             (or (save-excursion
+                   (and (re-search-forward "[ \t]-n" (gnus-point-at-eol) t)
+                        (- (point) 2)))
+                 (gnus-point-at-eol)))
+       ;; Search for all "words"...
+       (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
+             ;; symbol `ignore' into the list.
+             (setq out (cons (cons (concat 
+                                    "^" (buffer-substring 
+                                         (1+ (match-beginning 0))
+                                         (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)))
+                                 'subscribe) out)))))
+    
+      (setq gnus-newsrc-options-n out))))
+              
 
 (defun gnus-save-newsrc-file ()
   "Save .newsrc file."
   ;; Note: We cannot save .newsrc file if all newsgroups are removed
-  ;; from the variable gnus-newsrc-assoc.
-  (and (or gnus-newsrc-assoc gnus-killed-list)
+  ;; from the variable gnus-newsrc-alist.
+  (and (or gnus-newsrc-alist gnus-killed-list)
        gnus-current-startup-file
        (let ((make-backup-files t)
             (version-control nil)
@@ -13640,34 +11986,36 @@ If FORCE is non-nil, the .newsrc file is read."
                   (zerop (save-excursion
                            (set-buffer gnus-dribble-buffer)
                            (buffer-size))))
-              (message "(No changes need to be saved)")
+              (gnus-message 4 "(No changes need to be saved)")
             (if gnus-save-newsrc-file
                 (progn
-                  (message "Saving %s..." gnus-current-startup-file)
+                  (gnus-message 5 "Saving %s..." gnus-current-startup-file)
                   ;; Make backup file of master newsrc.
                   (gnus-gnus-to-newsrc-format)
-                  (message "Saving %s... done" gnus-current-startup-file)))
+                  (gnus-message 5 "Saving %s... done"
+                                gnus-current-startup-file)))
             ;; Quickly loadable .newsrc.
             (set-buffer (get-buffer-create " *Gnus-newsrc*"))
             (gnus-add-current-to-buffer-list)
             (buffer-disable-undo (current-buffer))
             (erase-buffer)
-            (message "Saving %s.eld..." gnus-current-startup-file)
+            (gnus-message 5 "Saving %s.eld..." gnus-current-startup-file)
             (gnus-gnus-to-quick-newsrc-format)
             (write-region 1 (point-max) 
                           (concat gnus-current-startup-file ".eld") 
                           nil 'nomesg)
             (kill-buffer (current-buffer))
-            (message "Saving %s.eld... done" gnus-current-startup-file)
+            (gnus-message 5 "Saving %s.eld... done" gnus-current-startup-file)
             (gnus-dribble-delete-file))))))
 
 (defun gnus-gnus-to-quick-newsrc-format ()
-  "Insert Gnus variables such as gnus-newsrc-assoc in lisp format."
+  "Insert Gnus variables such as gnus-newsrc-alist in lisp format."
   (insert ";; (ding) Gnus startup file.\n")
   (insert ";; Never delete this file - touch .newsrc instead to force Gnus\n")
   (insert ";; to read .newsrc.\n")
   (let ((variables gnus-variable-list)
-       (gnus-newsrc-assoc (cdr gnus-newsrc-assoc))
+       (inhibit-quit t)
+       (gnus-newsrc-alist (cdr gnus-newsrc-alist))
        variable)
     ;; insert lisp expressions.
     (gnus-compress-newsrc-assoc)
@@ -13685,20 +12033,21 @@ If FORCE is non-nil, the .newsrc file is read."
 
 (defun gnus-gnus-to-newsrc-format ()
   ;; Generate and save the .newsrc file.
-  (let ((newsrc (cdr gnus-newsrc-assoc))
+  (let ((newsrc (cdr gnus-newsrc-alist))
        info ranges range)
     (save-excursion
       (set-buffer (create-file-buffer gnus-startup-file))
       (buffer-disable-undo (current-buffer))
       (erase-buffer)
       ;; Write options.
-      (if gnus-newsrc-options (insert "options " gnus-newsrc-options "\n"))
+      (if gnus-newsrc-options (insert gnus-newsrc-options))
       ;; Write subscribed and unsubscribed.
       (while newsrc
        (setq info (car newsrc))
        (if (not (nth 4 info))          ;Don't write foreign groups to .newsrc.
            (progn
-             (insert (car info) (if (>= (nth 1 info) 6) "!" ":"))
+             (insert (car info) (if (> (nth 1 info) gnus-level-subscribed)
+                                    "!" ":"))
              (if (setq ranges (nth 2 info))
                  (progn
                    (insert " ")
@@ -13723,11 +12072,16 @@ If FORCE is non-nil, the .newsrc file is read."
       (kill-buffer (current-buffer)))))
 
 (defun gnus-read-descriptions-file ()
-  (message "Reading descriptions file...")
-  (if (not (gnus-request-list-newsgroups gnus-select-method))
-      (progn
-       (message "Couldn't read newsgroups descriptions")
-       nil)
+  (gnus-message 5 "Reading descriptions file...")
+  (cond 
+   ((not (or (gnus-server-opened gnus-select-method)
+            (gnus-open-server gnus-select-method)))
+    (gnus-message 1 "Couldn't open server")
+    nil)
+   ((not (gnus-request-list-newsgroups gnus-select-method))
+    (gnus-message 1 "Couldn't read newsgroups descriptions")
+    nil)
+   (t
     (let (group)
       (setq gnus-description-hashtb 
            (gnus-make-hashtable (length gnus-active-hashtb)))
@@ -13747,11 +12101,11 @@ If FORCE is non-nil, the .newsrc file is read."
            (setq group (let ((obarray gnus-description-hashtb))
                          (read (current-buffer))))
            (skip-chars-forward " \t")
-           (set group (buffer-substring 
-                       (point) (save-excursion (end-of-line) (point))))
+           (and (symbolp group)
+                (set group (buffer-substring (point) (gnus-point-at-eol))))
            (forward-line 1))))
-      (message "Reading descriptions file...done")
-      t)))
+      (gnus-message 5 "Reading descriptions file...done")
+      t))))
 
 (defun gnus-group-get-description (group)
   ;; Get the description of a group by sending XGTITLE to the server.
@@ -13800,6 +12154,8 @@ with some simple extensions.")
   (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)
@@ -13820,7 +12176,7 @@ The following commands are available:
 
 \\{gnus-server-mode-map}"
   (interactive)
-;  (if gnus-visual (gnus-server-make-menu-bar))
+  (if gnus-visual (gnus-server-make-menu-bar))
   (kill-all-local-variables)
   (setq mode-line-modified "-- ")
   (make-local-variable 'mode-line-format)
@@ -13854,7 +12210,8 @@ The following commands are available:
       ()
     (save-excursion
       (set-buffer (get-buffer-create gnus-server-buffer))
-      (gnus-server-mode))))
+      (gnus-server-mode)
+      (and gnus-carpal (gnus-carpal-setup-buffer 'server)))))
 
 (defun gnus-server-prepare ()
   (setq gnus-server-mode-line-format-spec 
@@ -13873,13 +12230,11 @@ The following commands are available:
   (gnus-server-position-cursor))
 
 (defun gnus-server-server-name ()
-  (let ((server (get-text-property 
-                (save-excursion (beginning-of-line) (point)) 'gnus-server)))
+  (let ((server (get-text-property (gnus-point-at-bol) 'gnus-server)))
     (and server (symbol-name server))))
 
 (defalias 'gnus-server-position-cursor 'gnus-goto-colon)
 
-(defvar gnus-winconf-edit-server nil)
 (defconst gnus-server-edit-buffer "*Gnus edit server*")
 
 (defun gnus-server-update-server (server)
@@ -13900,9 +12255,10 @@ The following commands are available:
          (gnus-server-insert-server-line nil (car entry) (cdr entry))
          (gnus-server-position-cursor))))))
 
-(defun gnus-server-set-info (info)
+(defun gnus-server-set-info (server info)
+  ;; Enter a select method into the virtual server alist.
   (gnus-dribble-enter 
-   (concat "(gnus-server-set-info '"
+   (concat "(gnus-server-set-info \"" server "\" '"
           (prin1-to-string info) ")"))
   (let* ((server (nth 1 info))
         (entry (assoc server gnus-server-alist)))
@@ -13911,21 +12267,47 @@ The following commands are available:
            (nconc gnus-server-alist (list (cons server info)))))))
 
 (defun gnus-server-to-method (server)
-  (cdr (assoc server gnus-server-alist)))
+  ;; 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 (cdr (assoc (car method) gnus-server-alist)))))
+        (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))
        ((stringp (car method))
         (gnus-server-extend-method group method))
        (t
-        method)))
+        (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.
 
@@ -14023,30 +12405,50 @@ The following commands are available:
   (interactive (list (gnus-server-server-name)))
   (or server
       (error "No server on current line"))
-  (setq gnus-winconf-edit-server (current-window-configuration))
-  (pop-to-buffer (get-buffer-create gnus-server-edit-buffer))
-  (gnus-add-current-to-buffer-list)
-  (emacs-lisp-mode)
-  (use-local-map (copy-keymap (current-local-map)))
-  (local-set-key "\C-c\C-c" 'gnus-server-edit-server-done)
-  (erase-buffer)
-  (insert ";; Type `C-c C-c' after you have edited the server.\n\n")
-  (insert "(gnus-server-set-info \n  "
-         (pp-to-string (list 'quote (cdr (assoc server gnus-server-alist))))
-         "  )\n"))
+  (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 ()
+(defun gnus-server-edit-server-done (server)
   (interactive)
   (set-buffer (get-buffer-create gnus-server-edit-buffer))
-  (eval-current-buffer)
-  (kill-buffer (current-buffer))
-  (and gnus-winconf-edit-server
-       (set-window-configuration gnus-winconf-edit-server))
-  (setq gnus-winconf-edit-server nil)
-  (set-buffer gnus-server-buffer)
-  (gnus-server-update-server (gnus-server-server-name))
-  (gnus-server-position-cursor))
+  (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-position-cursor)))
+
+(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)))
+
+;; Allow redefinition of Gnus functions.
 
+(gnus-ems-redefine)
 
 (provide 'gnus)