*** empty log message ***
authorLars Magne Ingebrigtsen <larsi@gnus.org>
Tue, 4 Mar 1997 02:07:48 +0000 (02:07 +0000)
committerLars Magne Ingebrigtsen <larsi@gnus.org>
Tue, 4 Mar 1997 02:07:48 +0000 (02:07 +0000)
25 files changed:
lisp/ChangeLog
lisp/gnus-cache.el [new file with mode: 0644]
lisp/gnus-cite.el
lisp/gnus-ems.el [new file with mode: 0644]
lisp/gnus-hilit.el [new file with mode: 0644]
lisp/gnus-kill.el
lisp/gnus-mh.el
lisp/gnus-msg.el
lisp/gnus-score.el
lisp/gnus-uu.el
lisp/gnus-vis.el
lisp/gnus-vm.el [new file with mode: 0644]
lisp/gnus.el
lisp/nnbabyl.el
lisp/nndigest.el
lisp/nndoc.el
lisp/nnfolder.el
lisp/nnkiboze.el
lisp/nnmail.el
lisp/nnmbox.el
lisp/nnmh.el
lisp/nnml.el
lisp/nnspool.el
lisp/nntp.el
texi/gnus.texi

index b3b382a..6919822 100644 (file)
@@ -1,5 +1,188 @@
+Mon May 15 18:29:20 1995  Lars Magne Ingebrigtsen  <larsi@gjalp.ifi.uio.no>
+
+       * gnus.el (gnus-summary-insert-line): Make sure Lines is a number.
+       
+       (gnus-summary-select-article): Don't scroll to the end of the
+       article buffer.
+
+Mon May 15 16:38:04 1995  Lars Magne Ingebrigtsen  <larsi@drott.ifi.uio.no>
+
+       * gnus.el (gnus-summary-sort): Hide threads after sorting, if that
+       is wanted. 
+
+Sun May 14 01:10:51 1995  Lars Ingebrigtsen  <lars@eyesore.no>
+
+       * gnus.el (gnus-verbose): New variable.
+       (gnus-group-mark-group): Stop when there are no more groups to go. 
+       (gnus-group-search-forward): Message when attempting to go too far
+       back. 
+
+       * gnus.el: Use it.
+       (gnus-group-add-to-virtual): New command and keystroke.
+
+       * gnus-vm.el: Did not load vm.
+
+       * gnus.el (gnus-summary-mode-map): New keystroke for saving with
+       vm. 
+
+       * gnus-score.el (gnus-score-load-file): (adapt t) will work
+       independently of gnus-use-adaptive-scoring.
+
+       * gnus.el (gnus-summary-recenter): New implementation.
+
+Sat May 13 19:52:35 1995  Lars Ingebrigtsen  <lars@eyesore.no>
+
+       * gnus.el (gnus-nov-parse-line): Would not read Xrefs.
+
+       * gnus-score.el (gnus-score-save): Don't pp adaptive score files. 
+       (gnus-score-adaptive): Put adaptive entries in a separate score
+       file. 
+       (gnus-score-followup): Put entries into the adaptive score file. 
+
+       * gnus.el (gnus-use-scoring): New variable.
+
+Sat May 13 11:16:31 1995  Lars Magne Ingebrigtsen  <larsi@gjalp.ifi.uio.no>
+
+       * gnus.el (gnus-summary-refer-article): Mark fetched articles as
+       read. 
+       (gnus-summary-catchup): Mark articles as expirable when they are
+       supposed to be.
+       (gnus-group-expire-articles): Allow `total-expire'.
+       (gnus-summary-reselect-current-group): Kill the summary buffer
+       before reselecting.
+
+       * gnus-vis.el (gnus-summary-highlight-line): Would occationally
+       bug out. 
+
+       * gnus.el (gnus-summary-prepare-threads): Do right number of
+       sub-threads under adopted (etc) articles.
+       (gnus-read-descriptions-file): Don't barf on strange formats. 
+
+       * gnus-score.el (gnus-score-adaptive): Ignore pseudos.
+       (gnus-score-remove-lines-adaptive): Ditto.
+
+       * nnml.el (nnml-get-new-mail): Handle a list of spool files. 
+
+       * gnus.el (gnus-windows-old-to-new): Translate 3.13-selects to 4.1
+       symbols. 
+       (gnus-request-article-this-buffer): Always check whether the
+       connection is down.
+       (gnus-summary-save-article): Did not init hashtb.
+       (gnus-matches-options-n): Reversed comparison.
+       (gnus-configure-windows): Use the horizontal spec.
+       (gnus-group-goto-unread): New variable.
+       (gnus-group-next-unread-group): Use it.
+
+       * gnus-cache.el (gnus-cache-retrieve-headers): Don't barf if the
+       cache file doesn't exist.
+
+Thu May 11 12:03:10 1995  Per Abrahamsen  <abraham@iesd.auc.dk>
+
+       * gnus.el (gnus-simplify-buffer-fuzzy): New function.
+       (gnus-simplify-subject-fuzzy): Use it.
+
+       * gnus-score.el: Support fuzzy matches.
+
+Sat May 13 11:09:30 1995  Lars Magne Ingebrigtsen  <larsi@gjalp.ifi.uio.no>
+
+       * gnus.el (gnus-newsrc-to-gnus-format): New implementation. 
+
+Wed May 10 08:42:21 1995  Lars Magne Ingebrigtsen  <larsi@menja.ifi.uio.no>
+
+       * gnus.el (gnus-format-max-width): Don't choke on numbers.
+
+       * nnmh.el (nnmh-request-list): Don't chase links.
+
+       * gnus.el (gnus-parse-n-options): Would reverse the 'ignore and
+       strings. 
+       (gnus-summary-remove-lines-marked-as-read): Also count
+       gnus-ancient-marks as a read mark.
+
+       * nnspool.el (nnspool-inews-switches): Added the no-sig switch.
+
+       * gnus.el (gnus-summary-sort): Don't recurse for all time. 
+
+Wed May 10 07:01:42 1995  Lars Magne Ingebrigtsen  <larsi@hymir.ifi.uio.no>
+
+       * gnus-msg.el (gnus-summary-cancel-article): Remove process marks
+       after cancelling. 
+
+       * gnus.el (gnus-summary-show-all-dormant): Update lines.
+       (gnus-summary-show-all-expunged): Ditto.
+       (gnus-group-process-prefix): Did not understand C-u C-u prefixes
+       and the like. 
+       (gnus-group-catchup-current): Advance to the next unread group.
+       (gnus-summary-catchup): Mark articles at exit if adaptive scoring
+       is used. 
+       (gnus-server-edit-server): Did not configure windows properly.
+
+       * gnus.el: 0.67 is released. 
+
+Tue May  9 10:18:16 1995  Per Abrahamsen  <abraham@iesd.auc.dk>
+
+       * gnus-vis.el (gnus-article-press-button): New function.
+
+       * gnus.el (gnus-article-mode-map): Bind it.
+
+       * gnus-cite.el (gnus-cite-hide-percentage): Upped to 50% (like
+       inews). 
+       (gnus-cite-hide-absolute): Upped to 10 lines.
+
+       * gnus-vis.el (gnus-face-dark-name-list): Some colors was not
+       available everywhere.  New colors suggested by
+       John Salmon <johns@mullet.anu.edu.au>.
+       (gnus-article-highlight-headers): Turn of `buffer-read-only'.
+       (gnus-button-message-id): Do not switch to the summary buffer
+       first. 
+
+       * gnus.el: (gnus-article-add-button): Added autoload.
+       (gnus-article-hide-citation): Replace with autoload from
+       `gnus-cite.el'.
+
+Wed May 10 06:49:33 1995  Lars Magne Ingebrigtsen  <larsi@hymir.ifi.uio.no>
+
+       * gnus-vis.el: Name changes from gnus-visual-summary-* to
+       gnus-summary-*. 
+
+Tue May  9 10:18:16 1995  Per Abrahamsen  <abraham@iesd.auc.dk>
+
+       * gnus-score.el (gnus-summary-immediately-*): Added functions and
+       keybidnings. 
+
+Wed May 10 06:01:34 1995  Lars Magne Ingebrigtsen  <larsi@hymir.ifi.uio.no>
+
+       * gnus.el (gnus-windows-old-to-new): Applied '+ to wrong list. 
+
+Tue May  9 12:26:34 1995  Lars Ingebrigtsen  <lars@eyesore.no>
+
+       * gnus-uu.el (gnus-uu-digest-headers): New variable.
+       (gnus-uu-save-article): Use it.
+
+       * gnus-vis.el (gnus-carpal-setup-buffer): Did not work at all. 
+
+       * gnus.el (gnus-get-unread-articles): Would un-activate already
+       activated groups from secondary servers.
+       (gnus-group-transpose-groups): New implementation.
+       (gnus-group-yank-group): Allow moving even to the end of the
+       buffer. 
+
+       * nnbabyl.el: General tune-up and serious bug-fix all over.
+
+       * gnus.el (gnus-parse-newsrc-body): Would create two dummy.groups
+       when no .newsrc.eld files existed.
+       (gnus-summary-setup-buffer): Be really sure that we want to return
+       to the old buffer.
+
+       * nnbabyl.el (nnbabyl-read-mbox): Insert "OPTIONS" in empty babyl
+       files. 
+
+       * gnus.el (gnus-group-change-level): Insert new groups at the end
+       of the group alist.
+
 Tue May  9 04:49:53 1995  Lars Magne Ingebrigtsen  <larsi@gymir.ifi.uio.no>
 
+        * gnus.el: 0.66 is released.
+
        * gnus.el (gnus-rebuild-remove-articles): Would make all articles
        read and go to the wrong article.
        (gnus-summary-update-lines): Allow highlighting of a region.
diff --git a/lisp/gnus-cache.el b/lisp/gnus-cache.el
new file mode 100644 (file)
index 0000000..3d4d7ea
--- /dev/null
@@ -0,0 +1,295 @@
+;;; gnus-cache --- cache interface for Gnus
+;; Copyright (C) 1995 Free Software Foundation, Inc.
+
+;; Author: Lars Magne Ingebrigtsen <larsi@ifi.uio.no>
+;; Keywords: news
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 2, or (at your option)
+;; any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING.  If not, write to
+;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+
+;;; Commentary:
+
+;;; Code:
+
+(require 'gnus)
+
+(defvar gnus-cache-directory (concat gnus-article-save-directory "cache/")
+  "*The directory where cached articles will be stored.")
+
+(defvar gnus-cache-enter-articles '(ticked dormant)
+  "*Classes of articles to enter into the cache.")
+
+(defvar gnus-cache-remove-articles '(read)
+  "*Classes of articles to remove from the cache.")
+
+\f
+
+(defvar gnus-cache-buffer nil)
+
+\f
+
+(defun gnus-cache-change-buffer (group)
+  (save-excursion
+    (cond ((null gnus-cache-buffer)
+          ;; No current cache, so we create and init the buffer.
+          (setq gnus-cache-buffer
+                (cons group (get-buffer-create " *gnus-cache-overview*")))
+          (set-buffer (cdr gnus-cache-buffer))
+          (buffer-disable-undo (current-buffer))
+          (erase-buffer)
+          (gnus-add-current-to-buffer-list)
+          (let ((file (gnus-cache-file-name group ".overview")))
+            (and (file-exists-p file)
+                 (insert-file-contents file))))
+         ((not (string= group (car gnus-cache-buffer)))
+          ;; If a different overview cache is the current, we
+          ;; (possibly) save it and change to this groups.
+          (set-buffer (cdr gnus-cache-buffer))
+          (and (buffer-modified-p)
+               (write-region (point-min) (point-max)
+                             (gnus-cache-file-name
+                              (car gnus-cache-buffer) ".overview")
+                             nil 'quiet))
+          (erase-buffer)
+          (setcar gnus-cache-buffer group)
+          (let ((file (gnus-cache-file-name group ".overview")))
+            (and (file-exists-p file)
+                 (insert-file-contents file)))))))
+
+
+;; Just save the overview buffer.
+(defun gnus-cache-save-buffers ()
+  (and gnus-cache-buffer
+       (save-excursion
+        (set-buffer (cdr gnus-cache-buffer))
+        (and (buffer-modified-p)
+             (write-region (point-min) (point-max)
+                           (gnus-cache-file-name (car gnus-cache-buffer)
+                                                 ".overview")
+                           nil 'quiet))))
+  (setq gnus-cache-buffer nil))
+
+;; Return whether an article is a member of a class.
+(defun gnus-cache-member-of-class (class ticked dormant unread)
+  (or (and ticked (memq 'ticked class))
+      (and dormant (memq 'dormant class))
+      (and unread (memq 'unread class))
+      (and (not unread) (memq 'read class))))
+
+(defun gnus-cache-file-name (group article)
+  (concat (file-name-as-directory gnus-cache-directory)
+         (if (gnus-use-long-file-name 'not-cache)
+             group (gnus-replace-chars-in-string group ?. ?/))
+         "/" (if (stringp article) article (int-to-string article))))
+
+(defun gnus-cache-possibly-enter-article 
+  (group article headers ticked dormant unread)
+  (let ((number (header-number headers))
+       file dir)
+    (if (or (not (gnus-cache-member-of-class
+                 gnus-cache-enter-articles ticked dormant unread))
+           (file-exists-p (setq file (gnus-cache-file-name group article))))
+       ()
+      (gnus-summary-select-article)
+      (or (file-exists-p (setq dir (file-name-directory file)))
+         (gnus-make-directory dir))
+      (if (file-exists-p file)
+         t
+       (save-excursion
+         (set-buffer gnus-article-buffer)
+         (write-region (point-min) (point-max) file nil 'quiet)
+         (gnus-cache-change-buffer group)
+         (set-buffer (cdr gnus-cache-buffer))
+         (goto-char (point-max))
+         (forward-line -1)
+         (while (and (not (bobp))
+                     (> (read (current-buffer)) number))
+           (forward-line -1))
+         (if (bobp) 
+             (if (not (eobp))
+                 (progn
+                   (beginning-of-line)
+                   (if (< (read (current-buffer)) number)
+                       (forward-line 1)))
+               (beginning-of-line))
+           (forward-line 1))
+         ;; [number subject from date id references chars lines xref]
+         (insert (format "%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t\n"
+                         (header-number headers)
+                         (header-subject headers)
+                         (header-date headers)
+                         (header-id headers)
+                         (or (header-references headers) "")
+                         (or (header-chars headers) "")
+                         (or (header-lines headers) "")
+                         (or (header-xref headers) ""))))
+       t))))
+
+(defun gnus-cache-possibly-remove-article 
+  (group article ticked dormant unread)
+  (let ((file (gnus-cache-file-name group article)))
+    (if (or (not (file-exists-p file))
+           (not (gnus-cache-member-of-class
+                 gnus-cache-remove-articles ticked dormant unread)))
+       nil
+      (save-excursion
+       (delete-file file)
+       (gnus-cache-change-buffer group)
+       (set-buffer (cdr gnus-cache-buffer))
+       (goto-char (point-min))
+       (if (or (looking-at (concat (string-to-int article) "\t"))
+               (search-forward (concat "\n" (string-to-int article) "\t")))
+           (delete-region (progn (beginning-of-line) (point))
+                          (progn (forward-line 1) (point))))))))
+
+(defun gnus-cache-request-article (article group)
+  (let ((file (gnus-cache-file-name group article)))
+    (if (not (file-exists-p file))
+       ()
+      (erase-buffer)
+      (insert-file-contents file)
+      t)))
+
+(defun gnus-cache-articles-in-group (group)
+  (let ((dir (file-name-directory (gnus-cache-file-name group 1)))
+       articles)
+    (if (not (file-exists-p dir))
+       nil
+      (setq articles (directory-files dir nil "^[0-9]+$" t))
+      (if (not articles)
+         nil
+       (sort (mapcar (function (lambda (name)
+                                 (string-to-int name))) 
+                     articles)
+             '<)))))
+
+(defun gnus-cache-active-articles (group)
+  (let ((articles (gnus-cache-articles-in-group group)))
+    (and articles
+        (cons (car articles) (gnus-last-element articles)))))
+
+(defun gnus-cache-possibly-alter-active (group active)
+  (let ((cache-active (gnus-cache-active-articles group)))
+    (and cache-active (< (car cache-active) (car active))
+        (setcar active (car cache-active)))
+    (and cache-active (> (cdr cache-active) (cdr active))
+        (setcdr active (cdr cache-active)))))
+
+(defun gnus-cache-retrieve-headers (articles group)
+  (let* ((cached (gnus-cache-articles-in-group group))
+        (articles (gnus-sorted-complement articles cached))
+        (cache-file (gnus-cache-file-name group ".overview"))
+        type)
+    (let ((gnus-use-cache nil))
+      (setq type (gnus-retrieve-headers articles group)))
+    (gnus-cache-save-buffers)
+    (save-excursion
+      (cond ((not (file-exists-p cache-file))
+            type)
+           ((null type)
+            (set-buffer nntp-server-buffer)
+            (erase-buffer)
+            (insert-file-contents cache-file)
+            'nov)
+           ((eq type 'nov)
+            (gnus-cache-braid-nov group cached)
+            type)
+           (t
+            (gnus-cache-braid-heads group cached)
+            type)))))
+
+(defun gnus-cache-braid-nov (group cached)
+  (let ((cache-buf (get-buffer-create " *gnus-cache*"))
+       beg end)
+    (gnus-cache-save-buffers)
+    (save-excursion
+      (set-buffer cache-buf)
+      (buffer-disable-undo (current-buffer))
+      (erase-buffer)
+      (insert-file-contents (gnus-cache-file-name group ".overview"))
+      (goto-char (point-min))
+      (insert "\n")
+      (goto-char (point-min)))
+    (set-buffer nntp-server-buffer)
+    (goto-char (point-min))
+    (while cached
+      (while (and (not (eobp))
+                 (< (read (current-buffer)) (car cached)))
+       (forward-line 1))
+      (beginning-of-line)
+      (save-excursion
+       (set-buffer cache-buf)
+       (if (search-forward (concat "\n" (int-to-string (car cached)) "\t")
+                           nil t)
+           (setq beg (progn (beginning-of-line) (point))
+                 end (progn (forward-line 1) (point)))
+         (setq beg nil)))
+      (and beg (insert-buffer-substring cache-buf beg end))
+      (setq cached (cdr cached)))
+    (kill-buffer cache-buf)))
+
+(defun gnus-cache-braid-heads (group cached)
+  (let ((cache-buf (get-buffer-create " *gnus-cache*"))
+       beg end)
+    (save-excursion
+      (set-buffer cache-buf)
+      (buffer-disable-undo (current-buffer))
+      (erase-buffer))
+    (set-buffer nntp-server-buffer)
+    (goto-char (point-min))
+    (while cached
+      (while (and (not (eobp))
+                 (looking-at "2.. +\\([0-9]+\\) ")
+                 (< (progn (goto-char (match-beginning 1))
+                           (read (current-buffer)))
+                    (car cached)))
+       (search-forward "\n.\n" nil 'move))
+      (beginning-of-line)
+      (save-excursion
+       (set-buffer cache-buf)
+       (erase-buffer)
+       (insert-file-contents (gnus-cache-file-name group (car cached)))
+       (goto-char (point-min))
+       (insert "220 " (int-to-string (car cached)) " Article retrieved.\n")
+       (search-forward "\n\n" nil 'move)
+       (delete-region (point) (point-max))
+       (forward-char -1)
+       (insert "."))
+      (insert-buffer-substring cache-buf)
+      (setq cached (cdr cached)))
+    (kill-buffer cache-buf)))
+
+(defun gnus-jog-cache ()
+  "Go through all groups and put the articles into the cache."
+  (interactive)
+  (let ((newsrc (cdr gnus-newsrc-alist))
+       (gnus-cache-enter-articles '(unread))
+       (gnus-mark-article-hook nil)
+       (gnus-expert-user t)
+       (gnus-large-newsgroup nil))
+    (while newsrc
+      (gnus-summary-read-group (car (car newsrc)))
+      (if (not (eq major-mode 'gnus-summary-mode))
+         ()
+       (while gnus-newsgroup-unreads
+         (gnus-summary-select-article t t nil (car gnus-newsgroup-unreads))
+         (setq gnus-newsgroup-unreads (cdr gnus-newsgroup-unreads)))
+       (kill-buffer (current-buffer)))
+      (setq newsrc (cdr newsrc)))))
+
+(provide 'gnus-cache)
+             
+;;; gnus-cache.el ends here
index e8df3f2..1852915 100644 (file)
@@ -1,15 +1,34 @@
-;;; gnus-cite.el --- Highlight GNUS article.
+;;; gnus-cite.el --- parse citations in articles for Gnus
 ;; Copyright (C) 1995 Free Software Foundation, Inc.
 
 ;; Author: Per Abrahamsen <abraham@iesd.auc.dk>
 ;; Keywords: news, mail
 
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 2, or (at your option)
+;; any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING.  If not, write to
+;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+
 ;;; Commentary:
 
 ;;; Code:
 
 (require 'gnus)
-(require 'gnus-vis)
+
+(eval-and-compile
+  (autoload 'gnus-article-add-button "gnus-vis")
+  )
 
 ;;; Customization:
 
@@ -55,15 +74,29 @@ The text matching the first grouping will be used as a button.")
   "Face used for attribution lines.
 It is merged with the face for the cited text belonging to the attribution.")
 
-(defvar gnus-cite-hide-percentage 30
+(defvar gnus-cite-hide-percentage 50
   "Only hide cited text if it is larger than this percent of the body.")
 
-(defvar gnus-cite-hide-absolute 5
+(defvar gnus-cite-hide-absolute 10
   "Only hide cited text if there is at least this number of cited lines.")
 
+(defvar gnus-face-light-name-list
+  '("light blue" "light cyan" "light yellow" "light pink"
+    "pale green" "beige" "orange" "magenta" "violet" "medium purple"
+    "turquoise")
+  "Names of light colors.")
+
+(defvar gnus-face-dark-name-list
+  '("blue" "dark salmon" "firebrick"
+    "dark green" "dark orange" "dark khaki" "dark violet"
+    "dark turquoise")
+  "Names of dark colors.")
 
 ;;; Internal Variables:
 
+(defvar gnus-article-length nil)
+;; Length of article last time we parsed it.
+
 (defvar gnus-cite-prefix-alist nil)
 ;; Alist of citation prefixes.  
 ;; The cdr is a list of lines with that prefix.
@@ -113,6 +146,7 @@ Lines matching `gnus-cite-attribution-postfix' and perhaps
     (let ((buffer-read-only nil)
          (alist gnus-cite-prefix-alist)
          (faces gnus-cite-face-list)
+         (inhibit-point-motion-hooks t)
          face entry prefix skip numbers number face-alist end)
       ;; Loop through citation prefixes.
       (while alist
@@ -166,6 +200,7 @@ See the documentation for `gnus-article-highlight-citation'."
     (gnus-cite-parse-maybe)
     (let ((buffer-read-only nil)
          (alist gnus-cite-prefix-alist)
+         (inhibit-point-motion-hooks t)
          numbers number)
       (while alist
        (setq numbers (cdr (car alist))
@@ -175,8 +210,8 @@ See the documentation for `gnus-article-highlight-citation'."
                numbers (cdr numbers))
          (goto-line number)
          (or (assq number gnus-cite-attribution-alist)
-             (put-text-property (point) (progn (forward-line 1) (point))
-                                'invisible t)))))))
+             (add-text-properties (point) (progn (forward-line 1) (point))
+                                  gnus-hidden-properties)))))))
 
 (defun gnus-article-hide-citation-maybe (&optional force)
   "Hide cited text that has an attribution line.
@@ -194,6 +229,7 @@ See also the documentation for `gnus-article-highlight-citation'."
     (let ((start (point))
          (atts gnus-cite-attribution-alist)
          (buffer-read-only nil)
+         (inhibit-point-motion-hooks t)
          (hiden 0)
          total)
       (goto-char (point-max))
@@ -216,8 +252,9 @@ See also the documentation for `gnus-article-highlight-citation'."
                      total (cdr total))
                (goto-line hiden)
                (or (assq hiden gnus-cite-attribution-alist)
-                   (put-text-property (point) (progn (forward-line 1) (point))
-                                      'invisible t)))))))))
+                   (add-text-properties (point) 
+                                        (progn (forward-line 1) (point))
+                                        gnus-hidden-properties)))))))))
 
 ;;; Internal functions:
 
@@ -467,7 +504,8 @@ See also the documentation for `gnus-article-highlight-citation'."
 (defun gnus-cite-add-face (number prefix face)
   ;; At line NUMBER, ignore PREFIX and add FACE to the rest of the line.
   (if face
-      (let (from to)
+      (let ((inhibit-point-motion-hooks t)
+           from to)
        (goto-line number)
        (forward-char (length prefix))
        (skip-chars-forward " \t")
@@ -483,18 +521,19 @@ See also the documentation for `gnus-article-highlight-citation'."
     (set-buffer gnus-article-buffer)
     (let ((buffer-read-only nil)
          (numbers (cdr (assoc prefix gnus-cite-prefix-alist)))
+         (inhibit-point-motion-hooks t)
          number)
       (while numbers
        (setq number (car numbers)
              numbers (cdr numbers))
        (goto-line number)
        (cond ((get-text-property (point) 'invisible)
-              (put-text-property (point) (progn (forward-line 1) (point))
-                                 'invisible nil))
+              (remove-text-properties (point) (progn (forward-line 1) (point))
+                                      gnus-hidden-properties))
              ((assq number gnus-cite-attribution-alist))
              (t
-              (put-text-property (point) (progn (forward-line 1) (point))
-                                 'invisible t)))))))
+              (add-text-properties (point) (progn (forward-line 1) (point))
+                                   gnus-hidden-properties)))))))
 
 (defun gnus-cite-find-prefix (line)
   ;; Return citation prefix for LINE.
diff --git a/lisp/gnus-ems.el b/lisp/gnus-ems.el
new file mode 100644 (file)
index 0000000..19a3602
--- /dev/null
@@ -0,0 +1,94 @@
+;;; gnus-ems --- functions for making Gnus work under different Emacsii
+;; Copyright (C) 1995 Free Software Foundation, Inc.
+
+;; Author: Lars Magne Ingebrigtsen <larsi@ifi.uio.no>
+;; Keywords: news
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 2, or (at your option)
+;; any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING.  If not, write to
+;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+
+;;; Commentary:
+
+;;; Code:
+
+(defvar gnus-mouse-2 [mouse-2])
+(defvar gnus-easymenu 'easymenu)
+
+;; We do not byte-compile this file, because error messages are such a
+;; bore.  
+
+(eval
+ '(cond 
+   ((string-match "XEmacs\\|Lucid" emacs-version)
+    ;; XEmacs definitions.
+
+    (setq gnus-mouse-2 [button2])
+    (setq gnus-easymenu 'auc-menu)
+
+    (or (memq 'underline (list-faces))
+       (make-face 'underline))
+    (or (face-differs-from-default-p 'underline)
+       (set-face-underline-p 'underline t))
+    (or (fboundp 'set-text-properties)
+       (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 ()))))
+  
+    (setq ad-activate-on-definition t)
+    (ad-start-advice)
+    (ad-activate-defined-function)
+    (defadvice gnus-set-mouse-face (around gnus-xemacs-set-mouse-face preact)
+      string)
+
+    (if (not gnus-visual)
+       ()
+      (setq gnus-group-mode-hook
+           (cons
+            (lambda ()
+              (easy-menu-add gnus-group-reading-menu)
+              (easy-menu-add gnus-group-group-menu)
+              (easy-menu-add gnus-group-post-menu)
+              (easy-menu-add gnus-group-misc-menu)
+              (gnus-install-mouse-tracker)) 
+            gnus-group-mode-hook))
+      (setq gnus-summary-mode-hook
+           (cons
+            (lambda ()
+              (easy-menu-add gnus-summary-mark-menu)
+              (easy-menu-add gnus-summary-move-menu)
+              (easy-menu-add gnus-summary-article-menu)
+              (easy-menu-add gnus-summary-thread-menu)
+              (easy-menu-add gnus-summary-misc-menu)
+              (easy-menu-add gnus-summary-post-menu)
+              (easy-menu-add gnus-summary-kill-menu)
+              (gnus-install-mouse-tracker)) 
+            gnus-summary-mode-hook))
+      (setq gnus-article-mode-hook
+           (cons
+            (lambda ()
+              (easy-menu-add gnus-article-article-menu)
+              (easy-menu-add gnus-article-treatment-menu))
+            gnus-article-mode-hook)))
+
+    (defun gnus-install-mouse-tracker ()
+      (require 'mode-motion)
+      (setq mode-motion-hook 'mode-motion-highlight-line)))
+   ))
+
+(provide 'gnus-ems)
+
+;;; gnus-ems.el ends here
diff --git a/lisp/gnus-hilit.el b/lisp/gnus-hilit.el
new file mode 100644 (file)
index 0000000..e69de29
index be0b37f..519199b 100644 (file)
@@ -59,9 +59,9 @@
   (define-key gnus-kill-file-mode-map
     "\C-c\C-k\C-a" 'gnus-kill-file-kill-by-author)
   (define-key gnus-kill-file-mode-map
-    "\C-c\C-k\C-a" 'gnus-kill-file-kill-by-thread)
+    "\C-c\C-k\C-t" 'gnus-kill-file-kill-by-thread)
   (define-key gnus-kill-file-mode-map 
-    "\C-c\C-k\C-a" 'gnus-kill-file-kill-by-xref)
+    "\C-c\C-k\C-x" 'gnus-kill-file-kill-by-xref)
   (define-key gnus-kill-file-mode-map
     "\C-c\C-a" 'gnus-kill-file-apply-buffer)
   (define-key gnus-kill-file-mode-map
index 7b3fef9..1965f3c 100644 (file)
@@ -81,10 +81,6 @@ The command \\[mh-yank-cur-msg] yank the original message into current buffer."
 
        (gnus-article-show-all-headers) ;; so colors are happy
        ;; lots of junk to avoid mh-send deleting other windows
-       (if gnus-split-window 
-             (split-window-vertically)
-         )
-
        (setq from (gnus-fetch-field "from")
              subject (let ((subject (or (gnus-fetch-field "subject")
                                         "(None)")))
@@ -108,10 +104,20 @@ The command \\[mh-yank-cur-msg] yank the original message into current buffer."
        )) ;; save excursion/restriction
 
     (mh-find-path)
-    (if gnus-split-window
-       (mh-send-sub to (or cc "") (or subject "(None)") config);; Erik Selberg 1/23/94
-      (mh-send to (or cc "") subject);; shouldn't use according to mhe
+    (mh-send-sub to (or cc "") (or subject "(None)") config) ;; Erik Selberg 1/23/94
+
+    (let ((draft (current-buffer))
+         mail-buf)
+      (if (not yank)
+         (gnus-configure-windows 'reply)
+       (gnus-configure-windows 'reply-yank))
+      (setq mail-buf (cdr (assq 'mail gnus-window-to-buffer)))
+      (pop-to-buffer mail-buf) ;; always in the display, so won't have window probs
+      (switch-to-buffer draft)
+      (kill-buffer mail-buf) ;; mh-e don't use it!
       )
+
+    ;;    (mh-send to (or cc "") subject);; shouldn't use according to mhe
     
     ;; note - current buffer is now draft!
     (save-excursion
@@ -147,21 +153,20 @@ The command \\[mh-yank-cur-msg] yank the original message into current buffer."
        subject
        (config (current-window-configuration))) ;; need to add this - erik
     ;;(gnus-article-show-all-headers)
-    (if gnus-split-window
-       (progn
-         (pop-to-buffer gnus-article-buffer)
-         (split-window-vertically)
-         (setq buffer (current-buffer))
-         ))
     (setq subject
          (concat "[" gnus-newsgroup-name "] "
                  ;;(mail-strip-quoted-names (gnus-fetch-field "From")) ": "
                  (or (gnus-fetch-field "subject") "")))
     (setq mh-show-buffer buffer)
     (mh-find-path)
-    (if gnus-split-window
-       (mh-send-sub to (or cc "") subject config)
-      (mh-send to (or cc "") subject)
+    (mh-send-sub to (or cc "") (or subject "(None)") config) ;; Erik Selberg 1/23/94
+    (let ((draft (current-buffer))
+         mail-buf)
+      (gnus-configure-windows 'reply-yank)
+      (setq mail-buf (cdr (assq 'mail gnus-window-to-buffer)))
+      (pop-to-buffer mail-buf) ;; always in the display, so won't have window probs
+      (switch-to-buffer draft)
+      (kill-buffer mail-buf) ;; mh-e don't use it!
       )
     (save-excursion
       (goto-char (point-max))
index 4deb2f5..e6cc208 100644 (file)
@@ -1,4 +1,4 @@
-;;; gnus-message --- mail and post interface for Gnus
+;;; gnus-msg --- mail and post interface for Gnus
 ;; Copyright (C) 1995 Free Software Foundation, Inc.
 
 ;; Author: Masanobu UMEDA <umerin@flab.flab.fujitsu.junet>
@@ -37,7 +37,6 @@
   "*Local news organization file.")
 
 (defvar gnus-post-news-buffer "*post-news*")
-(defvar gnus-winconf-post-news nil)
 
 (defvar gnus-summary-send-map nil)
 
 (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
-       (if gnus-split-window 
-           (progn
-             (pop-to-buffer gnus-article-buffer)
-             (widen)
-             (split-window-vertically)
-             (gnus-post-news 'post))
-         (gnus-post-news 'post nil nil gnus-article-buffer))
-      (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)))
+    (gnus-post-news 'post nil nil 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)
+  (gnus-post-news 'post gnus-newsgroup-name))
+
+(defun gnus-summary-followup (yank &optional yank-articles)
   "Compose a followup to an article.
 If prefix argument YANK is non-nil, original article is yanked automatically."
   (interactive "P")
   (gnus-set-global-variables)
+  (if yank-articles (gnus-summary-goto-subject (car yank-articles)))
   (save-window-excursion
     (gnus-summary-select-article t))
   (let ((headers gnus-current-headers)
@@ -141,44 +109,40 @@ If prefix argument YANK is non-nil, original article is yanked automatically."
                       "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-post-news nil gnus-newsgroup-name
+                     headers gnus-article-buffer 
+                     (or yank-articles (not (not yank))))))
   (gnus-article-hide-headers-if-wanted))
 
-(defun gnus-summary-followup-with-original ()
+(defun gnus-summary-followup-with-original (n)
   "Compose a followup to an article and include the original article."
-  (interactive)
-  (gnus-summary-followup t))
+  (interactive "P")
+  (gnus-summary-followup t (gnus-summary-work-articles n)))
 
 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
-(defun gnus-summary-followup-and-reply (yank)
+(defun gnus-summary-followup-and-reply (yank &optional yank-articles)
   "Compose a followup and do an auto mail to author."
   (interactive "P")
   (let ((gnus-auto-mail-to-author t))
-    (gnus-summary-followup yank)))
+    (gnus-summary-followup yank yank-articles)))
 
-(defun gnus-summary-followup-and-reply-with-original ()
+(defun gnus-summary-followup-and-reply-with-original (n)
   "Compose a followup, include the original, and do an auto mail to author."
-  (interactive)
-  (gnus-summary-followup-and-reply t))
+  (interactive "P")
+  (gnus-summary-followup-and-reply t (gnus-summary-work-articles n)))
 
-(defun gnus-summary-cancel-article ()
+(defun gnus-summary-cancel-article (n)
   "Cancel an article you posted."
-  (interactive)
+  (interactive "P")
   (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))
+  (let ((articles (gnus-summary-work-articles n)))
+    (while articles
+      (gnus-summary-select-article t nil nil (car articles))
+      (gnus-summary-remove-process-mark (car articles))
+      (gnus-summary-mark-as-read (car articles) gnus-canceled-mark)
+      (gnus-eval-in-buffer-window gnus-article-buffer (gnus-cancel-news))
+      (gnus-article-hide-headers-if-wanted)
+      (setq articles (cdr articles)))))
 
 (defun gnus-summary-supersede-article ()
   "Compose an article that will supersede a previous article.
@@ -240,6 +204,7 @@ Type \\[describe-mode] in the buffer to get a list of commands."
                          (set-buffer gnus-summary-buffer)
                          (cons (current-buffer) gnus-current-article))))
            (from (and header (header-from header)))
+           (winconf (current-window-configuration))
            follow-to real-group)
        (and gnus-interactive-post
             (not gnus-expert-user)
@@ -270,15 +235,10 @@ Type \\[describe-mode] in the buffer to get a list of commands."
                                 (funcall gnus-followup-to-function group)))))
                 gnus-use-followup-to))
          (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-configure-windows 'post)
+           (if yank
+               (gnus-configure-windows 'followup-yank)
+             (gnus-configure-windows 'followup)))
          (gnus-overload-functions)
          (make-local-variable 'gnus-article-reply)
          (make-local-variable 'gnus-article-check-size)
@@ -324,9 +284,22 @@ Type \\[describe-mode] in the buffer to get a list of commands."
            (re-search-forward 
             (concat "^" (regexp-quote mail-header-separator) "$"))
            (forward-line 1)
-           (and yank (save-excursion (news-reply-yank-original nil)))
+           (if (not yank)
+               ()
+             (save-excursion 
+               (if (not (listp yank))
+                   (news-reply-yank-original nil)
+                 (while yank
+                   (save-window-excursion
+                     (gnus-summary-select-article nil nil nil (car yank))
+                     (gnus-summary-remove-process-mark (car yank)))
+                   (let ((mail-reply-buffer gnus-article-buffer))
+                     (news-reply-yank-original nil))
+                   (setq yank (cdr yank))))))
            (if gnus-post-prepare-function
-               (funcall gnus-post-prepare-function group))))))
+               (funcall gnus-post-prepare-function group)))
+         (make-local-variable 'gnus-prev-winconf)
+         (setq gnus-prev-winconf winconf))))
   (setq gnus-article-check-size (cons (buffer-size) (gnus-article-checksum)))
   (message "")
   t)
@@ -417,41 +390,42 @@ will attempt to use the foreign server to post the article."
                (save-excursion
                  (save-restriction
                    (widen)
-                   (message "Sending via mail...")
+                   (gnus-message 5 "Sending via mail...")
                      
                    (if gnus-mail-courtesy-message
                        (progn
                          ;; Insert "courtesy" mail message.
-                         (goto-char 1)
+                         (goto-char (point-min))
                          (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)
+                         (goto-char (point-min))
                          (search-forward gnus-mail-courtesy-message)
                          (replace-match "" t t))
                      (funcall gnus-mail-send-method))
 
-                   (message "Sending via mail... done")
+                   (gnus-message 5 "Sending via mail... done")
                      
-                   (goto-char 1)
+                   (goto-char (point-min))
                    (narrow-to-region
                     1 (re-search-forward 
                        (concat "^" (regexp-quote 
                                     mail-header-separator) "$")))
-                   (goto-char 1)
+                   (goto-char (point-min))
                    (delete-matching-lines "BCC:.*")))
              (ding)
-             (message "No mailer defined.  To: and/or Cc: fields ignored.")
+             (gnus-message 
+              1 "No mailer defined.  To: and/or Cc: fields ignored.")
              (sit-for 1))))
 
       ;; Send to NNTP server. 
-      (message "Posting to USENET...")
+      (gnus-message 5 "Posting to USENET...")
       (if (gnus-inews-article use-group-method)
          (progn
-           (message "Posting to USENET... done")
+           (gnus-message 5 "Posting to USENET... done")
            (if (gnus-buffer-exists-p (car-safe reply))
                (progn
                  (save-excursion
@@ -459,17 +433,15 @@ will attempt to use the foreign server to post the article."
                    (gnus-summary-mark-article-as-replied 
                     (cdr reply))))))
        ;; We cannot signal an error.
-       (ding) (message "Article rejected: %s" 
-                       (gnus-status-message gnus-select-method)))
+       (ding) (gnus-message 1 "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))
+    (bury-buffer)
     ;; Restore last window configuration.
-    (and gnus-winconf-post-news
-        (set-window-configuration gnus-winconf-post-news))
-    (setq gnus-winconf-post-news nil)))
+    (and gnus-prev-winconf (set-window-configuration gnus-prev-winconf))))
 
 (defun gnus-inews-check-post ()
   "Check whether the post looks ok."
@@ -587,6 +559,8 @@ will attempt to use the foreign server to post the article."
            (newsgroups nil)
            (message-id nil)
            (distribution nil))
+       (or (gnus-member-of-valid 'post gnus-newsgroup-name)
+           (error "This backend does not support cancelling"))
        (save-excursion
          ;; Get header info. from original article.
          (save-restriction
@@ -605,7 +579,7 @@ will attempt to use the foreign server to post the article."
                (downcase (mail-strip-quoted-names from))
                (downcase (mail-strip-quoted-names (gnus-inews-user-name)))))
              (progn
-               (ding) (message "This article is not yours."))
+               (ding) (gnus-message 3 "This article is not yours."))
            ;; Make control article.
            (set-buffer (get-buffer-create " *Gnus-canceling*"))
            (buffer-disable-undo (current-buffer))
@@ -616,12 +590,12 @@ will attempt to use the foreign server to post the article."
                    mail-header-separator "\n"
                    "This is a cancel message from " from ".\n")
            ;; Send the control article to NNTP server.
-           (message "Canceling your article...")
+           (gnus-message 5 "Canceling your article...")
            (if (gnus-inews-article)
-               (message "Canceling your article... done")
+               (gnus-message 5 "Canceling your article... done")
              (ding) 
-             (message "Cancel failed; %s" 
-                      (gnus-status-message gnus-newsgroup-name)))
+             (gnus-message 1 "Cancel failed; %s" 
+                           (gnus-status-message gnus-newsgroup-name)))
            ;; Kill the article buffer.
            (kill-buffer (current-buffer)))))))
 
@@ -970,7 +944,7 @@ domain is undefined, the domain name is got from it."
   ;; 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 ()
+(defun gnus-inews-unique-id-old ()
   "Generate unique ID from user name and current time."
   (concat (downcase (gnus-inews-login-name))
          (mapconcat 
@@ -984,7 +958,7 @@ domain is undefined, the domain name is got from it."
 ;; cannot generate IDs that the old version could.
 ;; You might for example insert a "." somewhere (not next to another dot
 ;; or string boundary), or modify the newsreader name to "Ding".
-(defun gnus-inews-unique-id-new ()
+(defun gnus-inews-unique-id ()
   ;; Dont use microseconds from (current-time), they may be unsupported.
   ;; Instead we use this randomly inited counter.
   (setq gnus-unique-id-char
@@ -1006,7 +980,7 @@ domain is undefined, the domain name is got from it."
      ;; Append the newsreader name, because while the generated
      ;; ID is unique to this newsreader, other newsreaders might
      ;; otherwise generate the same ID via another algorithm.
-     ".DING")))
+     ".fsf")))
 
 
 (defun gnus-inews-date ()
@@ -1064,7 +1038,7 @@ organization."
 
 ;;; Mail reply commands of Gnus summary mode
 
-(defun gnus-summary-reply (yank)
+(defun gnus-summary-reply (yank &optional yank-articles)
   "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."
@@ -1072,35 +1046,28 @@ Customize the variable gnus-mail-reply-method to use another mailer."
   ;; Bug fix by jbw@bigbird.bu.edu (Joe Wells)
   ;; Stripping headers should be specified with mail-yank-ignored-headers.
   (gnus-set-global-variables)
-  (setq gnus-winconf-post-news (current-window-configuration))
+  (if yank-articles (gnus-summary-goto-subject (car yank-articles)))
   (gnus-summary-select-article t)
   (let ((gnus-newsgroup-name gnus-newsgroup-name))
     (bury-buffer gnus-article-buffer)
-    (funcall gnus-mail-reply-method yank))
+    (funcall gnus-mail-reply-method (or yank-articles (not (not yank)))))
   (gnus-article-hide-headers-if-wanted))
 
-(defun gnus-summary-reply-with-original ()
+(defun gnus-summary-reply-with-original (n)
   "Reply mail to news author with original article.
 Customize the variable gnus-mail-reply-method to use another mailer."
-  (interactive)
-  (gnus-summary-reply t))
+  (interactive "P")
+  (gnus-summary-reply t (gnus-summary-work-articles n)))
 
 (defun gnus-summary-mail-forward (post)
   "Forward the current message to another user.
 Customize the variable gnus-mail-forward-method to use another mailer."
   (interactive "P")
   (gnus-summary-select-article t)
-  (setq gnus-winconf-post-news (current-window-configuration))
-  (if gnus-split-window
-      (widen)
-    (switch-to-buffer gnus-article-buffer)
-    (widen)
-    (delete-other-windows)
-    (bury-buffer gnus-article-buffer))
   (let ((gnus-newsgroup-name gnus-newsgroup-name))
     (if post
-       (gnus-forward-using-post)
-      (funcall gnus-mail-forward-method)))
+       (gnus-forward-using-post gnus-article-buffer)
+      (funcall gnus-mail-forward-method gnus-article-buffer)))
   (gnus-article-hide-headers-if-wanted))
 
 (defun gnus-summary-post-forward ()
@@ -1113,7 +1080,6 @@ Customize the variable gnus-mail-forward-method to use another mailer."
 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)))
 
@@ -1123,12 +1089,15 @@ mailer."
     (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)))
+         (winconf (current-window-configuration))
          from subject date to reply-to message-of
          references message-id sender follow-to cc sendto elt)
       (set-buffer (get-buffer-create "*mail*"))
       (mail-mode)
       (make-local-variable 'gnus-article-reply)
       (setq gnus-article-reply cur)
+      (make-local-variable 'gnus-prev-winconf)
+      (setq gnus-prev-winconf winconf)
       (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)
@@ -1151,7 +1120,8 @@ mailer."
                  (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"))
+         (setq date (or (mail-fetch-field "date") 
+                        (header-date gnus-current-headers)))
          (and from
               (let ((stop-pos 
                      (string-match "  *at \\|  *@ \\| *(\\| *<" from)))
@@ -1207,19 +1177,27 @@ mailer."
        (re-search-forward
         (concat "^" (regexp-quote mail-header-separator) "$"))
        (forward-line 1)
-       (if yank
-           (let ((last (point)))
-             (save-excursion
-               (mail-yank-original nil))
-             (run-hooks 'news-reply-header-hook)
-             (goto-char last))))
-      (let ((mail (current-buffer)))
-       (if yank
-           (progn
-             (gnus-configure-windows '(0 1 0))
-             (switch-to-buffer mail))
-         (gnus-configure-windows '(0 0 1))
-         (switch-to-buffer-other-window mail))))))
+       (if (not yank)
+           (gnus-configure-windows 'reply)
+         (let ((last (point))
+               end)
+           (if (not (listp yank))
+               (progn
+                 (save-excursion
+                   (mail-yank-original nil))
+                 (run-hooks 'news-reply-header-hook))
+             (while yank
+               (save-window-excursion
+                 (gnus-summary-select-article nil nil nil (car yank))
+                 (gnus-summary-remove-process-mark (car yank)))
+               (save-excursion
+                 (mail-yank-original nil)
+                 (setq end (point)))
+               (run-hooks 'news-reply-header-hook)
+               (goto-char end)
+               (setq yank (cdr yank))))
+           (goto-char last))
+         (gnus-configure-windows 'reply-yank))))))
 
 (defun gnus-mail-yank-original ()
   (interactive)
@@ -1229,31 +1207,29 @@ mailer."
 
 (defun gnus-mail-send-and-exit ()
   (interactive)
-  (let ((cbuf (current-buffer)))
+  (let ((reply gnus-article-reply)
+       (winconf gnus-prev-winconf))
     (mail-send-and-exit nil)
     (if (get-buffer gnus-group-buffer)
        (progn
-         (save-excursion
-           (set-buffer cbuf)
-           (let ((reply gnus-article-reply))
-             (if (gnus-buffer-exists-p (car-safe 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-forward-make-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")
+         (if (gnus-buffer-exists-p (car-safe reply))
+             (progn
+               (set-buffer (car reply))
+               (and (cdr reply)
+                    (gnus-summary-mark-article-as-replied 
+                     (cdr reply)))))
+         (and winconf (set-window-configuration winconf))))))
+
+(defun gnus-forward-make-subject (buffer)
+  (save-excursion
+    (set-buffer buffer)
+    (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") "")))
+           "] " (or (gnus-fetch-field "Subject") ""))))
 
 (defun gnus-forward-insert-buffer (buffer)
   (let ((beg (goto-char (point-max))))
@@ -1269,27 +1245,28 @@ mailer."
                              (point) 'invisible)
                             (point-max))))))
 
-(defun gnus-mail-forward-using-mail ()
+(defun gnus-mail-forward-using-mail (&optional buffer)
   "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 (gnus-forward-make-subject)))
-    ;; 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 (current-local-map)))
-         (local-set-key "\C-c\C-c" 'gnus-mail-send-and-exit)
-         (gnus-forward-insert-buffer forward-buffer)
-         ;; You have a chance to arrange the message.
-         (run-hooks 'gnus-mail-forward-hook)))))
-
-(defun gnus-forward-using-post ()
-  (let ((forward-buffer (current-buffer))
-       (subject (gnus-forward-make-subject)))
+  (let* ((forward-buffer (or buffer (current-buffer)))
+        (winconf (current-window-configuration))
+        (subject (gnus-forward-make-subject forward-buffer)))
+    (set-buffer forward-buffer)
+    (mail nil nil subject)
+    (use-local-map (copy-keymap (current-local-map)))
+    (local-set-key "\C-c\C-c" 'gnus-mail-send-and-exit)
+    (make-local-variable 'gnus-prev-winconf)
+    (setq gnus-prev-winconf winconf)
+    (gnus-forward-insert-buffer forward-buffer)
+    (goto-char (point-min))
+    (re-search-forward "^To: " nil t)
+    (gnus-configure-windows 'mail-forward)
+    ;; You have a chance to arrange the message.
+    (run-hooks 'gnus-mail-forward-hook)))
+
+(defun gnus-forward-using-post (&optional buffer)
+  (let* ((forward-buffer (or buffer (current-buffer))) 
+        (subject (gnus-forward-make-subject forward-buffer)))
     (gnus-post-news 'post nil nil nil nil subject)
     (save-excursion
       (gnus-forward-insert-buffer forward-buffer)
@@ -1298,10 +1275,13 @@ mailer."
 
 (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))
+  (let ((winconf (current-window-configuration)))
+    (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)
+    (make-local-variable 'gnus-prev-winconf)
+    (setq gnus-prev-winconf winconf)))
 
 (provide 'gnus-msg)
 
-;;; gnus-message.el ends here
+;;; gnus-msg.el ends here
index a512cec..88c2f35 100644 (file)
 
 (require 'gnus)
 
+(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-adaptive-file-suffix "ADAPT"
+  "*Suffix of the adaptive score files.")
+
 (defvar gnus-score-expiry-days 7
   "*Number of days before unused score file entries are expired.")
 
@@ -49,8 +70,9 @@
 
 ;; Internal variables.
 
+(defvar gnus-internal-global-score-files nil)
+(defvar gnus-score-file-list nil)
 (defvar gnus-current-score-file nil)
-
 (defvar gnus-adaptive-score-alist gnus-default-adaptive-score-alist)
 
 (defvar gnus-score-alist nil
@@ -75,8 +97,6 @@ of the last succesful match.")
 (defvar gnus-header-index nil)
 (defvar gnus-score-index nil)
 
-(defvar gnus-winconf-edit-score nil)
-
 (autoload 'gnus-uu-ctl-map "gnus-uu" nil nil 'keymap)
 
 ;;; Summary mode score maps.
@@ -84,6 +104,7 @@ of the last succesful match.")
 (defvar gnus-summary-score-map nil)
 (defvar gnus-summary-increase-map nil)
 (defvar gnus-summary-inc-subject-map nil)
+(defvar gnus-summary-inc-fuzzy-map nil)
 (defvar gnus-summary-inc-author-map nil)
 (defvar gnus-summary-inc-body-map nil)
 (defvar gnus-summary-inc-id-map nil)
@@ -92,6 +113,7 @@ of the last succesful match.")
 (defvar gnus-summary-inc-fol-map nil)
 (defvar gnus-summary-lower-map nil)
 (defvar gnus-summary-low-subject-map nil)
+(defvar gnus-summary-low-fuzzy-map nil)
 (defvar gnus-summary-low-author-map nil)
 (defvar gnus-summary-low-body-map nil)
 (defvar gnus-summary-low-id-map nil)
@@ -121,14 +143,25 @@ of the last succesful match.")
   (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 "i" 'gnus-summary-immediately-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-fuzzy-map)
+  (define-key gnus-summary-increase-map "z" gnus-summary-inc-fuzzy-map)
+  (define-key gnus-summary-increase-map "Z" 'gnus-summary-temporarily-raise-by-fuzzy)
+  (define-key gnus-summary-inc-fuzzy-map "z" 'gnus-summary-temporarily-raise-by-fuzzy)
+  (define-key gnus-summary-inc-fuzzy-map "Z" 'gnus-summary-raise-by-fuzzy)
+  (define-key gnus-summary-inc-fuzzy-map "i" 'gnus-summary-immediately-raise-by-fuzzy)
+  (define-key gnus-summary-inc-fuzzy-map "t" 'gnus-summary-temporarily-raise-by-fuzzy)
+  (define-key gnus-summary-inc-fuzzy-map "p" 'gnus-summary-raise-by-fuzzy)
+
   (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 "i" 'gnus-summary-immediately-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)
 
@@ -137,6 +170,7 @@ of the last succesful match.")
   (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 "i" 'gnus-summary-immediately-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)
 
@@ -145,6 +179,7 @@ of the last succesful match.")
   (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 "i" 'gnus-summary-immediately-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)
 
@@ -153,6 +188,7 @@ of the last succesful match.")
   (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 "i" 'gnus-summary-immediately-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)
 
@@ -161,15 +197,17 @@ of the last succesful match.")
   (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 "i" 'gnus-summary-immediately-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-increase-map "F" 'gnus-summary-temporarily-raise-followups-to-author)
+  (define-key gnus-summary-inc-fol-map "f" 'gnus-summary-temporarily-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 "i" 'gnus-summary-immediately-raise-followups-to-author)
+  (define-key gnus-summary-inc-fol-map "t" 'gnus-summary-temporarily-raise-followups-to-author)
   (define-key gnus-summary-inc-fol-map "p" 'gnus-summary-raise-followups-to-author)
 
 
@@ -185,14 +223,25 @@ of the last succesful match.")
   (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 "i" 'gnus-summary-immediately-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-fuzzy-map)
+  (define-key gnus-summary-lower-map "z" 'gnus-summary-low-fuzzy-map)
+  (define-key gnus-summary-lower-map "Z" 'gnus-summary-temporarily-lower-by-fuzzy)
+  (define-key gnus-summary-low-fuzzy-map "z" 'gnus-summary-temporarily-lower-by-fuzzy)
+  (define-key gnus-summary-low-fuzzy-map "Z" 'gnus-summary-lower-by-fuzzy)
+  (define-key gnus-summary-low-fuzzy-map "i" 'gnus-summary-immediately-lower-by-fuzzy)
+  (define-key gnus-summary-low-fuzzy-map "t" 'gnus-summary-temporarily-lower-by-fuzzy)
+  (define-key gnus-summary-low-fuzzy-map "p" 'gnus-summary-lower-by-fuzzy)
+
   (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 "i" 'gnus-summary-immediately-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)
 
@@ -201,6 +250,7 @@ of the last succesful match.")
   (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 "i" 'gnus-summary-immediately-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)
 
@@ -209,6 +259,7 @@ of the last succesful match.")
   (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 "i" 'gnus-summary-immediately-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)
 
@@ -217,6 +268,7 @@ of the last succesful match.")
   (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 "i" 'gnus-summary-immediately-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)
 
@@ -225,15 +277,17 @@ of the last succesful match.")
   (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 "i" 'gnus-summary-immediately-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-lower-map "F" 'gnus-summary-temporarily-lower-followups-to-author)
+  (define-key gnus-summary-low-fol-map "f" 'gnus-summary-temporarily-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 "i" 'gnus-summary-immediately-lower-followups-to-author)
+  (define-key gnus-summary-low-fol-map "t" 'gnus-summary-temporarily-lower-followups-to-author)
   (define-key gnus-summary-low-fol-map "p" 'gnus-summary-lower-followups-to-author)
 
 
@@ -257,7 +311,9 @@ 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."
+DATE is the expire date, or nil for no expire, or 'now for immediate expire.
+If optional argument `PROMPT' is non-nil, allow user to edit match.
+If optional argument `SILENT' is nil, show effect of score entry."
   (interactive
    (list (completing-read "Header: "
                          gnus-header-index
@@ -266,48 +322,59 @@ DATE is the expire date."
         (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)))
+        (cond ((not (y-or-n-p "Add to SCORE file? "))
+               'now)
+              ((y-or-n-p "Expire kill? ")
+               (current-time-string))
+              (t 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") 
+                                    (cond ((eq date 'now)
+                                           "now")
+                                          ((stringp date)
+                                           "temp")
+                                          (t "permanent"))
                                     header
                                     (if (< score 0) "lower" "raise"))
                             match)))
     (and (>= (nth 1 (assoc header gnus-header-index)) 0)
         (not silent)
         (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))
-         elem)
-      ;; We see whether we can collapse some score entries.
-      ;; This isn't quite correct, because there may be more elements
-      ;; later on with the same key that have matching elems... Hm.
-      (if (and old
-              (setq elem (assoc match old))
-              (eq (nth 3 elem) (nth 3 new))
-              (or (and (numberp (nth 2 elem)) (numberp (nth 2 new)))
-                  (and (not (nth 2 elem)) (not (nth 2 new)))))
-         ;; Yup, we just add this new score to the old elem.
-         (setcar (cdr elem) (+ (or (nth 1 elem) 
-                                   gnus-score-interactive-default-score)
-                               (or (nth 1 new)
-                                   gnus-score-interactive-default-score)))
-       ;; Nope, we have to add a new elem.
-       (gnus-score-set header (if old (cons new old) (list new)))))
-    (gnus-score-set 'touched '(t))))
+    (if (eq date 'now)
+       ()
+      (and (= score gnus-score-interactive-default-score)
+          (setq score nil))
+      (let ((new (cond ((eq type 'f)
+                   (list (gnus-simplify-subject-fuzzy match)
+                         score (and date (gnus-day-number date)) type))
+                  (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))
+           elem)
+       ;; We see whether we can collapse some score entries.
+       ;; This isn't quite correct, because there may be more elements
+       ;; later on with the same key that have matching elems... Hm.
+       (if (and old
+                (setq elem (assoc match old))
+                (eq (nth 3 elem) (nth 3 new))
+                (or (and (numberp (nth 2 elem)) (numberp (nth 2 new)))
+                    (and (not (nth 2 elem)) (not (nth 2 new)))))
+           ;; Yup, we just add this new score to the old elem.
+           (setcar (cdr elem) (+ (or (nth 1 elem) 
+                                     gnus-score-interactive-default-score)
+                                 (or (nth 1 new)
+                                     gnus-score-interactive-default-score)))
+         ;; Nope, we have to add a new elem.
+         (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.
@@ -326,14 +393,18 @@ SCORE is the score to add."
     (or (and (stringp match) (> (length match) 0))
       (error "No match"))
     (goto-char (point-min))
-    (let ((regexp (if type
-                     match
-                   (concat "\\`.*" (regexp-quote match) ".*\\'"))))
+    (let ((regexp (cond ((eq type 'f)
+                        (gnus-simplify-subject-fuzzy match))
+                       (type match)
+                       (t (concat "\\`.*" (regexp-quote match) ".*\\'")))))
       (while (not (eobp))
        (let ((content (gnus-summary-header header))
              (case-fold-search t))
          (and content
-              (if (string-match regexp content)
+              (if (if (eq type 'f)
+                      (string-equal (gnus-simplify-subject-fuzzy content)
+                                    regexp)
+                    (string-match regexp content))
                   (gnus-summary-raise-score score))))
        (beginning-of-line 2)))))
 
@@ -354,6 +425,68 @@ SCORE is the score to add."
           (gnus-summary-score-entry
            "xref" (concat " " group ":") nil score date t)))))
 
+(defun gnus-summary-immediately-lower-by-subject (level)
+  "Immediately 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)) 'now t))
+
+(defun gnus-summary-immediately-lower-by-fuzzy (level)
+  "Immediately lower score by LEVEL for current fuzzy subject.
+See `gnus-score-expiry-days'."
+  (interactive "P")
+  (gnus-summary-score-entry
+   "subject" (gnus-summary-header "subject")
+   'f (- (gnus-score-default level)) 'now))
+
+(defun gnus-summary-immediately-lower-by-author (level)
+  "Immediately 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)) 
+   'now t))
+
+(defun gnus-summary-immediately-lower-by-body (level)
+  "Immediately lower score by LEVEL for a match on the body of the article.
+See `gnus-score-expiry-days'."
+  (interactive "P")
+  (error "Not yet implemented")
+  (gnus-summary-score-entry 
+   "body" "" nil (- (gnus-score-default level)) 'now t))
+
+(defun gnus-summary-immediately-lower-by-id (level)
+  "Immediately 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)) 'now))
+
+(defun gnus-summary-immediately-lower-by-xref (level)
+  "Immediately lower score by LEVEL for current xref.
+See `gnus-score-expiry-days'."
+  (interactive "P")
+  (gnus-summary-score-crossposting (- (gnus-score-default level)) 'now))
+
+(defun gnus-summary-immediately-lower-by-thread (level)
+  "Immediately 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)) 'now))
+
+(defun gnus-summary-immediately-lower-followups-to-author (level)
+  "Lower score by LEVEL for all followups to the current author."
+  (interactive "P")
+  (error "Not yet implemented")
+  (gnus-summary-score-entry 
+   "followup" (gnus-summary-header "from") 
+   nil (- (gnus-score-default level)) 'now t t))
+
 (defun gnus-summary-temporarily-lower-by-subject (level)
   "Temporarily lower score by LEVEL for current subject.
 See `gnus-score-expiry-days'."
@@ -363,6 +496,15 @@ See `gnus-score-expiry-days'."
    nil (- (gnus-score-default level))
    (current-time-string) t))
 
+(defun gnus-summary-temporarily-lower-by-fuzzy (level)
+  "Temporarily lower score by LEVEL for current fuzzy subject.
+See `gnus-score-expiry-days'."
+  (interactive "P")
+  (gnus-summary-score-entry
+   "subject" (gnus-summary-header "subject")
+   'f (- (gnus-score-default level))
+   (current-time-string)))
+
 (defun gnus-summary-temporarily-lower-by-author (level)
   "Temporarily lower score by LEVEL for current author.
 See `gnus-score-expiry-days'."
@@ -402,6 +544,13 @@ See `gnus-score-expiry-days'."
    "references" (gnus-summary-header "message-id")
    nil (- (gnus-score-default level)) (current-time-string)))
 
+(defun gnus-summary-temporarily-lower-followups-to-author (level)
+  "Lower score by LEVEL for all followups to the current author."
+  (interactive "P")
+  (gnus-summary-score-entry 
+   "followup" (gnus-summary-header "from")
+   nil (- (gnus-score-default level)) (current-time-string) t t))
+
 (defun gnus-summary-lower-by-subject (level)
   "Lower score by LEVEL for current subject."
   (interactive "P")
@@ -410,6 +559,14 @@ See `gnus-score-expiry-days'."
    nil (- (gnus-score-default level)) 
    nil t))
 
+(defun gnus-summary-lower-by-fuzzy (level)
+  "Lower score by LEVEL for current fuzzy subject."
+  (interactive "P")
+  (gnus-summary-score-entry
+   "subject" (gnus-summary-header "subject")
+   'f (- (gnus-score-default level)) 
+   nil))
+
 (defun gnus-summary-lower-by-author (level)
   "Lower score by LEVEL for current author."
   (interactive "P")
@@ -440,7 +597,67 @@ See `gnus-score-expiry-days'."
   (interactive "P")
   (gnus-summary-score-entry 
    "followup" (gnus-summary-header "from")
-   nil (gnus-score-default level) (current-time-string) t t))
+   nil (- (gnus-score-default level)) nil t t))
+
+(defun gnus-summary-immediately-raise-by-subject (level)
+  "Immediately 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 'now t))
+
+(defun gnus-summary-immediately-raise-by-fuzzy (level)
+  "Immediately raise score by LEVEL for current fuzzy subject.
+See `gnus-score-expiry-days'."
+  (interactive "P")
+  (gnus-summary-score-entry
+   "subject" (gnus-summary-header "subject")
+   'f level 'now))
+
+(defun gnus-summary-immediately-raise-by-author (level)
+  "Immediately 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 'now t))
+
+(defun gnus-summary-immediately-raise-by-body (level)
+  "Immediately raise score by LEVEL for a match on the body of the article.
+See `gnus-score-expiry-days'."
+  (interactive "P")
+  (error "Not yet implemented")
+  (gnus-summary-score-entry "body" "" nil level 'now t))
+
+(defun gnus-summary-immediately-raise-by-id (level)
+  "Immediately 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 'now))
+
+(defun gnus-summary-immediately-raise-by-xref (level)
+  "Immediately raise score by LEVEL for current xref.
+See `gnus-score-expiry-days'."
+  (interactive "P")
+  (gnus-summary-score-crossposting level 'now))
+
+(defun gnus-summary-immediately-raise-by-thread (level)
+  "Immediately 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 'now))
+
+(defun gnus-summary-immediately-raise-followups-to-author (level)
+  "Raise score by LEVEL for all followups to the current author."
+  (interactive "P")
+  (error "Not yet implemented")
+  (gnus-summary-score-entry 
+   "followup" (gnus-summary-header "from")
+   nil (gnus-score-default level) 'now t t))
 
 (defun gnus-summary-temporarily-raise-by-subject (level)
   "Temporarily raise score by LEVEL for current subject.
@@ -450,6 +667,14 @@ See `gnus-score-expiry-days'."
    "subject" (gnus-simplify-subject-re (gnus-summary-header "subject"))
    nil level (current-time-string) t))
 
+(defun gnus-summary-temporarily-raise-by-fuzzy (level)
+  "Temporarily raise score by LEVEL for current fuzzy subject.
+See `gnus-score-expiry-days'."
+  (interactive "P")
+  (gnus-summary-score-entry
+   "subject" (gnus-summary-header "subject")
+   'f level (current-time-string)))
+
 (defun gnus-summary-temporarily-raise-by-author (level)
   "Temporarily raise score by LEVEL for current author.
 See `gnus-score-expiry-days'."
@@ -485,6 +710,13 @@ See `gnus-score-expiry-days'."
    "references" (gnus-summary-header "message-id")
    nil level (current-time-string)))
 
+(defun gnus-summary-temporarily-raise-followups-to-author (level)
+  "Raise score by LEVEL for all followups to the current author."
+  (interactive "P")
+  (gnus-summary-score-entry 
+   "followup" (gnus-summary-header "from")
+   nil (gnus-score-default level) (current-time-string) t t))
+
 (defun gnus-summary-raise-by-subject (level)
   "Raise score by LEVEL for current subject."
   (interactive "P")
@@ -492,6 +724,13 @@ See `gnus-score-expiry-days'."
    "subject" (gnus-simplify-subject-re (gnus-summary-header "subject"))
    nil level nil t))
 
+(defun gnus-summary-raise-by-fuzzy (level)
+  "Raise score by LEVEL for current fuzzy subject."
+  (interactive "P")
+  (gnus-summary-score-entry
+   "subject" (gnus-summary-header "subject")
+   nil level nil))
+
 (defun gnus-summary-raise-by-author (level)
   "Raise score by LEVEL for current author."
   (interactive "P")
@@ -519,7 +758,7 @@ See `gnus-score-expiry-days'."
   (interactive "P")
   (gnus-summary-score-entry 
    "followup" (gnus-summary-header "from")
-   nil (gnus-score-default level) (current-time-string) t t))
+   nil (gnus-score-default level) nil t t))
 
 
 \f
@@ -582,9 +821,7 @@ See `gnus-score-expiry-days'."
 
 (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)
+  (interactive (list (completing-read "Score file: " gnus-score-cache)))
   (gnus-score-load-file file)
   (gnus-set-mode-line 'summary))
 
@@ -592,11 +829,14 @@ See `gnus-score-expiry-days'."
   "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"))
+  (let ((winconf (current-window-configuration)))
+    (gnus-configure-windows 'article)
+    (pop-to-buffer (find-file-noselect file))
+    (make-local-variable 'gnus-prev-winconf)
+    (setq gnus-prev-winconf winconf))
+  (gnus-message 
+   4 (substitute-command-keys 
+      "\\<gnus-score-mode-map>\\[gnus-score-edit-done] to save edits"))
   (gnus-score-mode))
   
 (defun gnus-score-edit-file (file)
@@ -604,11 +844,14 @@ See `gnus-score-expiry-days'."
   (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"))
+  (let ((winconf (current-window-configuration)))
+    (gnus-configure-windows 'article)
+    (pop-to-buffer (find-file-noselect file))
+    (make-local-variable 'gnus-prev-winconf)
+    (setq gnus-prev-winconf winconf))
+  (gnus-message 
+   4 (substitute-command-keys 
+      "\\<gnus-score-mode-map>\\[gnus-score-edit-done] to save edits"))
   (gnus-score-mode))
   
 (defun gnus-score-load-file (file)
@@ -664,15 +907,18 @@ See `gnus-score-expiry-days'."
                                      files))))
       (and eval (not global) (eval eval))
       (setq gnus-scores-exclude-files exclude-files)
-      (if orphan (setq gnus-orphan-score (car orphan)))
+      (if orphan (setq gnus-orphan-score orphan))
       (setq gnus-adaptive-score-alist
            (cond ((equal adapt '(t))
+                  (setq gnus-newsgroup-adaptive t)
                   gnus-default-adaptive-score-alist)
                  ((equal adapt '(ignore))
-                  nil)
+                  (setq gnus-newsgroup-adaptive nil))
                  ((consp adapt)
+                  (setq gnus-newsgroup-adaptive t)
                   adapt)
                  (t
+                  (setq gnus-newsgroup-adaptive gnus-use-adaptive-scoring)
                   gnus-default-adaptive-score-alist)))
       (setq gnus-summary-mark-below 
            (or mark mark-and-expunge gnus-summary-mark-below))
@@ -713,7 +959,7 @@ See `gnus-score-expiry-days'."
                          (read (current-buffer))
                        (error 
                         (progn
-                          (message "Problem with score file %s" file)
+                          (gnus-message 3 "Problem with score file %s" file)
                           (ding) 
                           (sit-for 2)
                           nil))))))
@@ -729,7 +975,7 @@ See `gnus-score-expiry-days'."
    ((null alist)
     nil)
    ((not (consp alist))
-    (message "Score file is not a list: %s" file)
+    (gnus-message 1 "Score file is not a list: %s" file)
     (ding)
     nil)
    (t
@@ -737,11 +983,11 @@ See `gnus-score-expiry-days'."
          err)
       (while (and a (not err))
        (cond ((not (listp (car a)))
-              (message "Illegal score element %s in %s" (car a) file)
+              (gnus-message 3 "Illegal score element %s in %s" (car a) file)
               (setq err t))
              ((and (stringp (car (car a)))
                    (not (listp (nth 1 (car a)))))
-              (message "Illegal header match %s in %s" (nth 1 (car a)) file)
+              (gnus-message 3 "Illegal header match %s in %s" (nth 1 (car a)) file)
               (setq err t))
              (t
               (setq a (cdr a)))))
@@ -790,12 +1036,20 @@ See `gnus-score-expiry-days'."
                score (cdr entry))
          (if (or (not (equal (gnus-score-get 'touched score) '(t)))
                  (gnus-score-get 'read-only score)
-                 (not (file-writable-p file)))
+                 (and (file-exists-p file)
+                      (not (file-writable-p file))))
              ()
            (setq score (setcdr entry (delq (assq 'touched score) score)))
            (erase-buffer)
            (let (emacs-lisp-mode-hook)
-             (pp score (current-buffer)))
+             (if (string-match (concat gnus-adaptive-file-suffix) file)
+                 ;; This is an adaptive score file, so we do not run
+                 ;; it through `pp'.  These files can get huge, and
+                 ;; are not meant to be edited by human hands.
+                 (insert (format "%S" score))
+               ;; This is a normal score file, so we print it very
+               ;; prettily. 
+               (pp score (current-buffer))))
            (gnus-make-directory (file-name-directory file))
            (write-region (point-min) (point-max) file nil 'silent))))
       (kill-buffer (current-buffer)))))
@@ -835,7 +1089,7 @@ See `gnus-score-expiry-days'."
             (expire (- now gnus-score-expiry-days))
             (headers gnus-newsgroup-headers)
             entry header)
-       (message "Scoring...")
+       (gnus-message 5 "Scoring...")
        ;; Create articles, an alist of the form `(HEADER . SCORE)'.
        (while headers
          (setq header (car headers)
@@ -881,7 +1135,7 @@ See `gnus-score-expiry-days'."
                          gnus-newsgroup-scored)))
          (setq gnus-scores-articles (cdr gnus-scores-articles)))
 
-       (message "Scoring...done")))))
+       (gnus-message 5 "Scoring...done")))))
 
 
 (defun gnus-get-new-thread-ids (articles)
@@ -984,8 +1238,9 @@ See `gnus-score-expiry-days'."
          ;; 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))
+           (and (funcall match-func 
+                         (or (aref (car (car articles)) gnus-score-index) 0)
+                         match)
                 (progn
                   (setq found t)
                   (setcdr (car articles) (+ score (cdr (car articles))))))
@@ -1070,7 +1325,7 @@ See `gnus-score-expiry-days'."
              (setq request-func 'gnus-request-article)))
        (while articles
          (setq article (header-number (car (car articles))))
-         (message "Scoring on article %s..." article)
+         (gnus-message 7 "Scoring on article %s..." article)
          (if (not (funcall request-func article gnus-newsgroup-name))
              ()
            (widen)
@@ -1137,9 +1392,15 @@ See `gnus-score-expiry-days'."
 (defun gnus-score-followup (scores header now expire)
   ;; Insert the unique article headers in the buffer.
   (let ((gnus-score-index (nth 1 (assoc header gnus-header-index)))
+       (current-score-file gnus-current-score-file)
        ;; gnus-score-index is used as a free variable.
        alike last this art entries alist articles)
 
+    ;; Change score file to the adaptive score file.  All entries that
+    ;; this function makes will be put into this file.
+    (gnus-score-load-file (gnus-score-file-name 
+                          gnus-newsgroup-name gnus-adaptive-file-suffix))
+
     (setq gnus-scores-articles (sort gnus-scores-articles 'gnus-score-string<)
          articles gnus-scores-articles)
 
@@ -1215,7 +1476,9 @@ See `gnus-score-expiry-days'."
                 (gnus-score-set 'touched '(t) alist)
                 (setcdr entries (cdr rest))
                 (setq rest entries)))
-         (setq entries rest))))))
+         (setq entries rest))))
+    ;; We change the score file back to the previous one.
+    (gnus-score-load-file current-score-file)))
 
 (defun gnus-score-add-followups (header score)
   (save-excursion
@@ -1225,15 +1488,15 @@ See `gnus-score-expiry-days'."
      (current-time-string) nil t)))
 
 
-(defun gnus-score-string (scores header now expire)
-  ;; Score ARTICLES according to HEADER in SCORES.
+(defun gnus-score-string (score-list header now expire)
+  ;; Score ARTICLES according to HEADER in SCORE-LIST.
   ;; 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)
+       alike last this art entries alist articles scores fuzzy)
 
     ;; Sorting the articles costs os O(N*log N) but will allow us to
     ;; only match with each unique header.  Thus the actual matching
@@ -1267,7 +1530,8 @@ See `gnus-score-expiry-days'."
           (insert last ?\n)                    
           (put-text-property (1- (point)) (point) 'articles alike)))
   
-    ;; Find matches.
+    ;; Find ordinary matches.
+    (setq scores score-list) 
     (while scores
       (setq alist (car scores)
            scores (cdr scores)
@@ -1289,41 +1553,96 @@ See `gnus-score-expiry-days'."
                      ((or (= dmt ?e) (= dmt ?s) (= dmt ?f)) 'search-forward)
                      (t (error "Illegal match type: %s" type))))
               arts art)
-         (goto-char (point-min))
-         (if (= dmt ?e)
-             (while (and (not (eobp)) 
-                         (funcall search-func match nil t))
-               (and (= (progn (beginning-of-line) (point))
-                       (match-beginning 0))
-                    (= (progn (end-of-line) (point))
-                       (match-end 0))
-                    (progn
-                      (setq found (setq arts (get-text-property 
-                                              (point) 'articles)))
-                      ;; Found a match, update scores.
-                      (while arts
-                        (setq art (car arts)
-                              arts (cdr arts))
-                        (setcdr art (+ score (cdr art))))))
-               (forward-line 1))
-           (and (string= match "") (setq match "\n"))
-           (while (funcall search-func match nil t)
-             (end-of-line)
-             (setq found (setq 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)))
+         (if (= dmt ?f)
+             (setq fuzzy t)
+           (goto-char (point-min))
+           (if (= dmt ?e)
+               (while (and (not (eobp)) 
+                           (funcall search-func match nil t))
+                 (and (= (progn (beginning-of-line) (point))
+                         (match-beginning 0))
+                      (= (progn (end-of-line) (point))
+                         (match-end 0))
+                      (progn
+                        (setq found (setq arts (get-text-property 
+                                                (point) 'articles)))
+                        ;; Found a match, update scores.
+                        (while arts
+                          (setq art (car arts)
+                                arts (cdr arts))
+                          (setcdr art (+ score (cdr art))))))
+                 (forward-line 1))
+             (and (string= match "") (setq match "\n"))
+             (while (funcall search-func match nil t)
+               (end-of-line)
+               (setq found (setq 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))))
+  
+    ;; Find fuzzy matches.
+    (setq scores (and fuzzy score-list))
+    (if fuzzy (gnus-simplify-buffer-fuzzy))
+    (while scores
+      (setq alist (car scores)
+           scores (cdr scores)
+           entries (assoc header alist))
+      (while (cdr entries)             ;First entry is the header index.
+       (let* ((rest (cdr entries))             
+              (kill (car rest))
+              (match (nth 0 kill))
+              (type (or (nth 3 kill) 's))
+              (score (or (nth 1 kill) gnus-score-interactive-default-score))
+              (date (nth 2 kill))
+              (found nil)
+              (mt (aref (symbol-name type) 0))
+              (case-fold-search 
+               (not (or (= mt ?R) (= mt ?S) (= mt ?E) (= mt ?F))))
+              (dmt (downcase mt))
+              (search-func 
+               (cond ((= dmt ?r) 're-search-forward)
+                     ((or (= dmt ?e) (= dmt ?s) (= dmt ?f)) 'search-forward)
+                     (t (error "Illegal match type: %s" type))))
+              arts art)
+         (if (/= dmt ?f)
+             ()
+           (goto-char (point-min))
+           (while (and (not (eobp)) 
+                       (funcall search-func match nil t))
+             (and (= (progn (beginning-of-line) (point))
+                     (match-beginning 0))
+                  (= (progn (end-of-line) (point))
+                     (match-end 0))
+                  (progn
+                    (setq found (setq arts (get-text-property 
+                                            (point) 'articles)))
+                    ;; Found a match, update scores.
+                    (while arts
+                      (setq art (car arts)
+                            arts (cdr arts))
+                      (setcdr art (+ score (cdr art))))))
+             (forward-line 1))
+           ;; Update expire date
+           (cond ((null date))         ;Permanent entry.
+                 (found                ;Match, update date.
+                  (gnus-score-set 'touched '(t) alist)
+                  (setcar (nthcdr 2 kill) now))
+                 ((< date expire)      ;Old entry, remove.
+                  (gnus-score-set 'touched '(t) alist)
+                  (setcdr entries (cdr rest))
+                  (setq rest entries))))
          (setq entries rest))))))
 
 (defun gnus-score-string< (a1 a2)
@@ -1380,11 +1699,15 @@ See `gnus-score-expiry-days'."
                           (downcase (symbol-name (car (car elem)))))))
          (setq elem (cdr elem)))
        (setq malist (cdr malist)))
+      ;; We change the score file to the adaptive score file.
+      (gnus-score-load-file (gnus-score-file-name 
+                            gnus-newsgroup-name gnus-adaptive-file-suffix))
       ;; The we score away.
       (goto-char (point-min))
       (while (not (eobp))
        (setq elem (cdr (assq (gnus-summary-article-mark) alist)))
-       (if (not elem)
+       (if (or (not elem)
+               (get-text-property (point) 'gnus-pseudo))
            ()
          (setq headers (gnus-get-header-by-number 
                         (gnus-summary-article-number)))
@@ -1419,10 +1742,14 @@ See `gnus-score-expiry-days'."
        (setq malist (cdr malist)))
       ;; The we score away.
       (goto-char (point-min))
+      ;; We change the score file to the adaptive score file.
+      (gnus-score-load-file (gnus-score-file-name 
+                            gnus-newsgroup-name gnus-adaptive-file-suffix))
       (while (re-search-forward marks nil t)
        (beginning-of-line)
        (setq elem (cdr (assq (gnus-summary-article-mark) alist)))
-       (if (not elem)
+       (if (or (not elem)
+               (get-text-property (gnus-point-at-bol) 'gnus-pseudo))
            ()
          (setq headers (gnus-get-header-by-number 
                         (gnus-summary-article-number)))
@@ -1468,14 +1795,211 @@ This mode is an extended emacs-lisp mode.
 (defun gnus-score-edit-done ()
   "Save the score file and return to the summary buffer."
   (interactive)
-  (let ((bufnam (buffer-file-name (current-buffer))))
+  (let ((bufnam (buffer-file-name (current-buffer)))
+       (winconf gnus-prev-winconf))
     (save-buffer)
     (kill-buffer (current-buffer))
-    (and gnus-winconf-edit-score
-        (set-window-configuration gnus-winconf-edit-score))
+    (and winconf (set-window-configuration winconf))
     (gnus-score-remove-from-cache bufnam)
     (gnus-score-load-file bufnam)))
 
+;;; Finding score files. 
+
+(defvar gnus-global-score-files nil
+  "*List of global score files and directories.
+Set this variable if you want to use people's score files.  One entry
+for each score file or each score file directory.  Gnus will decide
+by itself what score files are applicable to which group.
+
+Say you want to use the single score file
+\"/ftp.ifi.uio.no@ftp:/pub/larsi/ding/score/soc.motss.SCORE\" and all
+score files in the \"/ftp.some-where:/pub/score\" directory.
+
+ (setq gnus-global-score-files
+       '(\"/ftp.ifi.uio.no:/pub/larsi/ding/score/soc.motss.SCORE\"
+         \"/ftp.some-where:/pub/score\"))")
+
+(defun gnus-score-score-files (group)
+  "Return a list of all possible score files."
+  ;; Search and set any global score files.
+  (and gnus-global-score-files 
+       (or gnus-internal-global-score-files
+          (gnus-score-search-global-directories gnus-global-score-files)))
+  ;; Fix the kill-file dir variable.
+  (setq gnus-kill-files-directory 
+       (file-name-as-directory
+        (or gnus-kill-files-directory "~/News/")))
+  ;; If er can't read it, there's no score files.
+  (if (not (file-readable-p gnus-kill-files-directory))
+      (setq gnus-score-file-list nil)
+    (if (gnus-use-long-file-name 'not-score)
+       ;; We want long file names.
+       (if (or (not gnus-score-file-list)
+               (gnus-file-newer-than gnus-kill-files-directory
+                                     (car gnus-score-file-list)))
+             (setq gnus-score-file-list 
+                   (cons (nth 5 (file-attributes gnus-kill-files-directory))
+                         (nreverse 
+                          (directory-files 
+                           gnus-kill-files-directory t 
+                           (gnus-score-file-regexp))))))
+      ;; We do not use long file names, so we have to do some
+      ;; directory traversing.  
+      (let ((dir (expand-file-name
+                 (concat gnus-kill-files-directory
+                         (gnus-replace-chars-in-string group ?. ?/))))
+           (mdir (length (expand-file-name gnus-kill-files-directory)))
+           (suffixes (list gnus-score-file-suffix gnus-adaptive-file-suffix))
+           files suffix)
+       (while suffixes
+         (setq suffix (car suffixes)
+               suffixes (cdr suffixes))
+         (if (file-exists-p (concat dir "/" suffix))
+             (setq files (list (concat dir "/" suffix))))
+         (while (>= (1+ (length dir)) mdir)
+           (and (file-exists-p (concat dir "/all/" suffix))
+                (setq files (cons (concat dir "/all/" suffix) files)))
+           (string-match "/[^/]*$" dir)
+           (setq dir (substring dir 0 (match-beginning 0)))))
+       (setq gnus-score-file-list 
+             (cons nil (nreverse files)))))
+    (cdr gnus-score-file-list)))
+
+(defun gnus-score-file-regexp ()
+  (concat "\\(" gnus-score-file-suffix 
+         "\\|" gnus-adaptive-file-suffix "\\)$"))
+       
+(defun gnus-score-find-bnews (group)
+  "Return a list of score files for GROUP.
+The score files are those files in the ~/News directory which matches
+GROUP using BNews sys file syntax."
+  (let* ((sfiles (append (gnus-score-score-files group)
+                        gnus-internal-global-score-files))
+        (kill-dir (file-name-as-directory 
+                   (expand-file-name gnus-kill-files-directory)))
+        (klen (length kill-dir))
+        ofiles not-match regexp)
+    (save-excursion
+      (set-buffer (get-buffer-create "*gnus score files*"))
+      (buffer-disable-undo (current-buffer))
+      ;; Go through all score file names and create regexp with them
+      ;; as the source.  
+      (while sfiles
+       (erase-buffer)
+       (insert (car sfiles))
+       (goto-char (point-min))
+       ;; First remove the suffix itself.
+       (re-search-forward (concat "." (gnus-score-file-regexp)))
+       (replace-match "" t t) 
+       (goto-char (point-min))
+       (if (looking-at (regexp-quote kill-dir))
+           ;; If the file name was just "SCORE", `klen' is one character
+           ;; too much.
+           (delete-char (min (1- (point-max)) klen))
+         (goto-char (point-max))
+         (search-backward "/")
+         (delete-region (1+ (point)) (point-min)))
+       ;; Translate "all" to ".*".
+       (while (search-forward "all" nil t)
+         (replace-match ".*" t t))
+       (goto-char (point-min))
+       ;; Deal with "not."s.
+       (if (looking-at "not.")
+           (progn
+             (setq not-match t)
+             (setq regexp (buffer-substring 5 (point-max))))
+         (setq regexp (buffer-substring 1 (point-max)))
+         (setq not-match nil))
+       ;; Finally - if this resulting regexp matches the group name,
+       ;; we add this score file to the list of score files
+       ;; applicable to this group.
+       (if (or (and not-match
+                    (not (string-match regexp group)))
+               (and (not not-match)
+                    (string-match regexp group)))
+           (setq ofiles (cons (car sfiles) ofiles)))
+       (setq sfiles (cdr sfiles)))
+      (kill-buffer (current-buffer))
+      ;; Slight kludge here - the last score file returned should be
+      ;; the local score file, whether it exists or not. This is so
+      ;; that any score commands the user enters will go to the right
+      ;; file, and not end up in some global score file.
+      (let ((localscore
+            (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-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-possibly-score-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)))
+    (if score-files (gnus-score-headers score-files))))
+
+(defun gnus-score-file-name (newsgroup &optional suffix)
+  "Return the name of a score file for NEWSGROUP."
+  (let ((suffix (or suffix gnus-score-file-suffix)))
+    (cond  ((or (null newsgroup)
+               (string-equal newsgroup ""))
+           ;; The global score file is placed at top of the directory.
+           (expand-file-name 
+            suffix (or gnus-kill-files-directory "~/News")))
+          ((gnus-use-long-file-name 'not-score)
+           ;; Append ".SCORE" to newsgroup name.
+           (expand-file-name (concat newsgroup "." suffix)
+                             (or gnus-kill-files-directory "~/News")))
+          (t
+           ;; Place "SCORE" under the hierarchical directory.
+           (expand-file-name (concat (gnus-newsgroup-directory-form newsgroup)
+                                     "/" suffix)
+                             (or gnus-kill-files-directory "~/News"))))))
+
+(defun gnus-score-search-global-directories (files)
+  "Scan all global score directories for score files."
+  ;; Set the variable `gnus-internal-global-score-files' to all
+  ;; available global score files.
+  (interactive (list gnus-global-score-files))
+  (let (out)
+    (while files
+      (if (string-match "/$" (car files))
+         (setq out (nconc (directory-files 
+                           (car files) t
+                           (concat (gnus-score-file-regexp) "$"))))
+       (setq out (cons (car files) out)))
+      (setq files (cdr files)))
+    (setq gnus-internal-global-score-files out)))
+
 (provide 'gnus-score)
 
 ;;; gnus-score.el ends here
index 439a2d4..487ce73 100644 (file)
@@ -221,6 +221,12 @@ file without any embellishments. The digesting almost conforms to RFC1153 -
 no easy way to specify any meaningful volume and issue numbers were found, 
 so I simply dropped them.")
 
+(defvar gnus-uu-digest-headers 
+  '("^Date:" "^From:" "^To:" "^Cc:" "^Subject:" "^Message-ID:" "^Keywords:"
+    "^Summary:" "^References:")
+  "*List of regexps to match headers included in digested messages.
+The headers will be included in the sequence they are matched.")
+
 (defvar gnus-uu-save-separate-articles nil
   "*Non-nil means that gnus-uu will save articles in separate files.")
 
@@ -258,6 +264,54 @@ so I simply dropped them.")
 (defconst gnus-uu-highest-article-number 1)
 (defvar gnus-uu-default-dir default-directory)
 
+;; Keymaps
+
+(defvar gnus-uu-extract-map nil)
+(defvar gnus-uu-extract-view-map nil)
+(defvar gnus-uu-mark-map nil)
+
+  (define-prefix-command 'gnus-uu-mark-map)
+  (define-key gnus-summary-mark-map "p" 'gnus-uu-mark-map)
+  (define-key gnus-uu-mark-map "p" 'gnus-summary-mark-as-processable)
+  (define-key gnus-uu-mark-map "u" 'gnus-summary-unmark-as-processable)
+  (define-key gnus-uu-mark-map "U" 'gnus-summary-unmark-all-processable)
+  (define-key gnus-uu-mark-map "s" 'gnus-uu-mark-series)
+  (define-key gnus-uu-mark-map "r" 'gnus-uu-mark-region)
+  (define-key gnus-uu-mark-map "R" 'gnus-uu-mark-by-regexp)
+  (define-key gnus-uu-mark-map "t" 'gnus-uu-mark-thread)
+  (define-key gnus-uu-mark-map "a" 'gnus-uu-mark-all)
+  (define-key gnus-uu-mark-map "S" 'gnus-uu-mark-sparse)
+
+  (define-prefix-command 'gnus-uu-extract-map)
+  (define-key gnus-summary-mode-map "X" 'gnus-uu-extract-map)
+;  (define-key gnus-uu-extract-map "x" 'gnus-uu-extract-any)
+;  (define-key gnus-uu-extract-map "m" 'gnus-uu-extract-mime)
+  (define-key gnus-uu-extract-map "u" 'gnus-uu-decode-uu)
+  (define-key gnus-uu-extract-map "U" 'gnus-uu-decode-uu-and-save)
+  (define-key gnus-uu-extract-map "s" 'gnus-uu-decode-unshar)
+  (define-key gnus-uu-extract-map "S" 'gnus-uu-decode-unshar-and-save)
+  (define-key gnus-uu-extract-map "o" 'gnus-uu-decode-save)
+  (define-key gnus-uu-extract-map "O" 'gnus-uu-decode-save)
+  (define-key gnus-uu-extract-map "b" 'gnus-uu-decode-binhex)
+  (define-key gnus-uu-extract-map "B" 'gnus-uu-decode-binhex)
+  (define-key gnus-uu-extract-map "p" 'gnus-uu-decode-postscript)
+  (define-key gnus-uu-extract-map "P" 'gnus-uu-decode-postscript-and-save)
+
+  (define-prefix-command 'gnus-uu-extract-view-map)
+  (define-key gnus-uu-extract-map "v" 'gnus-uu-extract-view-map)
+  (define-key gnus-uu-extract-view-map "u" 'gnus-uu-decode-uu-view)
+  (define-key gnus-uu-extract-view-map "U" 'gnus-uu-decode-uu-and-save-view)
+  (define-key gnus-uu-extract-view-map "s" 'gnus-uu-decode-unshar-view)
+  (define-key gnus-uu-extract-view-map "S" 'gnus-uu-decode-unshar-and-save-view)
+  (define-key gnus-uu-extract-view-map "o" 'gnus-uu-decode-save-view)
+  (define-key gnus-uu-extract-view-map "O" 'gnus-uu-decode-save-view)
+  (define-key gnus-uu-extract-view-map "b" 'gnus-uu-decode-binhex-view)
+  (define-key gnus-uu-extract-view-map "B" 'gnus-uu-decode-binhex-view)
+  (define-key gnus-uu-extract-view-map "p" 'gnus-uu-decode-postscript-view)
+  (define-key gnus-uu-extract-view-map "P" 'gnus-uu-decode-postscript-and-save-view)
+  
+
+
 ;; Commands.
 
 (defun gnus-uu-decode-uu (n)
@@ -368,8 +422,8 @@ so I simply dropped them.")
   (gnus-uu-initialize)
   (let ((gnus-uu-save-in-digest t)
        (file (concat gnus-uu-work-dir (make-temp-name "forward")))
+       (winconf (current-window-configuration))
        buf)
-    (setq gnus-winconf-post-news (current-window-configuration))
     (gnus-uu-decode-save n file)
     (gnus-uu-add-file file)
     (setq buf (switch-to-buffer (get-buffer-create " *gnus-uu-forward*")))
@@ -595,17 +649,16 @@ so I simply dropped them.")
         (save-excursion
           (save-restriction
             (set-buffer buffer)
-            (goto-char 1)
+            (goto-char (point-min))
             (re-search-forward "\n\n")
             (setq body (buffer-substring (1- (point)) (point-max)))
             (narrow-to-region 1 (point))
-            (setq headers (list "Date:" "From:" "To:" "Cc:" "Subject:"
-                                "Message-ID:" "Keywords:" "Summary:"))
+            (setq headers gnus-uu-digest-headers)
             (while headers
               (setq headline (car headers))
               (setq headers (cdr headers))
-              (goto-char 1)
-              (if (re-search-forward (concat "^" headline ".*$") nil t)
+              (goto-char (point-min))
+              (if (re-search-forward (concat headline ".*$") nil t)
                   (setq sorthead 
                         (concat sorthead (buffer-substring 
                                           (match-beginning 0)
@@ -658,7 +711,7 @@ so I simply dropped them.")
     (save-excursion
       (set-buffer buffer)
       (widen)
-      (goto-char 1)
+      (goto-char (point-min))
       (if (not (re-search-forward gnus-uu-binhex-begin-line nil t))
          (if (not (re-search-forward gnus-uu-binhex-body-line nil t))
              (setq state (list 'wrong-type))))
@@ -694,7 +747,7 @@ so I simply dropped them.")
        start-char end-char file-name)
     (save-excursion
      (set-buffer process-buffer)
-     (goto-char 1)
+     (goto-char (point-min))
      (if (not (re-search-forward gnus-uu-postscript-begin-string nil t))
         (setq state (list 'wrong-type))
        (beginning-of-line)
@@ -769,7 +822,7 @@ so I simply dropped them.")
       (setq beg 1)
 
       (setq case-fold-search nil)
-      (goto-char 1)
+      (goto-char (point-min))
       (if (looking-at vernum)
          (progn
            (replace-match vernum t t)
@@ -878,16 +931,16 @@ so I simply dropped them.")
        (erase-buffer)
        (insert (car (car string-list)))
        ;; Translate multiple spaces to one space.
-       (goto-char 1)
+       (goto-char (point-min))
        (while (re-search-forward "[ \t]+" nil t)
          (replace-match " "))
        ;; Translate all characters to "a".
-       (goto-char 1)
+       (goto-char (point-min))
        (if translate 
            (while (re-search-forward "[A-Za-z]" nil t)
              (replace-match "a" t t)))
        ;; Expand numbers.
-       (goto-char 1)
+       (goto-char (point-min))
        (while (re-search-forward "[0-9]+" nil t)
          (replace-match  
           (format "%06d" 
@@ -1055,7 +1108,7 @@ so I simply dropped them.")
            (widen)
            (erase-buffer)
            (insert-buffer-substring article-buffer)
-           (goto-char 1))))
+           (goto-char (point-min)))))
 
     (if result-files
        ()
@@ -1092,13 +1145,13 @@ so I simply dropped them.")
       (let ((case-fold-search nil)
            (buffer-read-only nil))
 
-       (goto-char 1)
+       (goto-char (point-min))
 
        (if gnus-uu-kill-carriage-return
            (progn
              (while (search-forward "\r" nil t)
                (delete-backward-char 1))
-             (goto-char 1)))
+             (goto-char (point-min))))
 
        (if (not (re-search-forward gnus-uu-begin-string nil t))
            (if (not (re-search-forward gnus-uu-body-line nil t))
@@ -1199,7 +1252,7 @@ so I simply dropped them.")
        start-char)
     (save-excursion
      (set-buffer process-buffer)
-     (goto-char 1)
+     (goto-char (point-min))
      (if (not (re-search-forward gnus-uu-shar-begin-string nil t))
         (setq state (list 'wrong-type))
        (beginning-of-line)
@@ -1214,7 +1267,7 @@ so I simply dropped them.")
 (defun gnus-uu-find-name-in-shar ()
   (let ((oldpoint (point))
        res)
-    (goto-char 1)
+    (goto-char (point-min))
     (if (re-search-forward gnus-uu-shar-name-marker nil t)
        (setq res (buffer-substring (match-beginning 1) (match-end 1))))
     (goto-char oldpoint)
@@ -1392,6 +1445,7 @@ so I simply dropped them.")
   (gnus-uu-add-file gnus-uu-work-dir)
   (if (not (file-directory-p gnus-uu-work-dir)) 
       (make-directory gnus-uu-work-dir))
+  (set-file-modes gnus-uu-work-dir 448)
   (setq gnus-uu-work-dir (concat gnus-uu-work-dir "/")))
 
 ;; Kills the temporary uu buffers, kills any processes, etc.
@@ -1539,7 +1593,7 @@ The user will be asked for a file name."
 (defun gnus-uu-post-encode-uuencode (path file-name)
   (if (gnus-uu-post-encode-file "uuencode" path file-name)
       (progn
-       (goto-char 1)
+       (goto-char (point-min))
        (forward-line 1)
        (while (re-search-forward " " nil t)
          (replace-match "`"))
@@ -1561,16 +1615,15 @@ The user will be asked for a file name."
 
 ;; Adds MIME headers.
 (defun gnus-uu-post-make-mime (file-name encoding)
-  (goto-char 1)
+  (goto-char (point-min))
   (insert (format "Content-Type: %s; name=\"%s\"\n" 
                  (gnus-uu-choose-action file-name gnus-uu-ext-to-mime-list) 
                  file-name))
   (insert (format "Content-Transfer-Encoding: %s\n\n" encoding))
   (save-restriction
     (set-buffer gnus-post-news-buffer)
-    (goto-char 1)
-    (re-search-forward (regexp-quote mail-header-separator))
-    (beginning-of-line)
+    (goto-char (point-min))
+    (re-search-forward (concat "^" (regexp-quote mail-header-separator) "$"))
     (forward-line -1)
     (narrow-to-region 1 (point))
     (or (mail-fetch-field "mime-version")
@@ -1612,7 +1665,7 @@ If no file has been included, the user will be asked for a file."
                (cons
                 '(lambda ()
                    (save-excursion
-                     (goto-char 1)
+                     (goto-char (point-min))
                      (if (re-search-forward "^Message-ID: \\(.*\\)$" nil t)
                          (setq gnus-uu-post-message-id 
                                (buffer-substring 
@@ -1667,10 +1720,11 @@ If no file has been included, the user will be asked for a file."
 
     (setq post-buf (current-buffer))
 
-    (goto-char 1)
+    (goto-char (point-min))
     (if (not (re-search-forward 
              (if gnus-uu-post-separate-description 
-                 gnus-uu-post-binary-separator 
+                 (concat "^" (regexp-quote gnus-uu-post-binary-separator)
+                         "$")
                (concat "^" (regexp-quote mail-header-separator) "$")) nil t))
        (error "Internal error: No binary/header separator"))
     (beginning-of-line)
@@ -1682,7 +1736,7 @@ If no file has been included, the user will be asked for a file."
       (set-buffer (setq uubuf (get-buffer-create encoded-buffer-name)))
       (erase-buffer)
       (insert-buffer-substring post-buf beg-binary end-binary)
-      (goto-char 1)
+      (goto-char (point-min))
       (setq length (count-lines 1 (point-max)))
       (setq parts (/ length gnus-uu-post-length))
       (if (not (< (% length gnus-uu-post-length) 4))
@@ -1692,13 +1746,13 @@ If no file has been included, the user will be asked for a file."
        (forward-line -1))
     (kill-region (point) (point-max))
 
-    (goto-char 1)
+    (goto-char (point-min))
     (re-search-forward 
      (concat "^" (regexp-quote mail-header-separator) "$") nil t)
     (beginning-of-line)
     (setq header (buffer-substring 1 (point)))
 
-    (goto-char 1)
+    (goto-char (point-min))
     (if (not gnus-uu-post-separate-description)
        ()
       (if (and (not threaded) (re-search-forward "^Subject: " nil t))
@@ -1729,7 +1783,7 @@ If no file has been included, the user will be asked for a file."
                 (make-string 
                  (if (= 0 (% whole-len 2)) (1- minlen) minlen) ?-)))
 
-       (goto-char 1)
+       (goto-char (point-min))
        (if (not (re-search-forward "^Subject: " nil t))
            ()
          (if (not threaded)
@@ -1755,12 +1809,14 @@ If no file has been included, the user will be asked for a file."
        (insert "\n")
        (setq beg end)
        (setq i (1+ i))
-       (goto-char 1)
+       (goto-char (point-min))
        (re-search-forward
         (concat "^" (regexp-quote mail-header-separator) "$") nil t)
        (beginning-of-line)
        (forward-line 2)
-       (if (re-search-forward gnus-uu-post-binary-separator nil t)
+       (if (re-search-forward 
+            (concat "^" (regexp-quote gnus-uu-post-binary-separator) "$")
+            nil t)
            (progn 
              (replace-match "")
              (forward-line 1)))
index d8534c4..c4d6954 100644 (file)
@@ -1,7 +1,8 @@
-;;; gnus-visual: display-oriented parts of Gnus.
+;;; gnus-vis --- display-oriented parts of Gnus
 ;; Copyright (C) 1995 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@ifi.uio.no>
+;;     Per Abrahamsen <abraham@iesd.auc.dk>
 ;; Keywords: news
 
 ;; This file is part of GNU Emacs.
 ;;; Code:
 
 (require 'gnus)
-(require (if gnus-xemacs 'auc-menu 'easymenu))
+(require gnus-easymenu)
+
+;;; summary highligts
 
 (defvar gnus-summary-selected-face 'underline
   "*Face used for highlighting the current article in the summary buffer.")
 
-(defvar gnus-visual-summary-highlight
+(defvar gnus-summary-highlight
   '(((> score default) . bold)
     ((< score default) . italic))
   "*Alist of `(FORM . FACE)'.
@@ -49,12 +52,81 @@ To check for marks, e.g. to underline replied articles, use
 
    ((= (gnus-summary-article-mark) gnus-replied-mark) . underline)")
 
+;;; article highlights
+
+(defvar gnus-make-foreground t
+  "Non nil means foreground color to highlight citations.")
+
+(defvar gnus-article-button-face 'bold
+  "Face used for text buttons.")
+
+(defvar gnus-article-mouse-face (if (boundp 'gnus-mouse-face)
+                                   gnus-mouse-face
+                                 'highlight)
+  "Face used when the mouse is over the button.")
+
+(defvar gnus-header-face-alist '(("" bold italic))
+  "Alist of headers and faces used for highlighting them.
+The entries in the list has the form `(REGEXP NAME CONTENT)', where
+REGEXP is a regeular expression matching the beginning of the header,
+NAME is the face used for highlighting the header name and CONTENT is
+the face used for highlighting the header content. 
+
+The first non-nil NAME or CONTENT with a matching REGEXP in the list
+will be used.") 
+
+(defvar gnus-signature-face 'italic
+  "Face used for signature.")
+
+(defvar gnus-button-alist 
+  '(("in\\( +article\\)? +\\(<\\([^\n @<>]+@[^\n @<>]+\\)>\\)" 2 
+     (assq (count-lines (point-min) (match-end 0)) 
+          gnus-cite-attribution-alist)
+     gnus-button-message-id 3)
+    ;; This is how URLs _should_ be embedded in text...
+    ("<URL:\\([^\n\r>]*\\)>" 0 t gnus-button-url 1)
+    ;; Next regexp stolen from highlight-headers.el
+    ("\\b\\(s?https?\\|ftp\\|file\\|gopher\\|news\\|telnet\\):\\(//[-a-zA-Z0-9_.]+:[0-9]*\\)?[-a-zA-Z0-9_=?#$@~`%&*+|\\/.,]+" 0 t
+     gnus-button-url 0))
+  "Alist of regexps matching buttons in an article.
+
+Each entry has the form (REGEXP BUTTON FORM CALLBACK PAR...), where
+REGEXP: is the string matching text around the button,
+BUTTON: is the number of the regexp grouping actually matching the button,
+FORM: is a lisp expression which must eval to true for the button to
+be added, 
+CALLBACK: is the function to call when the user push this button, and each
+PAR: is a number of a regexp grouping whose text will be passed to CALLBACK.
+
+CALLBACK can also be a variable, in that case the value of that
+variable it the real callback function.")
+
+(defvar gnus-button-url (cond ((fboundp 'w3-fetch)
+                              'w3-fetch)
+                             ((fboundp 'highlight-headers-follow-url-netscape)
+                              'highlight-headers-follow-url-netscape)
+                             (t nil))
+  "Function to fetch URL.  
+The function will be called with one argument, the URL to fetch.
+Useful values of this function are:
+
+w3-fetch: 
+   defined in the w3 emacs package by William M. Perry.
+highlight-headers-follow-url-netscape: 
+   from `highlight-headers.el' for loading NetScape 1.1.")
+
+\f
+
 (eval-and-compile
-  (autoload 'nnkiboze-generate-groups "nnkiboze"))
+  (autoload 'nnkiboze-generate-groups "nnkiboze")
+  (autoload 'gnus-cite-parse-maybe "gnus-cite" nil t))
+
+;;;
+;;; gnus-menu
+;;;
 
 ;; Newsgroup buffer
 
-;; Make a menu bar item.
 (defun gnus-group-make-menu-bar ()
   (easy-menu-define
    gnus-group-reading-menu
@@ -91,6 +163,10 @@ To check for marks, e.g. to underline replied articles, use
       ["Group apropos" gnus-group-apropos t]
       ["Group and description apropos" gnus-group-description-apropos t]
       ["List groups matching..." gnus-group-list-matching t])
+     ("Mark"
+      ["Mark group" gnus-group-mark-group t]
+      ["Unmark group" gnus-group-unmark-group t]
+      ["Mark region" gnus-group-mark-region t])
      ("Subscribe"
       ["Subscribe to random group" gnus-group-unsubscribe-group t]
       ["Kill all newsgroups in region" gnus-group-kill-region t]
@@ -127,6 +203,7 @@ To check for marks, e.g. to underline replied articles, use
      ["Restart Gnus" gnus-group-restart t]
      ["Read init file" gnus-group-read-init-file t]
      ["Browse foreign server" gnus-group-browse-foreign-server t]
+     ["Enter server buffer" gnus-group-enter-server-mode t]
      ["Edit the global kill file" gnus-group-edit-global-kill t]
      ["Expire all expirable articles" gnus-group-expire-all-groups t]
      ["Generate any kiboze groups" nnkiboze-generate-groups t]
@@ -142,6 +219,34 @@ To check for marks, e.g. to underline replied articles, use
 
   )
 
+;; Server mode
+(defun gnus-server-make-menu-bar ()
+  (easy-menu-define
+   gnus-server-menu
+   gnus-server-mode-map
+   ""
+   '("Server"
+     ["Add" gnus-server-add-server t]
+     ["Browse" gnus-server-read-server t]
+     ["List" gnus-server-list-servers t]
+     ["Kill" gnus-server-kill-server t]
+     ["Yank" gnus-server-yank-server t]
+     ["Copy" gnus-server-copy-server t]
+     ["Edit" gnus-server-edit-server t]
+     ["Exit" gnus-server-exit t]
+     )))
+
+;; Browse mode
+(defun gnus-browse-make-menu-bar ()
+  (easy-menu-define
+   gnus-browse-menu
+   gnus-browse-mode-map
+   ""
+   '("Browse"
+     ["Subscribe" gnus-browse-unsubscribe-current-group t]
+     ["Exit" gnus-browse-exit t]
+     )))
+
 ;; Summary buffer
 (defun gnus-summary-make-menu-bar ()
 
@@ -249,6 +354,7 @@ To check for marks, e.g. to underline replied articles, use
      ("Mail articles"
       ["Respool article" gnus-summary-respool-article t]
       ["Move article" gnus-summary-move-article t]
+      ["Copy article" gnus-summary-copy-article t]
       ["Edit article" gnus-summary-edit-article t]
       ["Delete article" gnus-summary-delete-article t])
      ))
@@ -279,7 +385,8 @@ To check for marks, e.g. to underline replied articles, use
       ["Sort by number" gnus-summary-sort-by-number t]
       ["Sort by author" gnus-summary-sort-by-author t]
       ["Sort by subject" gnus-summary-sort-by-subject t]
-      ["Sort by date" gnus-summary-sort-by-date t])
+      ["Sort by date" gnus-summary-sort-by-date t]
+      ["Sort by score" gnus-summary-sort-by-score t])
      ("Exit"
       ["Catchup and exit" gnus-summary-catchup-and-exit t]
       ["Catchup and goto next" gnus-summary-catchup-and-goto-next-group t]
@@ -337,6 +444,8 @@ To check for marks, e.g. to underline replied articles, use
       gnus-summary-temporarily-raise-by-thread t]
      ["Raise score with current crossposting" 
       gnus-summary-temporarily-raise-by-xref t]
+     ["Raise score for followups to current author"
+      gnus-summary-temporarily-raise-followups-to-author t]
      ["Permanently raise score with current subject"
       gnus-summary-raise-by-subject t]
      ["Permanently raise score with current author" 
@@ -353,6 +462,8 @@ To check for marks, e.g. to underline replied articles, use
       gnus-summary-temporarily-lower-by-thread t]
      ["Lower score with current crossposting" 
       gnus-summary-temporarily-lower-by-xref t]
+     ["Lower score for followups to current author"
+      gnus-summary-temporarily-lower-followups-to-author t]
      ["Permanently lower score with current subject"
       gnus-summary-lower-by-subject t]
      ["Permanently lower score with current author" 
@@ -395,35 +506,21 @@ To check for marks, e.g. to underline replied articles, use
      ))
  )
 
-(if gnus-xemacs
-    (defun gnus-visual-highlight-selected-summary ()
-      (if gnus-summary-selected-face
-         (save-excursion
-           (let* ((beg (progn (beginning-of-line) (point)))
-                  (end (progn (end-of-line) (point)))
-                  (from (or
-                         (next-single-property-change beg 'mouse-face nil end)
-                         beg))
-                  (to (or (next-single-property-change from 'mouse-face nil end)
-                          end)))
-             (if gnus-newsgroup-selected-overlay
-                 (move-overlay gnus-newsgroup-selected-overlay 
-                               from to (current-buffer))
-               (setq gnus-newsgroup-selected-overlay (make-overlay from to))
-               (overlay-put gnus-newsgroup-selected-overlay 'face 
-                            gnus-summary-selected-face))))))
-
-(defun gnus-visual-highlight-selected-summary ()
+;;;
+;;; summary highlights
+;;;
+
+(defun gnus-highlight-selected-summary ()
     ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
     ;; Highlight selected article in summary buffer
     (if gnus-summary-selected-face
        (save-excursion
          (let* ((beg (progn (beginning-of-line) (point)))
                 (end (progn (end-of-line) (point)))
-                (to (max 1 (1- (previous-single-property-change
-                                end 'mouse-face nil beg))))
-                (from (1+ (next-single-property-change 
-                           beg 'mouse-face nil end))))
+                (to (max 1 (1- (or (previous-single-property-change
+                                    end 'mouse-face nil beg) end))))
+                (from (1+ (or (next-single-property-change 
+                               beg 'mouse-face nil end) beg))))
            (if (< to beg)
                (progn
                  (setq from beg)
@@ -434,13 +531,12 @@ To check for marks, e.g. to underline replied articles, use
              (setq gnus-newsgroup-selected-overlay (make-overlay from to))
              (overlay-put gnus-newsgroup-selected-overlay 'face 
                           gnus-summary-selected-face))))))
-)
 
 
 ;; New implementation by Christian Limpach <Christian.Limpach@nice.ch>.
-(defun gnus-visual-summary-highlight-line ()
-  "Highlight current line according to `gnus-visual-summary-highlight'."
-  (let* ((list gnus-visual-summary-highlight)
+(defun gnus-summary-highlight-line ()
+  "Highlight current line according to `gnus-summary-highlight'."
+  (let* ((list gnus-summary-highlight)
         (p (point))
         (end (progn (end-of-line) (point)))
         ;; now find out where the line starts and leave point there.
@@ -450,52 +546,449 @@ To check for marks, e.g. to underline replied articles, use
                               gnus-newsgroup-scored))
                    gnus-summary-default-score 0))
         (default gnus-summary-default-score)
-        (mark (get-text-property beg 'gnus-mark))
+        (mark (car (cdr (get-text-property beg 'gnus))))
         (inhibit-read-only t))
     (while (and list (not (eval (car (car list)))))
       (setq list (cdr list)))
     (let ((face (and list (cdr (car list)))))
       ;; BUG! For some reason the text properties of the first
       ;; characters get mangled.
-      (or (eq face (get-text-property (+ beg 10) 'face))
+      (or (eobp)
+         (eq face (get-text-property beg 'face))
          (put-text-property beg end 'face face)))
     (goto-char p)))
 
-(defvar mode-motion-hook nil)
-(defun gnus-install-mouse-tracker ()
-  (require 'mode-motion)
-  (setq mode-motion-hook 'mode-motion-highlight-line))
-
-(if (not gnus-xemacs)
-    ()
-  (setq gnus-group-mode-hook
-       (cons
-        (lambda ()
-          (easy-menu-add gnus-group-reading-menu)
-          (easy-menu-add gnus-group-group-menu)
-          (easy-menu-add gnus-group-post-menu)
-          (easy-menu-add gnus-group-misc-menu)
-           (gnus-install-mouse-tracker)) 
-        gnus-group-mode-hook))
-  (setq gnus-summary-mode-hook
-       (cons
-        (lambda ()
-          (easy-menu-add gnus-summary-mark-menu)
-          (easy-menu-add gnus-summary-move-menu)
-          (easy-menu-add gnus-summary-article-menu)
-          (easy-menu-add gnus-summary-thread-menu)
-          (easy-menu-add gnus-summary-misc-menu)
-          (easy-menu-add gnus-summary-post-menu)
-          (easy-menu-add gnus-summary-kill-menu)
-           (gnus-install-mouse-tracker)) 
-        gnus-summary-mode-hook))
-  (setq gnus-article-mode-hook
-       (cons
-        (lambda ()
-          (easy-menu-add gnus-article-article-menu)
-          (easy-menu-add gnus-article-treatment-menu)) 
-        gnus-article-mode-hook)))
+;;;
+;;; gnus-carpal
+;;;
+
+(defvar gnus-carpal-group-buffer-buttons
+  '(("next" . gnus-group-next-unread-group)
+    ("prev" . gnus-group-prev-unread-group)
+    ("read" . gnus-group-read-group)
+    ("select" . gnus-group-select-group)
+    ("catch up" . gnus-group-catchup-current)
+    ("new news" . gnus-group-get-new-news-this-group)
+    ("toggle sub" . gnus-group-unsubscribe-current-group)
+    ("subscribe" . gnus-group-unsubscribe-group)
+    ("kill" . gnus-group-kill-group)
+    ("yank" . gnus-group-yank-group)
+    ("describe" . gnus-group-describe-group)
+    "list"
+    ("subscribed" . gnus-group-list-groups)
+    ("all" . gnus-group-list-all-groups)
+    ("killed" . gnus-group-list-killed)
+    ("zombies" . gnus-group-list-zombies)
+    ("matching" . gnus-group-list-matching)
+    ("post" . gnus-group-post-news)
+    ("mail" . gnus-group-mail)
+    ("new news" . gnus-group-get-new-news)
+    ("browse foreign" . gnus-group-browse-foreign)
+    ("exit" . gnus-group-exit)))
+
+(defvar gnus-carpal-summary-buffer-buttons
+  '("mark" 
+    ("read" . gnus-summary-mark-as-read-forward)
+    ("tick" . gnus-summary-tick-article-forward)
+    ("clear" . gnus-summary-clear-mark-forward)
+    ("expirable" . gnus-summary-mark-as-expirable)
+    "move"
+    ("scroll" . gnus-summary-next-page)
+    ("next unread" . gnus-summary-next-unread-article)
+    ("prev unread" . gnus-summary-prev-unread-article)
+    ("first" . gnus-summary-first-unread-article)
+    ("best" . gnus-summary-best-unread-article)
+    "article"
+    ("headers" . gnus-summary-toggle-header)
+    ("uudecode" . gnus-uu-decode-uu)
+    ("enter digest" . gnus-summary-enter-digest-group)
+    ("fetch parent" . gnus-summary-refer-parent-article)
+    "mail"
+    ("move" . gnus-summary-move-article)
+    "threads"
+    ("lower" . gnus-summary-lower-thread)
+    ("kill" . gnus-summary-kill-thread)
+    "post"
+    ("post" . gnus-summary-post-news)
+    ("mail" . gnus-summary-mail)
+    ("followup" . gnus-summary-followup-with-original)
+    ("reply" . gnus-summary-reply-with-original)
+    ("cancel" . gnus-summary-cancel-article)
+    "misc"
+    ("exit" . gnus-summary-exit)
+    ("fed up" . gnus-summary-catchup-and-goto-next)))
+
+(defvar gnus-carpal-server-buffer-buttons 
+  '(("add" . gnus-server-add-server)
+    ("browse" . gnus-server-browse-server)
+    ("list" . gnus-server-list-servers)
+    ("kill" . gnus-server-kill-server)
+    ("yank" . gnus-server-yank-server)
+    ("copy" . gnus-server-copy-server)
+    ("exit" . gnus-server-exit)))
+
+(defvar gnus-carpal-browse-buffer-buttons
+  '(("subscribe" . gnus-browse-unsubscribe-current-group)
+    ("exit" . gnus-browse-exit)))
+
+(defvar gnus-carpal-group-buffer "*Carpal Group*")
+(defvar gnus-carpal-summary-buffer "*Carpal Summary*")
+(defvar gnus-carpal-server-buffer "*Carpal Server*")
+(defvar gnus-carpal-browse-buffer "*Carpal Browse*")
+
+(defvar gnus-carpal-attached-buffer nil)
+
+(defvar gnus-carpal-mode-hook nil
+  "*Hook run in carpal mode buffers.")
+
+(defvar gnus-carpal-button-face 'bold
+  "*Face used on carpal buttons.")
+
+(defvar gnus-carpal-mode-map nil)
+(put 'gnus-carpal-mode 'mode-class 'special)
+
+(if gnus-carpal-mode-map
+    nil
+  (setq gnus-carpal-mode-map (make-keymap))
+  (suppress-keymap gnus-carpal-mode-map)
+  (define-key gnus-carpal-mode-map " " 'gnus-carpal-select)
+  (define-key gnus-carpal-mode-map "\r" 'gnus-carpal-select)
+  (define-key gnus-carpal-mode-map [mouse-2] 'gnus-carpal-mouse-select))
+
+(defun gnus-carpal-mode ()
+  "Major mode clicking buttons.
+
+All normal editing commands are switched off.
+\\<gnus-carpal-mode-map>
+The following commands are available:
+
+\\{gnus-carpal-mode-map}"
+  (interactive)
+  (kill-all-local-variables)
+  (setq mode-line-modified "-- ")
+  (setq major-mode 'gnus-carpal-mode)
+  (setq mode-name "Gnus Carpal")
+  (setq mode-line-process nil)
+  (use-local-map gnus-carpal-mode-map)
+  (buffer-disable-undo (current-buffer))
+  (setq buffer-read-only t)
+  (make-local-variable 'gnus-carpal-attached-buffer)
+  (run-hooks 'gnus-carpal-mode-hook))
+
+(defun gnus-carpal-setup-buffer (type)
+  (let ((buffer (symbol-value (intern (format "gnus-carpal-%s-buffer" type)))))
+    (if (get-buffer buffer)
+       ()
+      (save-excursion
+       (set-buffer (get-buffer-create buffer))
+       (gnus-carpal-mode)
+       (setq gnus-carpal-attached-buffer 
+             (intern (format "gnus-%s-buffer" type)))
+       (gnus-add-current-to-buffer-list)
+       (let ((buttons (symbol-value 
+                       (intern (format "gnus-carpal-%s-buffer-buttons"
+                                       type))))
+             (buffer-read-only nil)
+             button)
+         (while buttons
+           (setq button (car buttons)
+                 buttons (cdr buttons))
+           (if (stringp button)
+               (insert button " ")
+             (set-text-properties
+              (point)
+              (progn (insert (car button)) (point))
+              (list 'gnus-callback (cdr button)
+                    'face gnus-carpal-button-face
+                    'mouse-face 'highlight))
+             (insert " ")))
+         (let ((fill-column (- (window-width) 2)))
+           (fill-region (point-min) (point-max)))
+         (set-window-point (get-buffer-window (current-buffer)) 
+                           (point-min)))))))
+
+(defun gnus-carpal-select ()
+  "Select the button under point."
+  (interactive)
+  (let ((func (get-text-property (point) 'gnus-callback)))
+    (if (null func)
+       ()
+      (pop-to-buffer (symbol-value gnus-carpal-attached-buffer))
+      (call-interactively func))))
+
+(defun gnus-carpal-mouse-select (event)
+  "Select the button under the mouse pointer."
+  (interactive "e")
+  (mouse-set-point event)
+  (gnus-carpal-select))
+
+;;; 
+;;; article highlights
+;;;
+
+;; Written by Per Abrahamsen <abraham@iesd.auc.dk>.
+
+;;; Internal Variables:
+
+(defvar gnus-button-regexp nil)
+;; Regexp matching any of the regexps from `gnus-button-alist'.
+
+(defvar gnus-button-last nil)
+;; The value of `gnus-button-alist' when `gnus-button-regexp' was build.
+
+;;; Commands:
+
+(defun gnus-article-push-button (event)
+  "Check text under the mouse pointer for a callback function.
+If the text under the mouse pointer has a `gnus-callback' property,
+call it with the value of the `gnus-data' text property."
+  (interactive "e")
+  (set-buffer (window-buffer (posn-window (event-start event))))
+  (let* ((pos (posn-point (event-start event)))
+         (data (get-text-property pos 'gnus-data))
+        (fun (get-text-property pos 'gnus-callback)))
+      (if fun (funcall fun data))))
+
+(defun gnus-article-press-button ()
+  "Check text at point for a callback function.
+If the text at point has a `gnus-callback' property,
+call it with the value of the `gnus-data' text property."
+  (interactive)
+  (let* ((data (get-text-property (point) 'gnus-data))
+        (fun (get-text-property (point) 'gnus-callback)))
+      (if fun (funcall fun data))))
+
+;; Suggested by Arne Elofsson <arne@hodgkin.mbi.ucla.edu>
+(defun gnus-article-next-button ()
+  "Move point to next button."
+  (interactive)
+  (if (get-text-property (point) 'gnus-callback)
+      (goto-char (next-single-property-change (point) 'gnus-callback
+                                      nil (point-max))))
+  (let ((pos (next-single-property-change (point) 'gnus-callback)))
+    (if pos
+       (goto-char pos)
+      (setq pos (next-single-property-change (point-min) 'gnus-callback))
+      (if pos
+         (goto-char pos)
+       (error "No buttons found")))))
+
+(defun gnus-article-highlight ()
+  "Highlight current article.
+This function calls `gnus-article-highlight-headers',
+`gnus-article-highlight-citation', 
+`gnus-article-highlight-signature', and `gnus-article-add-buttons' to
+do the highlighting.  See the documentation for those functions."
+  (interactive)
+  (gnus-article-highlight-headers)
+  (gnus-article-highlight-citation)
+  (gnus-article-highlight-signature)
+  (gnus-article-add-buttons))
+
+(defun gnus-article-hide ()
+  "Hide current article.
+This function calls `gnus-article-hide-headers',
+`gnus-article-hide-citation-maybe', and `gnus-article-hide-signature'
+to do the hiding.  See the documentation for those functions." 
+  (interactive)
+  (gnus-article-hide-headers)
+  (gnus-article-hide-citation-maybe)
+  (gnus-article-hide-signature))
+
+(defun gnus-article-highlight-headers ()
+  "Highlight article headers as specified by `gnus-header-face-alist'."
+  (interactive)
+  (save-excursion
+    (set-buffer gnus-article-buffer)
+    (goto-char (point-min))
+    (search-forward "\n\n")
+    (beginning-of-line 0)
+    (while (not (bobp))
+      (let ((alist gnus-header-face-alist)
+           (buffer-read-only nil)
+           (case-fold-search t)
+           (end (point))
+           (inhibit-point-motion-hooks t)
+           begin entry regexp header-face field-face header-found field-found)
+       (re-search-backward "^[^ \t]" nil t)
+       (setq begin (point))
+       (while alist
+         (setq entry (car alist)
+               regexp (nth 0 entry)
+               header-face (nth 1 entry)
+               field-face (nth 2 entry)
+               alist (cdr alist))
+         (if (looking-at regexp)
+             (let ((from (point)))
+               (skip-chars-forward "^:\n")
+               (and (not header-found)
+                    header-face
+                    (progn
+                      (put-text-property  from (point) 'face header-face)
+                      (setq header-found t)))
+               (and (not field-found)
+                    field-face
+                    (progn 
+                      (skip-chars-forward ": \t")
+                      (let ((from (point)))
+                        (goto-char end)
+                        (skip-chars-backward " \t")
+                        (put-text-property from (point) 'face field-face)
+                        (setq field-found t))))))
+         (goto-char begin))))))
+
+(defun gnus-article-highlight-signature ()
+  "Highlight the signature in an article.
+It does this by highlighting everything after
+`gnus-signature-separator' using `gnus-signature-face'." 
+  (interactive)
+  (save-excursion
+    (set-buffer gnus-article-buffer)
+    (let ((buffer-read-only nil)
+         (inhibit-point-motion-hooks t))
+      (goto-char (point-max))
+      (and (re-search-backward gnus-signature-separator nil t)
+          gnus-signature-face
+          (let ((start (match-beginning 0))
+                (end (match-end 0)))
+            (gnus-article-add-button start end 'gnus-signature-toggle end)
+            (overlay-put (make-overlay end (point-max))
+                         'face gnus-signature-face))))))
+
+(defun gnus-article-hide-signature ()
+  "Hide the signature in an article.
+It does this by making everything after `gnus-signature-separator' invisible."
+  (interactive)
+  (save-excursion
+    (set-buffer gnus-article-buffer)
+    (let ((buffer-read-only nil))
+      (goto-char (point-max))
+      (and (re-search-backward gnus-signature-separator nil t)
+          gnus-signature-face
+          (add-text-properties (match-end 0) (point-max)
+                               gnus-hidden-properties)))))
+
+(defun gnus-article-add-buttons ()
+  "Find external references in article and make them to buttons.
+
+External references are things like message-ids and URLs, as specified by 
+`gnus-button-alist'."
+  (interactive)
+  (if (eq gnus-button-last gnus-button-alist)
+      ()
+    (setq gnus-button-regexp (mapconcat 'car gnus-button-alist  "\\|")
+         gnus-button-last gnus-button-alist))
+  (save-excursion
+    (set-buffer gnus-article-buffer)
+    (gnus-cite-parse-maybe)
+    (let ((buffer-read-only nil)
+         (inhibit-point-motion-hooks t)
+         (case-fold-search t))
+      (goto-char (point-min))
+      (search-forward "\n\n")
+      (while (re-search-forward gnus-button-regexp nil t)
+       (goto-char (match-beginning 0))
+       (let* ((from (point))
+              (entry (gnus-button-entry))
+              (start (match-beginning (nth 1 entry)))
+              (end (match-end (nth 1 entry)))
+              (form (nth 2 entry))
+              marker)
+         (goto-char (match-end 0))
+         (if (eval form)
+             (gnus-article-add-button start end 'gnus-button-push
+                                      (set-marker (make-marker)
+                                                  from))))))))
+
+;;; External functions:
+
+(defun gnus-article-add-button (from to fun &optional data)
+  "Create a button between FROM and TO with callback FUN and data DATA."
+  (add-text-properties from to
+                      (append (if gnus-article-button-face
+                                  (list 'face gnus-article-button-face))
+                              (if gnus-article-mouse-face
+                                  (list 'mouse-face gnus-article-mouse-face))
+                              (list 'gnus-callback fun)
+                              (if data (list 'gnus-data data)))))
+
+;;; Internal functions:
+
+(defun gnus-signature-toggle (end)
+  (save-excursion
+    (set-buffer gnus-article-buffer)
+    (let ((buffer-read-only nil))
+      (if (get-text-property end 'invisible)
+         (remove-text-properties end (point-max) gnus-hidden-properties)
+       (add-text-properties end (point-max) gnus-hidden-properties)))))
+
+(defun gnus-make-face (color)
+  ;; Create entry for face with background COLOR.
+  (let ((name (intern (concat "gnus " color))))
+    (make-face name)
+    (if gnus-make-foreground
+       (set-face-foreground name color)
+      (set-face-background name color))
+    name))
+
+(defun gnus-button-entry ()
+  ;; Return the first entry in `gnus-button-alist' matching this place.
+  (let ((alist gnus-button-alist)
+       (entry nil))
+    (while alist
+      (setq entry (car alist)
+           alist (cdr alist))
+      (if (looking-at (car entry))
+         (setq alist nil)
+       (setq entry nil)))
+    entry))
+
+(defun gnus-button-push (marker)
+  ;; Push button starting at MARKER.
+  (save-excursion
+    (set-buffer gnus-article-buffer)
+    (goto-char marker)
+    (let* ((entry (gnus-button-entry))
+          (inhibit-point-motion-hooks t)
+          (fun (nth 3 entry))
+          (args (mapcar (lambda (group) 
+                          (let ((string (buffer-substring
+                                         (match-beginning group)
+                                         (match-end group))))
+                          (set-text-properties 0 (length string) nil string)
+                          string))
+                        (nthcdr 4 entry))))
+      (cond ((fboundp fun)
+            (apply fun args))
+           ((and (boundp fun)
+                 (fboundp (symbol-value fun)))
+            (apply (symbol-value fun) args))
+           (t
+            (message "You must define `%S' to use this button"
+                     (cons fun args)))))))
+
+(defun gnus-button-message-id (message-id)
+  ;; Push on MESSAGE-ID.
+  (save-excursion
+    (set-buffer gnus-summary-buffer)
+    (gnus-summary-refer-article message-id)))
+
+;;; Compatibility Functions:
+
+(or (fboundp 'rassoc)
+    ;; Introduced in Emacs 19.29.
+    (defun rassoc (elt list)
+      "Return non-nil if ELT is `equal' to the cdr of an element of LIST.
+The value is actually the element of LIST whose cdr is ELT."
+      (let (result)
+       (while list
+         (setq result (car list))
+         (if (equal (cdr result) elt)
+             (setq list nil)
+           (setq result nil
+                 list (cdr list))))
+       result)))
 
 (provide 'gnus-vis)
 
-;;; gnus-visual.el ends here
+;;; gnus-vis.el ends here
diff --git a/lisp/gnus-vm.el b/lisp/gnus-vm.el
new file mode 100644 (file)
index 0000000..f3c55fb
--- /dev/null
@@ -0,0 +1,243 @@
+;;; gnus-vm: vm interface for Gnus
+;; Copyright (C) 1994,95 Free Software Foundation, Inc.
+
+;; Author: Per Persson <pp@solace.mh.se>
+;; Keywords: news, mail
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 2, or (at your option)
+;; any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING.  If not, write to
+;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+
+;;; Commentary:
+
+;; Major contributors: 
+;;     Christian Limpach <Christian.Limpach@nice.ch>
+;; Some code stolen from: 
+;;     Rick Sladkey <jrs@world.std.com>
+
+(eval-when-compile
+  (autoload 'vm-mode "vm")
+  (autoload 'vm-save-message "vm")
+  (autoload 'vm-forward-message "vm")
+  (autoload 'vm-reply "vm")
+  (autoload 'vm-mail "vm"))
+
+(defvar gnus-vm-inhibit-window-system nil
+  "Inhibit loading `win-vm' if using a window-system.
+Has to be set before gnus-vm is loaded.")
+
+(or gnus-vm-inhibit-window-system
+    (condition-case nil
+       (if window-system
+           (require 'win-vm))
+      (error nil)))
+
+(if (not (featurep 'vm))
+    (load "vm"))
+
+(require 'gnus)
+
+(defun gnus-vm-make-folder (&optional buffer)
+  (let ((article (or buffer (current-buffer)))
+       (tmp-folder (generate-new-buffer " *tmp-folder*"))
+       (start (point-min))
+       (end (point-max)))
+    (set-buffer tmp-folder)
+    (insert-buffer-substring article start end)
+    (goto-char (point-min))
+    (if (looking-at "^\\(From [^ ]+ \\).*$")
+       (replace-match (concat "\\1" (current-time-string)))
+      (insert "From " gnus-newsgroup-name " "
+             (current-time-string) "\n"))
+    (while (re-search-forward "\n\nFrom " nil t)
+      (replace-match "\n\n>From "))
+    ;; insert a newline, otherwise the last line gets lost
+    (goto-char (point-max))
+    (insert "\n")
+    (vm-mode)
+    tmp-folder))
+  
+(defun gnus-summary-save-in-vm (&optional folder)
+  (interactive)
+  (let ((default-name
+         (funcall gnus-mail-save-name gnus-newsgroup-name
+                  gnus-current-headers gnus-newsgroup-last-mail)))
+    (or folder
+       (setq folder
+             (read-file-name
+              (concat "Save article in VM folder: (default "
+                      (file-name-nondirectory default-name) ") ")
+              (file-name-directory default-name)
+              default-name)))
+    (setq folder
+         (expand-file-name folder
+                           (and default-name
+                                (file-name-directory default-name))))
+    (gnus-make-directory (file-name-directory folder))
+    (set-buffer gnus-article-buffer)
+    (save-excursion
+      (save-restriction
+       (widen)
+       (let ((vm-folder (gnus-vm-make-folder)))
+         (vm-save-message folder)
+         (kill-buffer vm-folder))))
+    ;; Remember the directory name to save articles.
+    (setq gnus-newsgroup-last-mail folder)))
+  
+(defun gnus-mail-forward-using-vm ()
+  "Forward the current message to another user using vm."
+  (let ((gnus-buffer (current-buffer))
+       (subject (concat "[" gnus-newsgroup-name "] "
+                        (or (gnus-fetch-field "Subject") ""))))
+    (or (featurep 'win-vm)
+       (if gnus-use-full-window
+           (pop-to-buffer gnus-article-buffer)
+         (switch-to-buffer gnus-article-buffer)))
+    (set-buffer gnus-article-buffer)
+    (save-excursion
+      (save-restriction
+       (widen)
+       (let ((vm-folder (gnus-vm-make-folder))
+             (vm-forward-message-hook
+              (append (symbol-value 'vm-forward-message-hook)
+                      '((lambda ()
+                          (save-excursion
+                            (mail-position-on-field "Subject")
+                            (beginning-of-line)
+                            (looking-at "^\\(Subject: \\).*$")
+                            (replace-match (concat "\\1" subject))))))))
+         (vm-forward-message)
+         (gnus-vm-init-reply-buffer gnus-buffer)
+         (kill-buffer vm-folder))))))
+
+(defun gnus-vm-init-reply-buffer (buffer)
+  (make-local-variable 'gnus-summary-buffer)
+  (setq gnus-summary-buffer buffer)
+  (set 'vm-mail-buffer nil)
+  (use-local-map (copy-keymap (current-local-map)))
+  (local-set-key "\C-c\C-y" 'gnus-yank-article))
+  
+(defun gnus-mail-reply-using-vm (&optional yank)
+  "Compose reply mail using vm.
+Optional argument YANK means yank original article.
+The command \\[vm-yank-message] yank the original message into current buffer."
+  (let ((gnus-buffer (current-buffer)))
+    (set-buffer gnus-article-buffer)
+    (save-excursion
+      (save-restriction
+       (widen)
+       (let ((vm-folder (gnus-vm-make-folder gnus-article-buffer)))
+         (vm-reply 1)
+         (gnus-vm-init-reply-buffer gnus-buffer)
+         (setq gnus-buffer (current-buffer))
+         (and yank
+              ;; nil will (magically :-)) yank the current article
+              (gnus-yank-article nil))
+         (kill-buffer vm-folder))))
+    (if (featurep 'win-vm) nil
+      (pop-to-buffer gnus-buffer))))
+
+(defun gnus-mail-other-window-using-vm ()
+  "Compose mail in the other window using VM."
+  (interactive)
+  (let ((gnus-buffer (current-buffer)))
+    (vm-mail)
+    (gnus-vm-init-reply-buffer gnus-buffer)))
+
+(defun gnus-yank-article (article &optional prefix)
+  ;; Based on vm-yank-message by Kyle Jones.
+  "Yank article number N into the current buffer at point.
+When called interactively N is read from the minibuffer.
+
+This command is meant to be used in GNUS created Mail mode buffers;
+the yanked article comes from the newsgroup containing the article
+you are replying to or forwarding.
+
+All article headers are yanked along with the text.  Point is left
+before the inserted text, the mark after.  Any hook functions bound to
+`mail-citation-hook' are run, after inserting the text and setting
+point and mark.
+
+Prefix arg means to ignore `mail-citation-hook', don't set the mark,
+prepend the value of `vm-included-text-prefix' to every yanked line.
+For backwards compatibility, if `mail-citation-hook' is set to nil,
+`mail-yank-hooks' is run instead.  If that is also nil, a default
+action is taken."
+  (interactive
+   (list
+    (let ((result 0)
+         default prompt)
+      (setq default (and gnus-summary-buffer
+                        (save-excursion
+                          (set-buffer gnus-summary-buffer)
+                          (and gnus-current-article
+                               (int-to-string gnus-current-article))))
+           prompt (if default
+                      (format "Yank article number: (default %s) " default)
+                    "Yank article number: "))
+      (while (and (not (stringp result)) (zerop result))
+       (setq result (read-string prompt))
+       (and (string= result "") default (setq result default))
+       (or (string-match "^<.*>$" result)
+           (setq result (string-to-int result))))
+      result)
+    current-prefix-arg))
+  (if gnus-summary-buffer
+      (save-excursion
+       (let ((message (current-buffer))
+             (start (point)) end
+             (tmp (generate-new-buffer " *tmp-yank*")))
+         (set-buffer gnus-summary-buffer)
+         ;; Make sure the connection to the server is alive.
+         (or (gnus-server-opened (gnus-find-method-for-group
+                                  gnus-newsgroup-name))
+             (progn
+               (gnus-check-news-server 
+                (gnus-find-method-for-group gnus-newsgroup-name))
+               (gnus-request-group gnus-newsgroup-name t)))
+         (and (stringp article) 
+              (let ((gnus-override-method gnus-refer-article-method))
+                (gnus-read-header article)))
+         (gnus-request-article (or article
+                                   gnus-current-article)
+                               gnus-newsgroup-name tmp)
+         (set-buffer tmp)
+         (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))
+         (append-to-buffer message (point-min) (point-max))
+         (kill-buffer tmp)
+         (set-buffer message)
+         (setq end (point))
+         (goto-char start)
+         (if (or prefix
+                 (not (or mail-citation-hook mail-yank-hooks)))
+             (save-excursion
+               (while (< (point) end)
+                 (insert (symbol-value 'vm-included-text-prefix))
+                 (forward-line 1)))
+           (push-mark end)
+           (cond
+            (mail-citation-hook (run-hooks 'mail-citation-hook))
+            (mail-yank-hooks (run-hooks 'mail-yank-hooks))))))))
+
+(provide 'gnus-vm)
+
+;;; gnus-vm.el ends here.
index dcc816f..3c7cfaf 100644 (file)
@@ -36,6 +36,7 @@
 (require 'mail-utils)
 (require 'timezone)
 (require 'nnheader)
+(require 'gnus-ems)
 
 ;; Site dependent variables. These variables should be defined in
 ;; paths.el.
@@ -252,6 +253,12 @@ value.")
 (defvar gnus-asynchronous-article-function nil
   "*Function for picking articles to pre-fetch, possibly.")
 
+(defvar gnus-score-file-suffix "SCORE"
+  "*Suffix of the score files.")
+
+(defvar gnus-score-interactive-default-score 1000
+  "*Scoring commands will raise/lower the score with this number as the default.")
+
 (defvar gnus-large-newsgroup 200
   "*The number of articles which indicates a large newsgroup.
 If the number of articles in a newsgroup is greater than this value,
@@ -314,7 +321,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.
@@ -344,21 +352,18 @@ you could set this variable to something like:
  '((\"^Subject:.*gnus\\|^Newsgroups:.*gnus\" \"gnus-stuff\")
    (\"^Subject:.*vm\\|^Xref:.*vm\" \"vm-stuff\"))")
 
-(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-score-file-suffix "SCORE"
-  "*Suffix of the score files.")
-
 (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.
 If an unread article in the group refers to an older, already read (or
@@ -385,6 +390,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
@@ -441,6 +453,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
@@ -485,7 +500,7 @@ properly with all servers.")
 (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 thiss variable, are subscribed.")
+less than this variable, are subscribed.")
 
 (defvar gnus-level-zombie 8
   "*Groups with this level are zombie groups.")
@@ -614,15 +629,11 @@ 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
+                      '("^to\\."               ; not "real" groups
+                        "^[0-9]+ "             ; all digits in name
+                        "[][\"#'();\\]"        ; bogus characters
                         )
                       "\\|"))
   "*A regexp to match uninteresting newsgroups in the active file.
@@ -647,9 +658,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-check-before-posting t
-  "In non-nil, Gnus will attempt to run some checks on outgoing posts.")
-
 (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.
@@ -663,6 +671,12 @@ you want Gnus not to insert some header, remove it from this list.")
 (defvar gnus-save-all-headers t
   "*If non-nil, don't remove any headers before saving.")
 
+(defvar gnus-signature-separator "^-- *$"
+  "Regexp matching signature separator.")
+
+(defvar gnus-check-before-posting t
+  "In non-nil, Gnus will attempt to run some checks on outgoing posts.")
+
 (defvar gnus-inhibit-startup-message nil
   "*If non-nil, the startup message will not be displayed.")
 
@@ -722,35 +736,90 @@ beginning of a line.")
 (defvar gnus-use-full-window t
   "*If non-nil, use the entire Emacs screen.")
 
-; for split windows. maybe a better way?
-(defvar gnus-split-window nil
-  "*If non-nil, put the article buffer in left-hand side of the window .")
-
-(defvar gnus-window-configuration
-  '((newsgroups (1 0 0))
-    (summary (0 1 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-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-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).")
+Three pre-made functions are `gnus-mail-reply-using-mail' (sendmail);
+`gnus-mail-reply-using-mhe' (MH-E); and `gnus-mail-reply-using-vm'.")
 
 (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).") 
+Three pre-made functions are `gnus-mail-forward-using-mail' (sendmail);
+`gnus-mail-forward-using-mhe' (MH-E); and `gnus-mail-forward-using-vm'.") 
 
 (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).")
+Three pre-made functions are `gnus-mail-other-window-using-mail'
+(sendmail); `gnus-mail-other-window-using-mhe' (MH-E); and
+`gnus-mail-other-window-using-vm'.")
 
 (defvar gnus-mail-send-method send-mail-function
   "*Function to mail a message which is also being posted as an article.
@@ -949,7 +1018,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.
@@ -1030,24 +1099,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
@@ -1118,7 +1169,7 @@ buffer. Typical functions that this hook may contain are
 (add-hook 'gnus-article-display-hook 'gnus-article-treat-overstrike)
 
 (defvar gnus-article-x-face-command
-  "{ echo '/* Width=48, Height=48 */'; uncompface; } | icontopbm | xv -"
+  "{ 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.") 
@@ -1165,7 +1216,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.")
@@ -1197,13 +1248,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)
@@ -1211,12 +1262,12 @@ variable.")
 The hook is intended to mark an article as read (or unread)
 automatically when it is selected.")
 
+(defvar gnus-hidden-properties '(invisible t intangible t)
+  "Property list to use for hiding text.")
+
 \f
 ;; Internal variables
 
-(defvar gnus-internal-global-score-files nil)
-(defvar gnus-score-file-list nil)
-
 ;; Avoid highlighting in kill files.
 (defvar gnus-summary-inhibit-highlight nil)
 (defvar gnus-newsgroup-selected-overlay nil)
@@ -1236,6 +1287,8 @@ automatically when it is selected.")
 (defvar gnus-newsgroup-async nil)
 (defconst gnus-group-edit-buffer "*Gnus edit newsgroup*")
 
+(defvar gnus-newsgroup-adaptive nil)
+
 (defconst gnus-group-line-format-alist
   (list (list ?M 'marked ?c)
        (list ?S 'subscribed ?c)
@@ -1282,9 +1335,15 @@ automatically when it is selected.")
        (list ?z 'score-char ?c)
        (list ?U 'unread ?c)
        (list ?t '(gnus-summary-number-of-articles-in-thread 
-                  (if (boundp 'thread) (symbol-value 'thread)) nil) ?d)
+                  (or gnus-tmp-adopt-thread 
+                      (if (boundp 'thread) (symbol-value 'thread)
+                        thread nil)))
+                  ?d)
        (list ?e '(gnus-summary-number-of-articles-in-thread 
-                  (if (boundp 'thread) (symbol-value 'thread)) t) ?c)
+                  (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
@@ -1314,10 +1373,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.63"
+(defconst gnus-version "(ding) Gnus v0.70"
   "Version number for this version of Gnus.")
 
 (defvar gnus-info-nodes
@@ -1392,6 +1451,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.")
 
@@ -1466,7 +1527,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-prev-winconf nil)
 
 ;; Format specs
 (defvar gnus-summary-line-format-spec nil)
@@ -1501,73 +1562,76 @@ gnus-newsrc-hashtb should be kept so that both hold the same information.")
     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.")
 
 ;;; 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 'mail-extract-address-components "mail-extr")
+
+  ;; 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")
-  
+
+  ;; 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-visual-highlight-selected-summary "gnus-vis")
-  (autoload 'gnus-visual-summary-highlight-line "gnus-vis")
-
-  (autoload 'gnus-uu-mark-by-regexp "gnus-uu" nil t)
-  (autoload 'gnus-uu-mark-region "gnus-uu" nil t)
-  (autoload 'gnus-uu-mark-thread "gnus-uu" nil t)
-  (autoload 'gnus-uu-mark-sparse "gnus-uu" nil t)
-  (autoload 'gnus-uu-mark-series "gnus-uu" nil t)
-  (autoload 'gnus-uu-mark-all "gnus-uu" nil t)
-  (autoload 'gnus-uu-post-news "gnus-uu" nil t)
-  (autoload 'gnus-uu-digest-mail-forward "gnus-uu" nil t)
-  (autoload 'gnus-uu-digest-post-forward "gnus-uu" nil t)
-
-  (autoload 'gnus-uu-decode-uu "gnus-uu" nil t)
-  (autoload 'gnus-uu-decode-uu-and-save "gnus-uu" nil t)
-  (autoload 'gnus-uu-decode-unshar "gnus-uu" nil t)
-  (autoload 'gnus-uu-decode-unshar-and-save "gnus-uu" nil t)
-  (autoload 'gnus-uu-decode-save "gnus-uu" nil t)
-  (autoload 'gnus-uu-decode-binhex "gnus-uu" nil t)
-  (autoload 'gnus-uu-decode-uu-view "gnus-uu" nil t)
-  (autoload 'gnus-uu-decode-uu-and-save-view "gnus-uu" nil t)
-  (autoload 'gnus-uu-decode-unshar-view "gnus-uu" nil t)
-  (autoload 'gnus-uu-decode-unshar-and-save-view "gnus-uu" nil t)
-  (autoload 'gnus-uu-decode-save-view "gnus-uu" nil t)
-  (autoload 'gnus-uu-decode-binhex-view "gnus-uu" nil t)
-  (autoload 'gnus-uu-decode-postscript "gnus-uu" nil t)
-  (autoload 'gnus-uu-decode-postscript-and-save "gnus-uu" nil t)
-  (autoload 'gnus-uu-decode-postscript-view "gnus-uu" nil t)
-  (autoload 'gnus-uu-decode-postscript-and-save-view "gnus-uu" nil t)
-
+  (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")
@@ -1575,6 +1639,7 @@ gnus-newsrc-hashtb should be kept so that both hold the same information.")
   (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")
@@ -1583,10 +1648,7 @@ gnus-newsrc-hashtb should be kept so that both hold the same information.")
   (autoload 'gnus-cache-possibly-alter-active "gnus-cache")
   (autoload 'gnus-jog-cache "gnus-cache" nil t)
 
-  (autoload 'pp "pp")
-  (autoload 'pp-to-string "pp")
-  (autoload 'mail-extract-address-components "mail-extr")
-
+  ;; gnus-score
   (autoload 'gnus-summary-increase-map "gnus-score" nil nil 'keymap)
   (autoload 'gnus-summary-lower-map "gnus-score" nil nil 'keymap)
   (autoload 'gnus-summary-score-map "gnus-score" nil nil 'keymap)
@@ -1595,7 +1657,27 @@ gnus-newsrc-hashtb should be kept so that both hold the same information.")
   (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)
@@ -1618,6 +1700,13 @@ gnus-newsrc-hashtb should be kept so that both hold the same information.")
   (autoload 'gnus-mail-forward-using-mail "gnus-msg")
   (autoload 'gnus-mail-other-window-using-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)
+
   )
 
 \f
@@ -1628,23 +1717,6 @@ 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.
-(defconst gnus-xemacs (not (not (string-match "XEmacs\\|Lucid" emacs-version)))
-  "Non-nil if Gnus is running under GNU XEmacs.")
-
-(if gnus-xemacs
-    (progn
-      (or (memq 'underline (funcall 'list-faces))
-         (make-face 'underline))
-      (or (face-differs-from-default-p 'underline)
-         (set-face-underline-p 'underline t))
-      (or (fboundp 'set-text-properties)
-         (defun set-text-properties (start end props &optional buffer)
-           (if props
-               (put-text-property start end (car props) 
-                                  (funcall (intern "cadr") props) buffer)
-             (remove-text-properties start end ()))))))
-
 ;;; Various macros and substs.
 
 (defmacro gnus-eval-in-buffer-window (buffer &rest forms)
@@ -1740,7 +1812,7 @@ gnus-newsrc-hashtb should be kept so that both hold the same information.")
 (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))))))
 
@@ -1793,15 +1865,15 @@ gnus-newsrc-hashtb should be kept so that both hold the same information.")
       (setq gnus-summary-mark-positions pos))))
 
 (defun gnus-format-max-width (form length)
-  (let ((val (eval form)))
-    (if (> (length val) length)
-       (substring val 0 length)
-      val)))
+  (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)
@@ -1837,7 +1909,7 @@ gnus-newsrc-hashtb should be kept so that both hold the same information.")
     (save-excursion
       (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))))
@@ -1897,10 +1969,10 @@ gnus-newsrc-hashtb should be kept so that both hold the same information.")
   (if (get-buffer gnus-work-buffer)
       (progn
        (set-buffer gnus-work-buffer)
-       (gnus-add-current-to-buffer-list)
        (erase-buffer))
     (set-buffer (get-buffer-create gnus-work-buffer))
-    (buffer-disable-undo (current-buffer))))
+    (buffer-disable-undo (current-buffer))
+    (gnus-add-current-to-buffer-list)))
 
 ;; Article file names when saving.
 
@@ -2082,7 +2154,7 @@ the first newsgroup."
   (gnus-group-change-level 
    newsgroup gnus-level-default-subscribed
    gnus-level-killed (gnus-gethash (or next "dummy.group") gnus-newsrc-hashtb))
-  (message "Subscribe newsgroup: %s" newsgroup))
+  (gnus-message 5 "Subscribe newsgroup: %s" newsgroup))
 
 ;; For directories
 
@@ -2142,19 +2214,26 @@ If optional argument RE-ONLY is non-nil, strip `Re:' only."
     (save-excursion
       (gnus-set-work-buffer)
       (insert subject)
-      (goto-char (point-min))
-      (and (looking-at "^[ \t]*re:[ \t]*")
-          (replace-match "" t t))
-      (while (re-search-forward "[ \t\n]*([^()]*)[ \t\n]*\\'" nil t)
-       (replace-match "" t t)
-       (goto-char (point-min)))
-      (while (re-search-forward "[ \t]+" nil 'move)
-       (replace-match " " t t))
-      ;; the 'move above makes sure we are at (point-max)
-      (and (= (preceding-char) ? )
-          (delete-char -1))
+      (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)))
@@ -2214,11 +2293,12 @@ If optional argument RE-ONLY is non-nil, strip `Re:' only."
        gnus-newsgroup-headers-hashtb-by-number nil
        gnus-newsgroup-name nil
        gnus-server-alist nil
-       gnus-internal-global-score-files 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)
@@ -2236,120 +2316,154 @@ If optional argument RE-ONLY is non-nil, strip `Re:' only."
     (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)))
-           (if gnus-split-window ;hack by erik
-               (setq artheight height)
-             (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.
-       (if (and (not (zerop artheight))
-                (or (not (zerop grpheight))
-                    (not (zerop subheight))))
-           (if gnus-split-window
-               (split-window-horizontally)
-             (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)
+(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
-             (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)
-           (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 ((memq action '(newsgoups summary))
-        (if (gnus-buffer-exists-p 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)))
+      (and (symbolp buf) (setq 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."
@@ -2367,33 +2481,34 @@ 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-mode)
-  (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)
-  (message ""))
+  (let ((winconf (current-window-configuration)))
+    (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.
@@ -2425,8 +2540,10 @@ The source file has to be in the Emacs load path."
            (kill-buffer (current-buffer)))
        (setq dirs (cdr dirs))))
     (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")))
 
@@ -2540,6 +2657,25 @@ If nothing is specified, use the variable gnus-overload-functions."
       (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)
@@ -2773,7 +2909,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)
@@ -2834,25 +2971,33 @@ Note: LIST has to be sorted over `<'."
   (define-key gnus-group-mode-map "\C-c\C-i" 'gnus-info-find-node)
   (define-key gnus-group-mode-map "\M-e" 'gnus-group-edit-group-method)
   (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-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-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-make-map "e" 'gnus-group-edit-group-method)
-  (define-key gnus-group-make-map "p" 'gnus-group-edit-group-parameters)
+  (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)
@@ -2942,9 +3087,7 @@ prompt the user for the name of an NNTP server to use."
          did-connect)
       (unwind-protect
          (progn
-           (switch-to-buffer 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))))))
@@ -2962,10 +3105,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."
@@ -2999,7 +3140,8 @@ prompt the user for the name of an NNTP server to use."
       (progn
        (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.
@@ -3013,7 +3155,7 @@ If argument UNREAD is non-nil, groups with no unread articles are also listed."
        (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.
@@ -3183,7 +3325,7 @@ If REGEXP, only list groups matching REGEXP."
           (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))
@@ -3378,37 +3520,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)
-                                          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 (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.
@@ -3464,6 +3683,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.
@@ -3485,10 +3710,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)
@@ -3527,7 +3753,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))
@@ -3548,7 +3774,7 @@ If EXCLUDE-GROUP, do not go to that group."
   "Go to the first group with unread articles."
   (interactive)
   (goto-char (point-min))
-  (or (get-text-property (point) 'gnus-unread)
+  (or (not (zerop (or (get-text-property (point) 'gnus-unread) 0)))
       (gnus-group-next-unread-group 1))
   (gnus-group-position-cursor))
 
@@ -3556,7 +3782,7 @@ If EXCLUDE-GROUP, do not go to that group."
   "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)
@@ -3604,16 +3830,19 @@ ADDRESS."
                      (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 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" 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)
@@ -3661,14 +3890,13 @@ ADDRESS."
   "Get info from buffer, update variables and jump to the group buffer."
   (set-buffer (get-buffer-create gnus-group-edit-buffer))
   (goto-char (point-min))
-  (let ((form (read (current-buffer))))
+  (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 gnus-winconf-edit-group
-        (set-window-configuration gnus-winconf-edit-group))
-    (setq gnus-winconf-edit-group nil)
+    (and winconf (set-window-configuration winconf))
     (set-buffer gnus-group-buffer)
     (gnus-group-update-group (gnus-group-group-name))
     (gnus-group-position-cursor)))
@@ -3744,6 +3972,24 @@ score file entries for articles to include in the group."
                          "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>.
 
@@ -3777,28 +4023,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)
@@ -3811,7 +4059,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
@@ -3822,46 +4070,53 @@ 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-alist)))
-    (while newsrc
-      (gnus-group-expire-articles (car (car newsrc)))
-      (setq newsrc (cdr newsrc))))
-  (message "Expiring...done"))
+  (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: ")
+  (interactive "P\nnLevel: ")
   (or (and (>= level 1) (<= level gnus-level-killed))
       (error "Illegal level: %d" level))
-  (let (group)
-    (while (and (> n 0)
-               (setq group (gnus-group-group-name)))
-      (and (setq group (gnus-group-group-name))
-          (message "Changed level of %s from %d to %d" 
+  (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))
-      (forward-line 1)
-      (setq n (1- n))))
-  (gnus-group-position-cursor)
-  n)
+      (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)
   "Toggle subscribe from/to unsubscribe current group."
@@ -3899,29 +4154,24 @@ New newsgroup is added to .newsrc automatically."
            (or (and (member group gnus-zombie-list) 
                     gnus-level-zombie) 
                gnus-level-killed)
-           (or (and (gnus-group-group-name)
-                    (gnus-gethash (gnus-group-group-name) gnus-newsrc-hashtb))
-               (gnus-gethash (car (car gnus-newsrc-alist)) 
-                             gnus-newsrc-hashtb)))
+           (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."
@@ -3959,25 +4209,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) gnus-level-killed (if entry nil level)))
-    (if (eobp)
-       (forward-line -1))
     (gnus-group-position-cursor)
     group))
 
@@ -3997,13 +4245,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-alist))))
+      (setq prev (gnus-group-group-name))
       (gnus-group-change-level 
        info (nth 2 info) gnus-level-killed 
-       (gnus-gethash prev gnus-newsrc-hashtb)
+       (and prev (gnus-gethash prev gnus-newsrc-hashtb))
        t)
       (gnus-group-insert-group-line-info (nth 1 info))
       (setq gnus-list-of-killed-groups 
@@ -4014,16 +4259,17 @@ 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")
+      (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))
@@ -4032,7 +4278,7 @@ 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")
+      (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))
@@ -4058,28 +4304,27 @@ specify which levels you are interested in re-scanning."
   "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 
@@ -4093,7 +4338,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))
@@ -4106,7 +4351,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))
@@ -4160,7 +4405,7 @@ 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 "*Gnus Help*")
@@ -4177,7 +4422,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)
@@ -4244,7 +4489,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)")))
 
@@ -4331,7 +4576,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)
@@ -4363,61 +4608,65 @@ 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 &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)
+       (goto-char (point-min))
        (delete-matching-lines gnus-ignored-newsgroups)
        (while (re-search-forward 
                "\\(^[^ \t]+\\)[ \t]+[0-9]+[ \t]+[0-9]+" nil t)
@@ -4436,26 +4685,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."
@@ -4487,7 +4737,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 ()
@@ -4520,15 +4770,17 @@ and the second element is the address."
 (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 (or gnus-browse-return-buffer gnus-group-buffer)))
+  (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
 ;;;
@@ -4538,15 +4790,12 @@ 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-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-sort-map nil)
 (defvar gnus-summary-backend-map nil)
 (defvar gnus-summary-save-map nil)
@@ -4637,8 +4886,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)
@@ -4686,17 +4934,7 @@ 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-key gnus-summary-mode-map "S" 'gnus-summary-send-map)
   
@@ -4744,6 +4982,8 @@ and the second element is the address."
   (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)
@@ -4781,6 +5021,13 @@ and the second element is the address."
   (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)
@@ -4808,38 +5055,10 @@ and the second element is the address."
   (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-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-key gnus-summary-extract-map "p" 'gnus-uu-decode-postscript)
-  (define-key gnus-summary-extract-map "P" 'gnus-uu-decode-postscript-and-save)
-
-
-  (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-key gnus-summary-extract-view-map "p" 'gnus-uu-decode-postscript-view)
-  (define-key gnus-summary-extract-view-map "P" 'gnus-uu-decode-postscript-and-save-view)
-  
+  (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)
@@ -4926,8 +5145,10 @@ The following commands are available:
   (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)
@@ -4938,10 +5159,16 @@ 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))
+      t)))
 
 (defun gnus-set-global-variables ()
   ;; Set the global equivalents of the summary buffer-local variables
@@ -5008,6 +5235,7 @@ The following commands are available:
         (closing-bracket (if dummy ?\> ?\]))
         (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 (list number (or unread gnus-unread-mark) level)))))
@@ -5030,16 +5258,18 @@ 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 &optional char)
   ;; Sum up all elements (and sub-elements) in a list.
@@ -5057,11 +5287,19 @@ The following commands are available:
   "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)
-  (let ((did-select (gnus-select-newsgroup group show-all))
-       (method (car (gnus-find-method-for-group group))))
+  (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))
@@ -5071,13 +5309,11 @@ If NO-ARTICLE is non-nil, no article is selected initially."
             (gnus-group-next-unread-group 1)))
       nil)
      ((eq did-select 'quit)
-      (gnus-configure-windows 'summary)
-      (gnus-configure-windows 'newsgroup)
       (and (eq major-mode 'gnus-summary-mode)
           (not (equal (current-buffer) kill-buffer))
           (kill-buffer (current-buffer)))
       (gnus-kill-buffer kill-buffer)
-      (switch-to-buffer gnus-group-buffer)
+      (gnus-configure-windows 'group)
       (gnus-group-next-unread-group 1)
       (signal 'quit nil))
      (t
@@ -5089,7 +5325,7 @@ If NO-ARTICLE is non-nil, no article is selected initially."
       ;; You can change the subjects in this hook.
       (run-hooks 'gnus-select-group-hook)
       ;; Do score processing.
-      (gnus-possibly-score-headers)
+      (and gnus-use-scoring (gnus-possibly-score-headers))
       ;; Update the format specifiers.
       (gnus-update-format-specifications)
       ;; Generate the summary buffer.
@@ -5105,12 +5341,12 @@ If NO-ARTICLE is non-nil, no article is selected initially."
          (progn
            ;; This newsgroup is empty.
            (gnus-summary-catchup-and-exit nil t) ;Without confirmations.
-           (message "No unread news")
+           (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 'newsgroups t))))
+               (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.
@@ -5124,7 +5360,6 @@ If NO-ARTICLE is non-nil, no article is selected initially."
                 (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 in async mode, we send some info to the backend.
@@ -5273,7 +5508,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)))))
@@ -5379,8 +5621,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)
@@ -5396,6 +5639,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))
@@ -5482,6 +5749,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 
@@ -5514,7 +5782,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)
@@ -5526,7 +5795,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 
@@ -5612,7 +5882,7 @@ If READ-ALL is non-nil, all articles in the group are selected."
 
     (cond 
      ((null articles) 
-      (message "Couldn't select newsgroup")
+      (gnus-message 3 "Couldn't select newsgroup")
       'quit)
      ((eq articles 0) nil)
      (t
@@ -6049,7 +6319,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)
@@ -6160,15 +6430,13 @@ 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 'move))
@@ -6205,49 +6473,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 (gnus-point-at-eol)) ref id dep)
-    (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)))
@@ -6277,7 +6551,8 @@ list of headers that match SEQUENCE (see `nntp-retrieve-headers')."
   "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)
+      (and (header-xref gnus-current-headers)
+          (not (string= (header-xref gnus-current-headers) "")))
       (let ((case-fold-search t)
            xref)
        (save-restriction
@@ -6481,6 +6756,7 @@ 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)
@@ -6506,9 +6782,9 @@ displayed, no centering will be performed."
                         ((< height 6) 1)
                         (t 2))))
         (and (= w-end (point-max))
-             ;; adjust for blank lines at the bottom of the window
-            (setq top (+ (count-lines (window-start) (point))
-                         (- height (count-lines (window-start) w-end) 2))))
+             ;; adjust for blank lines at the bottom of the window
+             (setq top (+ (count-lines (window-start) (point))
+                          (- height (count-lines (window-start) w-end) 2))))
         (recenter top))))
 
 (defun gnus-summary-recenter ()
@@ -6517,20 +6793,24 @@ 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)
@@ -6602,6 +6882,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
 
@@ -6634,12 +6921,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)))
 
@@ -6649,7 +6938,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)
@@ -6657,18 +6946,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
@@ -6696,22 +6976,34 @@ gnus-exit-group-hook is called with no arguments if that value is non-nil."
           (gnus-mark-xrefs-as-read 
            group headers gnus-newsgroup-unreads gnus-newsgroup-expirable))
       ;; Do adaptive scoring, and possibly save score files.
-      (and gnus-use-adaptive-scoring
+      (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
@@ -6721,10 +7013,8 @@ 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 'article)
-      (gnus-configure-windows 'newsgroups)
       ;; Return to group mode buffer. 
       (if (eq mode 'gnus-summary-mode)
          (gnus-kill-buffer buf))
@@ -6758,12 +7048,11 @@ 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)
          (if (equal (gnus-group-group-name) group)
              (gnus-group-next-unread-group 1))
          (if (gnus-buffer-exists-p quit-buffer)
@@ -6775,8 +7064,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>.
@@ -6788,7 +7076,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.
@@ -6817,7 +7105,7 @@ If BACKWARD, go to previous group instead."
          (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)
@@ -6838,7 +7126,6 @@ If BACKWARD, go to previous group instead."
            (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.
 If prefix argument NO-ARTICLE is non-nil, no article is selected initially."
@@ -6864,7 +7151,7 @@ Returns nil if there are no unread articles."
              t
            ;; If there is no unread articles, stay where you are.
            (goto-char begin)
-           (message "No more unread articles")
+           (gnus-message 3 "No more unread articles")
            nil)
        (gnus-summary-position-cursor)))))
 
@@ -6880,7 +7167,8 @@ returned."
     (while (and (> n 0)
                (gnus-summary-search-forward unread nil backward))
       (setq n (1- n)))
-    (if (/= 0 n) (message "No more%s articles" (if unread " unread" "")))
+    (if (/= 0 n) (gnus-message 7 "No more%s articles"
+                              (if unread " unread" "")))
     (or dont-display
        (progn
          (gnus-summary-recenter)
@@ -6920,6 +7208,9 @@ If optional argument UNREAD is non-nil, only unread article is selected."
     (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
@@ -6933,8 +7224,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."
@@ -6953,6 +7243,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)
@@ -6965,20 +7268,35 @@ be displayed."
        (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)
-         (gnus-configure-windows 'article)
-         article)
-      (if all-headers (gnus-article-show-all-headers))
-      (gnus-configure-windows 'article)
-      (pop-to-buffer gnus-summary-buffer)
-      nil)))
+    (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)
+               article)
+           (if all-headers (gnus-article-show-all-headers))
+           (gnus-configure-windows 'article)
+           nil))
+      (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."
@@ -7002,7 +7320,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)
@@ -7027,22 +7345,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
@@ -7110,7 +7428,7 @@ 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))))
       (and gnus-summary-buffer
@@ -7131,7 +7449,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))
@@ -7145,7 +7462,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))
@@ -7254,7 +7571,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)
     
@@ -7283,21 +7601,20 @@ NOTE: This command only works with newsgroup that use NNTP."
                 (header-subject header))
                (forward-line -1)
                (header-number header)))
-       (let ((gnus-override-method gnus-refer-article-method))
+       (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 ()
@@ -7326,7 +7643,7 @@ NOTE: This command only works with newsgroup that use NNTP."
       (switch-to-buffer buf)
       (gnus-set-global-variables)
       (gnus-configure-windows 'summary)
-      (message "Article not a digest?"))))
+      (gnus-message 3 "Article not a digest?"))))
   
 (defun gnus-summary-isearch-article ()
   "Do incremental search forward on current article."
@@ -7387,7 +7704,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
@@ -7398,7 +7715,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)
@@ -7419,10 +7736,10 @@ 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))
@@ -7431,13 +7748,13 @@ article. If BACKWARD (the prefix) is non-nil, search backward instead."
   ;; 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."
@@ -7462,7 +7779,7 @@ 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-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.
@@ -7474,13 +7791,15 @@ 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."
@@ -7565,7 +7884,8 @@ and `request-accept' functions. (Ie. mail newsgroups at present.)"
     (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 
@@ -7617,7 +7937,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)))))
 
@@ -7694,7 +8014,8 @@ functions. (Ie. mail newsgroups at present.)"
     (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
@@ -7733,7 +8054,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)))
@@ -7799,12 +8120,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 ()
@@ -7873,6 +8194,10 @@ 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")
@@ -7921,8 +8246,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. 
@@ -7938,8 +8263,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.
@@ -7984,7 +8309,7 @@ number of articles marked is returned."
            (gnus-summary-set-process-mark (gnus-summary-article-number)))
          (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))
@@ -8042,12 +8367,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."
@@ -8058,8 +8383,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)
@@ -8110,7 +8435,7 @@ returned."
              (zerop (gnus-summary-next-subject 
                      (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)
@@ -8145,7 +8470,6 @@ marked."
     ;; See whether the article is to be put in the cache.
     (and gnus-use-cache
         (save-excursion
-          (gnus-summary-select-article)
           (gnus-cache-possibly-enter-article 
            gnus-newsgroup-name article 
            (gnus-get-header-by-number article)
@@ -8319,7 +8643,7 @@ even ticked and dormant ones."
   (gnus-summary-remove-lines-marked-with 
    (concat (mapconcat
            (lambda (char) (char-to-string (symbol-value char)))
-           '(gnus-del-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)
            ""))))
@@ -8338,7 +8662,7 @@ even ticked and dormant ones."
     (let ((buffer-read-only nil)
           (marks (concat "^[" marks "]")))
       (goto-char (point-min))
-      (if gnus-use-adaptive-scoring
+      (if gnus-newsgroup-adaptive
          (gnus-score-remove-lines-adaptive marks)
        (while (re-search-forward marks (point-max) t)
          (beginning-of-line)
@@ -8434,7 +8758,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)))
 
@@ -8451,7 +8779,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)))
 
@@ -8461,7 +8794,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.
@@ -8477,14 +8810,20 @@ 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)
+                  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)
@@ -8504,7 +8843,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)
@@ -8622,7 +8961,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)
@@ -8668,7 +9007,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)
@@ -8711,14 +9050,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."
@@ -8734,7 +9073,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."
@@ -8746,7 +9085,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")
@@ -8759,7 +9098,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")
@@ -8778,8 +9117,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.
@@ -8804,26 +9147,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))
@@ -8842,17 +9168,15 @@ The variable `gnus-default-article-saver' specifies the saver function."
                      (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))
 
@@ -8906,6 +9230,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)
@@ -9163,13 +9497,16 @@ is initialized from the SAVEDIR environment variable."
   (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" "C" "S"
               "m" "o" "\C-o" "|" "\M-m" "\M-\C-m" "\M-k" "M"
@@ -9179,7 +9516,7 @@ is initialized from the SAVEDIR environment variable."
        'gnus-article-summary-command)
       (setq commands (cdr commands))))
 
-  (let ((commands (list "q" "Q" "r" "R" "\C-c\C-f" "m"  "a" "f" "F")))
+  (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)
@@ -9234,6 +9571,10 @@ The following commands are available:
 (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.
@@ -9316,7 +9657,6 @@ 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
@@ -9332,7 +9672,7 @@ If ALL-HEADERS is non-nil, no headers are hidden."
                  (setq gnus-current-article 0)
                  (and (numberp article) 
                       (gnus-summary-mark-as-read article gnus-canceled-mark))
-                 (message "No such article (may be canceled)")
+                 (gnus-message 1 "No such article (may be canceled)")
                  (and (numberp article)
                       (setq gnus-current-article article))
                  (ding))
@@ -9404,26 +9744,17 @@ If ALL-HEADERS is non-nil, no headers are hidden."
              (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)
-              (cond (bookmark
-                     (message "Moved to bookmark")
-                     (search-forward "\n\n" nil t)
-                     (forward-line bookmark)
-                     (point))
-                    (t
-                     (point-min))))
+             (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.
@@ -9442,12 +9773,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 "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) 
@@ -9456,7 +9787,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
@@ -9479,7 +9810,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
@@ -9499,41 +9830,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 ()
@@ -9564,7 +9861,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"))
@@ -9593,25 +9890,16 @@ please do mail it to me."
     (if (or (not gnus-article-x-face-command)
            (and (re-search-forward "^\\($\\|X-Face: \\)" nil t)
                 (looking-at "^$")))
-       ()
-      (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
-               (progn
-                 (process-send-string process face)
-                 (process-send-eof process))
-             (error "Couldn't start process"))))))))
+       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.
@@ -9624,6 +9912,7 @@ or not."
   (save-excursion
     (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
@@ -9644,7 +9933,7 @@ or not."
             (insert (hexl-hex-string-to-integer
                      (buffer-substring (point) (+ 2 (point)))))
             (delete-char 2))
-           ((message "Malformed MIME quoted-printable message"))))))
+           ((gnus-message 3 "Malformed MIME quoted-printable message"))))))
 
 
 (defun gnus-article-date-ut (&optional type)
@@ -9671,8 +9960,11 @@ how much time has lapsed since DATE."
           (concat "Date: " (timezone-make-date-arpa-standard date nil "UT")
                   "\n"))
          ((eq type 'lapsed)
-          (let* ((sec (- (gnus-seconds-since-epoch (current-time-string))
-                         (gnus-seconds-since-epoch date)))
+          (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))
@@ -9707,6 +9999,8 @@ how much time has lapsed since DATE."
   (interactive)
   (gnus-article-date-ut 'lapsed))
 
+(defun gnus-article-maybe-highlight ()
+  (if gnus-visual (gnus-article-highlight)))
 
 ;; Article savers.
 
@@ -9919,13 +10213,12 @@ If YANK is non-nil, include the original article."
   "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 ()
@@ -9968,7 +10261,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)
@@ -9992,7 +10285,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)
@@ -10019,7 +10312,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))))
@@ -10146,9 +10439,9 @@ If NEWSGROUP is nil, return the global kill file name instead."
              (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))
@@ -10347,10 +10640,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)
@@ -10364,11 +10657,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)
@@ -10377,7 +10671,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))
@@ -10543,6 +10837,11 @@ 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-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)
@@ -10685,8 +10984,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
@@ -10695,10 +10994,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
@@ -10764,8 +11063,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")))
     got-new))
 
 (defun gnus-check-first-time-used ()
@@ -10774,7 +11073,7 @@ The `-n' option line from .newsrc is respected."
          (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)
@@ -10802,7 +11101,7 @@ The `-n' option line from .newsrc is respected."
          (setq groups (cdr groups)))
        (gnus-group-make-help-group)
        (and gnus-novice-user
-            (message "`G k' to list killed groups"))))))
+            (gnus-message 7 "`G k' to list killed groups"))))))
 
 ;; `gnus-group-change-level' is the fundamental function for changing
 ;; subscription levels of newsgroups. This might mean just changing
@@ -10889,12 +11188,15 @@ 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-alist))))
-                (setcdr (if previous (cdr previous) gnus-newsrc-alist)
-                        entry)
-                (gnus-sethash group (cons num (if previous (cdr previous)
-                                                gnus-newsrc-alist))
+                (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))))
+                (setcdr (cdr previous) entry)
+                (gnus-sethash group (cons num (cdr previous)) 
                               gnus-newsrc-hashtb)
                 (if (cdr entry)
                     (setcdr (gnus-gethash (car (car (cdr entry)))
@@ -10916,7 +11218,7 @@ If CONFIRM is non-nil, the user has to confirm the deletion of every
 newsgroup." 
   (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
@@ -10952,24 +11254,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-alist' and compare with `gnus-active-hashtb'
 ;; and compute how many unread articles there are in each group.
 (defun gnus-get-unread-articles (&optional level)
-  (let ((newsrc (cdr gnus-newsrc-alist))
-       (level (or level (1+ gnus-level-subscribed)))
-       info group active virtuals method)
-    (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))
@@ -10980,7 +11283,9 @@ 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 (setq method (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)
@@ -11013,7 +11318,7 @@ 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.
@@ -11146,7 +11451,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))
@@ -11223,6 +11528,7 @@ Returns whether the updating was successful."
   "Get active file from NNTP server."
   (gnus-group-set-mode-line)
   (let ((methods (cons gnus-select-method gnus-secondary-select-methods))
+       (not-first nil)
        list-type)
     (setq gnus-have-read-active-file nil)
     (save-excursion
@@ -11233,7 +11539,7 @@ Returns whether the updating was successful."
                             (if (and where (not (zerop (length where))))
                                 (concat " from " where) "")
                             (car (car methods)))))
-         (message mesg)
+         (gnus-message 5 mesg)
          (gnus-check-news-server (car methods))
          (cond 
           ((and (eq gnus-read-active-file 'some)
@@ -11250,28 +11556,27 @@ Returns whether the updating was successful."
                (setq newsrc (cdr newsrc)))
              (setq list-type (gnus-retrieve-groups groups (car methods)))
              (cond ((not list-type)
-                    (message "Cannot read partial active file from %s server." 
-                             (car (car methods)))
+                    (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 gnus-have-read-active-file (car methods)))
-                    (setq gnus-have-read-active-file t))
+                    (gnus-active-to-gnus-format (and not-first (car methods)))
+                    (setq not-first t))
                    (t
-                    (gnus-groups-to-gnus-format
-                     (and gnus-have-read-active-file (car methods)))
-                    (setq gnus-have-read-active-file t)))))
+                    (gnus-groups-to-gnus-format (and not-first (car methods)))
+                    (setq not-first t)))))
           (t
            (if (not (gnus-request-list (car methods)))
                (progn
-                 (message "Cannot read active file from %s server." 
-                          (car (car methods)))
+                 (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)))))
+             (gnus-message 5 "%s...done" mesg)))))
        (setq methods (cdr methods))))))
 
 ;; rewritten by jwz based on ideas from Rick Sladkey <jrs@world.std.com>
@@ -11324,7 +11629,7 @@ Lines matching `gnus-ignored-newsgroups' are ignored."
                            (cons (symbol-name group) gnus-moderated-list)))
                  (forward-line 1)))
            (error 
-            (progn (ding) (message "Possible error in active file."))))
+            (progn (ding) (gnus-message 3 "Possible error in active file."))))
        ;; And if we do not care about moderation, we use this loop,
        ;; which is faster.
        (condition-case ()
@@ -11337,7 +11642,8 @@ Lines matching `gnus-ignored-newsgroups' are ignored."
                (set group (cons (read cur) max))
                (forward-line 1)))
          (error 
-          (progn (ding) (message "Possible error in active file."))))))))
+          (progn (ding) 
+                 (gnus-message 3 "Possible error in active file."))))))))
 
 (defun gnus-groups-to-gnus-format (method &optional hashtb)
   ;; Parse a "groups" active file.
@@ -11379,7 +11685,7 @@ Lines matching `gnus-ignored-newsgroups' are ignored."
                         (cons min max))))
              (forward-line 1))))
       (error 
-       (progn (ding) (message "Possible error in active file."))))))
+       (progn (ding) (gnus-message 3 "Possible error in active file."))))))
 
 (defun gnus-read-newsrc-file (&optional force)
   "Read startup file.
@@ -11411,17 +11717,17 @@ 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))))))
+           (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)
+    (gnus-message 5 "Reading %s..." ding-file)
     (let (gnus-newsrc-assoc)
       (condition-case nil
          (load ding-file t t t)
@@ -11433,7 +11739,7 @@ If FORCE is non-nil, the .newsrc file is read."
     (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))))
@@ -11519,220 +11825,243 @@ 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))))
+  (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))
-       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))
+       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 (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 subscribe))
-                        (setq level (if read-list 
+                 (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) subscribe)
+                       ((and (> level gnus-level-subscribed) subscribed)
                         (setq level gnus-level-default-subscribed)))
                  (setcar (cdr info) level))
-             (setq gnus-newsrc-alist
-                   (cons (list newsgroup 
-                               (if subscribe
-                                   gnus-level-default-subscribed 
-                                 (if read-list 
-                                     (1+ gnus-level-subscribed)
-                                   gnus-level-default-unsubscribed))
-                               (nreverse read-list))
-                         gnus-newsrc-alist))))))
-       (setq line (1+ line))
-       (forward-line 1)))
-    (setq gnus-newsrc-alist (cdr gnus-newsrc-alist))
-    (or already-read (setq gnus-newsrc-alist (nreverse gnus-newsrc-alist)))
+             ;; 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 newsrc (nreverse newsrc))
+
+    (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)
-    nil))
 
-(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)))
+    ;; 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."
@@ -11752,25 +12081,26 @@ 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 ()
@@ -11805,7 +12135,7 @@ If FORCE is non-nil, the .newsrc file is read."
       (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))
@@ -11837,11 +12167,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)))
@@ -11861,11 +12196,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) (gnus-point-at-eol)))
+           (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.
@@ -11915,6 +12250,7 @@ with some simple extensions.")
   (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)
@@ -11935,7 +12271,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)
@@ -11969,7 +12305,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 
@@ -11988,13 +12325,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)
@@ -12165,226 +12500,46 @@ 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 gnus-server-edit-buffer)
-  (gnus-add-current-to-buffer-list)
-  (emacs-lisp-mode)
-  (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)))))
+  (let ((winconf (current-window-configuration)))
+    (get-buffer-create gnus-server-edit-buffer)
+    (gnus-configure-windows 'edit-server)
+    (gnus-add-current-to-buffer-list)
+    (emacs-lisp-mode)
+    (make-local-variable 'gnus-prev-winconf)
+    (setq gnus-prev-winconf winconf)
+    (use-local-map (copy-keymap (current-local-map)))
+    (let ((done-func '(lambda () 
+                       "Exit editing mode and update the information."
+                       (interactive)
+                       (gnus-server-edit-server-done 'group))))
+      (setcar (cdr (nth 4 done-func)) server)
+      (local-set-key "\C-c\C-c" done-func))
+    (erase-buffer)
+    (insert ";; Type `C-c C-c' after you have edited the server.\n\n")
+    (insert (pp-to-string (cdr (assoc server gnus-server-alist))))))
 
 (defun gnus-server-edit-server-done (server)
   (interactive)
   (set-buffer (get-buffer-create gnus-server-edit-buffer))
   (goto-char (point-min))
-  (let ((form (read (current-buffer))))
-    (gnus-server-set-info server form))
-  (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))
+  (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)))
 
-;;; Gnus score functions.
-
-(defvar gnus-global-score-files nil
-  "*List of global score files and directories.
-Set this variable if you want to use people's score files.  One entry
-for each score file or each score file directory.  Gnus will decide
-by itself what score files are applicable to which group.
-
-Say you want to use the single score file
-\"/ftp.ifi.uio.no@ftp:/pub/larsi/ding/score/soc.motss.SCORE\" and all
-score files in the \"/ftp.some-where:/pub/score\" directory.
-
- (setq gnus-global-score-files
-       '(\"/ftp.ifi.uio.no:/pub/larsi/ding/score/soc.motss.SCORE\"
-         \"/ftp.some-where:/pub/score\"))")
-
-(defun gnus-score-score-files (group)
-  "Return a list of all possible score files."
-  (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-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 "" t t) 
-       (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 ".*" t t))
-       (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-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-possibly-score-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)))
-    (if score-files (gnus-score-headers score-files))))
-
-(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-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)))
-
-(defun gnus-score-default (level)
-  (if level (prefix-numeric-value level) 
-    gnus-score-interactive-default-score))
+(defun gnus-mouse-pick-server (e)
+  (interactive "e")
+  (mouse-set-point e)
+  (gnus-server-read-server (gnus-server-server-name)))
 
 (provide 'gnus)
 
index ee3ee7b..d83b953 100644 (file)
@@ -48,8 +48,7 @@
 (defconst nnbabyl-version "nnbabyl 0.1"
   "nnbabyl version.")
 
-(defconst nnbabyl-mbox-buffer " *nnbabyl mbox buffer*")
-
+(defvar nnbabyl-mbox-buffer nil)
 (defvar nnbabyl-current-group nil)
 (defvar nnbabyl-status-string "")
 (defvar nnbabyl-group-alist nil)
@@ -85,7 +84,7 @@
        (setq art-string (nnbabyl-article-string article))
        (set-buffer nnbabyl-mbox-buffer)
        (if (or (search-forward art-string nil t)
-               (progn (goto-char 1)
+               (progn (goto-char (point-min))
                       (search-forward art-string nil t)))
            (progn
              (setq start 
           (message "nnbabyl: Receiving headers... done"))
 
       ;; Fold continuation lines.
-      (goto-char 1)
+      (goto-char (point-min))
       (while (re-search-forward "\\(\r?\n[ \t]+\\)+" nil t)
        (replace-match " " t t))
       'headers)))
       nil
     (save-excursion
       (set-buffer nnbabyl-mbox-buffer)
-      (goto-char 1)
+      (goto-char (point-min))
       (if (search-forward (nnbabyl-article-string article) nil t)
          (let (start stop)
            (re-search-backward (concat "^" nnbabyl-mail-delimiter) nil t)
     (save-excursion 
       (set-buffer nnbabyl-mbox-buffer)
       (while articles
-       (goto-char 1)
+       (goto-char (point-min))
        (if (search-forward (nnbabyl-article-string (car articles)) nil t)
            (if (or force
                    (> (nnmail-days-between 
        (goto-char (point-min))
        (while (not (search-forward
                     (nnbabyl-article-string (car active)) nil t))
-         (setcar (car active) (1+ (car active)))
+         (setcar active (1+ (car active)))
          (goto-char (point-min))))
       (nnmail-save-active nnbabyl-group-alist nnbabyl-active-file)
       rest)))
        result)
      (save-excursion
        (set-buffer nnbabyl-mbox-buffer)
-       (goto-char 1)
+       (goto-char (point-min))
        (if (search-forward (nnbabyl-article-string article) nil t)
           (nnbabyl-delete-mail))
        (and last (save-buffer))))
   (let ((buf (current-buffer))
        result beg)
     (and 
+     (nnbabyl-request-list)
      (setq nnbabyl-group-alist (nnmail-get-active))
      (save-excursion
-       (set-buffer nnbabyl-mbox-buffer)
-       (setq beg (goto-char (point-max)))
-       (insert-buffer-substring buf)
-       (goto-char beg)
-       (if (stringp group)
-          (progn
-            (search-forward "\n\n" nil t)
-            (forward-line -1)
-            (save-excursion
-              (while (re-search-backward "^X-Gnus-Newsgroup: " beg t)
-                (delete-region (point) (progn (forward-line 1) (point)))))
-            (setq result (nnbabyl-insert-newsgroup-line group)))
+       (goto-char (point-min))
+       (search-forward "\n\n" nil t)
+       (forward-line -1)
+       (save-excursion
+        (while (re-search-backward "^X-Gnus-Newsgroup: " beg t)
+          (delete-region (point) (progn (forward-line 1) (point)))))
+       (let ((nnmail-split-methods
+             (if (stringp group) (list (list group "")) 
+               nnmail-split-methods)))
         (setq result (nnbabyl-save-mail)))
-       (and last (save-buffer))
-       result)
-     (nnmail-save-active nnbabyl-group-alist nnbabyl-active-file))
-    result))
+       (set-buffer nnbabyl-mbox-buffer)
+       (goto-char (point-max))
+       (search-backward "\n\^_")
+       (goto-char (match-end 0))
+       (insert-buffer buf)
+       (and last (progn 
+                  (save-buffer)
+                  (nnmail-save-active
+                   nnbabyl-group-alist nnbabyl-active-file)))
+       result))))
 
 (defun nnbabyl-request-replace-article (article group buffer)
   (nnbabyl-possibly-change-newsgroup group)
   (save-excursion
     (set-buffer nnbabyl-mbox-buffer)
-    (goto-char 1)
+    (goto-char (point-min))
     (if (not (search-forward (nnbabyl-article-string article) nil t))
        nil
       (nnbabyl-delete-mail t t)
 (defun nnbabyl-possibly-change-newsgroup (newsgroup)
   (if (or (not nnbabyl-mbox-buffer)
          (not (buffer-name nnbabyl-mbox-buffer)))
-      (save-excursion
-       (nnbabyl-read-mbox)))
-  (if (not nnbabyl-group-alist)
-      (setq nnbabyl-group-alist (nnmail-get-active)))
+      (save-excursion (nnbabyl-read-mbox)))
+  (or nnbabyl-group-alist
+      (progn
+       (nnbabyl-request-list)
+       (setq nnbabyl-group-alist (nnmail-get-active))))
   (if newsgroup
       (if (assoc newsgroup nnbabyl-group-alist)
          (setq nnbabyl-current-group newsgroup)
 (defun nnbabyl-insert-newsgroup-line (group-art)
   (save-excursion
     (goto-char (point-min))
-    (or (looking-at "\^_")
-       (insert "\^_\^L\n0, unseen,,\n*** EOOH ***\n"))
+    ;; If there is a C-l at the beginning of the narrowed region, this
+    ;; isn't really a "save", but rather a "scan".
+    (or (looking-at "\^L")
+       (save-excursion
+         (insert "\^L\n0, unseen,,\n*** EOOH ***\n")
+         (goto-char (point-max))
+         (insert "\^_\n")))
     (while (looking-at "From ")
-      (replace-match "Mail-from: ")
+      (replace-match "Mail-from: " t t)
       (forward-line 1))
     (if (search-forward "\n\n" nil t)
        (progn
            (insert (format "X-Gnus-Newsgroup: %s:%d   %s\n" 
                            (car (car group-art)) (cdr (car group-art))
                            (current-time-string)))
-           (setq group-art (cdr group-art)))))))
+           (setq group-art (cdr group-art)))))
+    t))
 
 (defun nnbabyl-active-number (group)
   ;; Find the next article number in GROUP.
 (defun nnbabyl-read-mbox ()
   (nnbabyl-request-list)
   (setq nnbabyl-group-alist (nnmail-get-active))
-  (if (not (file-exists-p nnbabyl-mbox-file))
-      (write-region 1 1 nnbabyl-mbox-file t 'nomesg))
+  (or (file-exists-p nnbabyl-mbox-file)
+      (save-excursion
+       (set-buffer (setq nnbabyl-mbox-buffer
+                         (create-file-buffer nnbabyl-mbox-file)))
+       (setq buffer-file-name nnbabyl-mbox-file)
+       (insert "BABYL OPTIONS:\n\n\^_")
+       (write-region (point-min) (point-max) nnbabyl-mbox-file t 'nomesg)))
   (if (and nnbabyl-mbox-buffer
           (get-buffer nnbabyl-mbox-buffer)
           (buffer-name nnbabyl-mbox-buffer)
                (save-excursion
                  (save-restriction
                    (goto-char start)
-                   (narrow-to-region start end)
+                   (narrow-to-region (1+ start) end)
                    (nnbabyl-save-mail))))))
-       (save-buffer)
+       (and (buffer-modified-p (current-buffer)) (save-buffer))
        (nnmail-save-active nnbabyl-group-alist nnbabyl-active-file)))))
 
 (defun nnbabyl-get-new-mail ()
-  (let (incoming)
+  "Read new incoming mail."
+  (let ((spools (if (listp nnmail-spool-file) nnmail-spool-file
+                 (list nnmail-spool-file)))
+       incoming incomings)
     (nnbabyl-read-mbox)
-    (if (and nnmail-spool-file nnbabyl-get-new-mail
-            (file-exists-p nnmail-spool-file)
-            (> (nth 7 (file-attributes nnmail-spool-file)) 0))
-       (progn
-         (and gnus-verbose-backends
-              (message "nnbabyl: Reading incoming mail..."))
-         (setq incoming 
-               (nnmail-move-inbox nnmail-spool-file
-                                  (concat nnbabyl-mbox-file "-Incoming")))
-         (save-excursion
-           (let ((in-buf (nnmail-split-incoming 
-                          incoming 'nnbabyl-save-mail t)))
-             (set-buffer nnbabyl-mbox-buffer)
-             (goto-char (point-max))
-             (search-backward "\n\^_" nil t)
-             (insert-buffer-substring in-buf)
-             (kill-buffer in-buf)))
-         (run-hooks 'nnmail-read-incoming-hook)
-         (and gnus-verbose-backends
-              (message "nnbabyl: Reading incoming mail...done"))))
-    (and (buffer-modified-p nnbabyl-mbox-buffer) 
-        (save-excursion
-          (nnmail-save-active nnbabyl-group-alist nnbabyl-active-file)
-          (set-buffer nnbabyl-mbox-buffer)
-          (save-buffer)))
-    ;; (if incoming (delete-file incoming))
-    ))
+    (if (or (not nnbabyl-get-new-mail) (not nnmail-spool-file))
+       ()
+      ;; We go through all the existing spool files and split the
+      ;; mail from each.
+      (while spools
+       (and
+        (file-exists-p (car spools))
+        (> (nth 7 (file-attributes (car spools))) 0)
+        (progn
+          (and gnus-verbose-backends 
+               (message "nnbabyl: Reading incoming mail..."))
+          (setq incoming 
+                (nnmail-move-inbox 
+                 (car spools) (concat nnbabyl-mbox-file "-Incoming")))
+          (setq incomings (cons incoming incomings))
+          (save-excursion
+            (let ((in-buf (nnmail-split-incoming 
+                           incoming 'nnbabyl-save-mail t)))
+              (set-buffer in-buf)
+              (goto-char (point-min))
+              (while (search-forward "\n\^_\n" nil t)
+                (delete-char -1))
+              (set-buffer nnbabyl-mbox-buffer)
+              (goto-char (point-max))
+              (search-backward "\n\^_" nil t)
+              (goto-char (match-end 0))
+              (insert-buffer-substring in-buf)
+              (kill-buffer in-buf)))))
+       (setq spools (cdr spools)))
+      ;; If we did indeed read any incoming spools, we save all info. 
+      (and (buffer-modified-p nnbabyl-mbox-buffer) 
+          (save-excursion
+            (nnmail-save-active nnbabyl-group-alist nnbabyl-active-file)
+            (set-buffer nnbabyl-mbox-buffer)
+            (save-buffer)))
+      (while incomings
+       ;; The following has been commented away, just to make sure
+       ;; that nobody ever loses any mail. If you feel safe that
+       ;; nnfolder will never do anything strange, just remove those
+       ;; two semicolons, and avoid having lots of "Incoming*"
+       ;; files. 
+       ;; (and (file-writable-p incoming) (delete-file incoming))
+       (setq incomings (cdr incomings))))))
 
 (provide 'nnbabyl)
 
index 3914814..74fe6c9 100644 (file)
 
 (defvar nndigest-group-alist nil)
 
-(defconst nndigest-separator 
+(defvar nndigest-separator 
   "^------------------------------[\n \t]*\n[^ ]+: ")
 
+(defvar nndigest-first-article-separator 
+  "^------------------------------*[\n \t]*\n[^ ]+: ")
+
 \f
 
 ;;; Interface functions.
@@ -74,7 +77,7 @@
        (setq sequence (cdr sequence)))
 
       ;; Fold continuation lines.
-      (goto-char 1)
+      (goto-char (point-min))
       (while (re-search-forward "\\(\r?\n[ \t]+\\)+" nil t)
        (replace-match " " t t))
       'headers)))
       (set-buffer nndigest-current-buffer)
       (widen)
       (goto-char (point-min))
+      (if (re-search-forward nndigest-first-article-separator nil t)
+         (setq num 1))
       (while (re-search-forward nndigest-separator nil t)
        (setq num (1+ num)))
       (set-buffer nntp-server-buffer)
     (set-buffer nndigest-current-buffer)
     (widen)
     (goto-char (point-min))
-    (while (and (not (zerop article))
-               (re-search-forward nndigest-separator nil t))
-      (setq article (1- article)))
+    (re-search-forward nndigest-first-article-separator nil t)
+    (while (and (not (zerop (setq article (1- article))))
+               (re-search-forward nndigest-separator nil t)))
     (if (zerop article)
        (progn
          (goto-char (match-end 0))
index c6198f5..a109f54 100644 (file)
@@ -84,7 +84,7 @@ Newsgroup must be selected before calling this function."
        (setq sequence (cdr sequence)))
 
       ;; Fold continuation lines.
-      (goto-char 1)
+      (goto-char (point-min))
       (while (re-search-forward "\\(\r?\n[ \t]+\\)+" nil t)
        (replace-match " " t t))
       'headers)))
index e8b73bc..7d570eb 100644 (file)
@@ -139,7 +139,7 @@ such things as moving mail.  All buffers always get killed upon server close.")
 
       ;; Fold continuation lines.
       (set-buffer nntp-server-buffer)
-      (goto-char 1)
+      (goto-char (point-min))
       (while (re-search-forward "\\(\r?\n[ \t]+\\)+" nil t)
        (replace-match " " t t))
       'headers)))
@@ -285,7 +285,7 @@ such things as moving mail.  All buffers always get killed upon server close.")
     (save-excursion 
       (set-buffer nnfolder-current-buffer)
       (while articles
-       (goto-char 1)
+       (goto-char (point-min))
        (if (search-forward (nnfolder-article-string (car articles)) nil t)
            (if (or force
                    (> (nnmail-days-between 
@@ -340,7 +340,7 @@ such things as moving mail.  All buffers always get killed upon server close.")
      (save-excursion
        (nnfolder-possibly-change-group group)
        (set-buffer nnfolder-current-buffer)
-       (goto-char 1)
+       (goto-char (point-min))
        (if (search-forward (nnfolder-article-string article) nil t)
           (nnfolder-delete-mail))
        (and last 
@@ -378,7 +378,7 @@ such things as moving mail.  All buffers always get killed upon server close.")
   (nnfolder-possibly-change-group group)
   (save-excursion
     (set-buffer nnfolder-current-buffer)
-    (goto-char 1)
+    (goto-char (point-min))
     (if (not (search-forward (nnfolder-article-string article) nil t))
        nil
       (nnfolder-delete-mail t t)
@@ -599,33 +599,54 @@ such things as moving mail.  All buffers always get killed upon server close.")
       (current-buffer))))
 
 (defun nnfolder-get-new-mail ()
-  (let (incoming)
-    (if (and nnmail-spool-file
-            nnfolder-get-new-mail
-            (file-exists-p nnmail-spool-file)
-            (> (nth 7 (file-attributes nnmail-spool-file)) 0))
-       (progn
-         (and gnus-verbose-backends
-              (message "nnfolder: Reading incoming mail..."))
-         (setq incoming 
-               (nnmail-move-inbox nnmail-spool-file
-                                  (concat nnfolder-directory "Incoming")))
-         (nnmail-split-incoming incoming 'nnfolder-save-mail)
-         (run-hooks 'nnmail-read-incoming-hook)
-         (nnmail-save-active nnfolder-group-alist nnfolder-active-file)
-         (and gnus-verbose-backends
-              (message "nnfolder: Reading incoming mail...done"))))
-    (let ((bufs nnfolder-buffer-alist))
-      (save-excursion
-       (while bufs
-         (if (not (buffer-name (nth 1 (car bufs))))
-             (setq nnfolder-buffer-alist 
-                   (delq (car bufs) nnfolder-buffer-alist))
-           (set-buffer (nth 1 (car bufs)))
-           (and (buffer-modified-p) (save-buffer)))
-         (setq bufs (cdr bufs)))))
-    ;; (if incoming (delete-file incoming))
-    ))
+  "Read new incoming mail."
+  (let ((spools (if (listp nnmail-spool-file) nnmail-spool-file
+                  (list nnmail-spool-file)))
+       incomings incoming)
+    (if (or (not nnfolder-get-new-mail) (not nnmail-spool-file))
+       ()
+      ;; We first activate all the groups.
+      (nnfolder-request-list)
+      (setq nnfolder-group-alist (nnmail-get-active))
+      ;; The we go through all the existing spool files and split the
+      ;; mail from each.
+      (while spools
+       (and
+        (file-exists-p (car spools))
+        (> (nth 7 (file-attributes (car spools))) 0)
+        (progn
+          (and gnus-verbose-backends 
+               (message "nnfolder: Reading incoming mail..."))
+          (setq incoming 
+                (nnmail-move-inbox 
+                 (car spools) (concat nnfolder-directory "Incoming")))
+          (setq incomings (cons incoming incomings))
+          (nnmail-split-incoming incoming 'nnfolder-save-mail)))
+       (setq spools (cdr spools)))
+      ;; If we did indeed read any incoming spools, we save all info. 
+      (if incoming 
+         (progn
+           (nnmail-save-active nnfolder-group-alist nnfolder-active-file)
+           (run-hooks 'nnmail-read-incoming-hook)
+           (and gnus-verbose-backends
+                (message "nnfolder: Reading incoming mail...done"))))
+      (let ((bufs nnfolder-buffer-alist))
+       (save-excursion
+         (while bufs
+           (if (not (buffer-name (nth 1 (car bufs))))
+               (setq nnfolder-buffer-alist 
+                     (delq (car bufs) nnfolder-buffer-alist))
+             (set-buffer (nth 1 (car bufs)))
+             (and (buffer-modified-p) (save-buffer)))
+           (setq bufs (cdr bufs)))))
+      (while incomings
+       ;; The following has been commented away, just to make sure
+       ;; that nobody ever loses any mail. If you feel safe that
+       ;; nnfolder will never do anything strange, just remove those
+       ;; two semicolons, and avoid having lots of "Incoming*"
+       ;; files. 
+       ;; (and (file-writable-p incoming) (delete-file incoming))
+       (setq incomings (cdr incomings))))))
 
 (provide 'nnfolder)
 
index 7b5a1c9..9f20711 100644 (file)
@@ -31,6 +31,7 @@
 (require 'nntp)
 (require 'nnheader)
 (require 'gnus)
+(require 'gnus-score)
 
 (defvar nnkiboze-directory 
   (expand-file-name (or gnus-article-save-directory "~/News/"))
@@ -62,7 +63,7 @@
            (set-buffer nntp-server-buffer)
            (erase-buffer)
            (insert-file-contents nov)
-           (goto-char 1)
+           (goto-char (point-min))
            (while (and (not (eobp)) (< first (read (current-buffer))))
              (forward-line 1))
            (beginning-of-line)
index 164090f..7b766af 100644 (file)
@@ -333,7 +333,7 @@ nn*-request-list should have been called before calling this function."
     ;; Go through all groups from the active list.
     (save-excursion
       (set-buffer nntp-server-buffer)
-      (goto-char 1)
+      (goto-char (point-min))
       (while (re-search-forward 
              "^\\([^ \t]+\\)[ \t]+\\([0-9]+\\)[ \t]+\\([0-9]+\\)" nil t)
        (setq group-assoc
@@ -375,13 +375,13 @@ nn*-request-list should have been called before calling this function."
   "Go through the entire INCOMING file and pick out each individual mail.
 FUNC will be called with the buffer narrowed to each mail."
   (let ((delim (concat "^" rmail-unix-mail-delimiter))
-       start)
+       start end)
     (save-excursion
       (set-buffer (get-buffer-create " *nnmail incoming*"))
       (buffer-disable-undo (current-buffer))
       (erase-buffer)
       (insert-file-contents incoming)
-      (goto-char 1)
+      (goto-char (point-min))
       (save-excursion (run-hooks 'nnmail-prepare-incoming-hook))
       ;; Go to the beginning of the first mail...
       (if (and (re-search-forward delim nil t)
@@ -392,6 +392,8 @@ FUNC will be called with the buffer narrowed to each mail."
            ;; Skip all the headers in case there are more "From "s...
            (if (not (search-forward "\n\n" nil t))
                (forward-line 1))
+           ;; Go to the beginning of the next article - or to the end
+           ;; of the buffer.  
            (if (re-search-forward delim nil t)
                (goto-char (match-beginning 0))
              (goto-char (point-max)))
@@ -399,7 +401,9 @@ FUNC will be called with the buffer narrowed to each mail."
              (save-restriction
                (narrow-to-region start (point))
                (goto-char (point-min))
-               (funcall func)))))
+               (funcall func)
+               (setq end (point-max))))
+           (goto-char end)))
       (if dont-kill
          (current-buffer)
        (kill-buffer (current-buffer))))))
index 839c376..86d1ee1 100644 (file)
@@ -86,7 +86,7 @@
        (setq art-string (nnmbox-article-string article))
        (set-buffer nnmbox-mbox-buffer)
        (if (or (search-forward art-string nil t)
-               (progn (goto-char 1)
+               (progn (goto-char (point-min))
                       (search-forward art-string nil t)))
            (progn
              (setq start 
           (message "nnmbox: Receiving headers... done"))
 
       ;; Fold continuation lines.
-      (goto-char 1)
+      (goto-char (point-min))
       (while (re-search-forward "\\(\r?\n[ \t]+\\)+" nil t)
        (replace-match " " t t))
       'headers)))
       nil
     (save-excursion
       (set-buffer nnmbox-mbox-buffer)
-      (goto-char 1)
+      (goto-char (point-min))
       (if (search-forward (nnmbox-article-string article) nil t)
          (let (start stop)
            (re-search-backward (concat "^" rmail-unix-mail-delimiter) nil t)
     (save-excursion 
       (set-buffer nnmbox-mbox-buffer)
       (while articles
-       (goto-char 1)
+       (goto-char (point-min))
        (if (search-forward (nnmbox-article-string (car articles)) nil t)
            (if (or force
                    (> (nnmail-days-between 
        result)
      (save-excursion
        (set-buffer nnmbox-mbox-buffer)
-       (goto-char 1)
+       (goto-char (point-min))
        (if (search-forward (nnmbox-article-string article) nil t)
           (nnmbox-delete-mail))
        (and last (save-buffer))))
   (nnmbox-possibly-change-newsgroup group)
   (save-excursion
     (set-buffer nnmbox-mbox-buffer)
-    (goto-char 1)
+    (goto-char (point-min))
     (if (not (search-forward (nnmbox-article-string article) nil t))
        nil
       (nnmbox-delete-mail t t)
          (goto-char end))))))
 
 (defun nnmbox-get-new-mail ()
-  (let (incoming)
+  "Read new incoming mail."
+  (let ((spools (if (listp nnmail-spool-file) nnmail-spool-file
+                 (list nnmail-spool-file)))
+       incoming incomings)
     (nnmbox-read-mbox)
-    (if (and nnmail-spool-file nnmbox-get-new-mail
-            (file-exists-p nnmail-spool-file)
-            (> (nth 7 (file-attributes nnmail-spool-file)) 0))
-       (progn
-         (and gnus-verbose-backends
-              (message "nnmbox: Reading incoming mail..."))
-         (setq incoming 
-               (nnmail-move-inbox nnmail-spool-file
-                                  (concat nnmbox-mbox-file "-Incoming")))
-         (save-excursion
-           (let ((in-buf (nnmail-split-incoming 
-                          incoming 'nnmbox-save-mail t)))
-             (set-buffer nnmbox-mbox-buffer)
-             (goto-char (point-max))
-             (insert-buffer-substring in-buf)
-             (kill-buffer in-buf)))
-         (run-hooks 'nnmail-read-incoming-hook)
-         (and gnus-verbose-backends
-              (message "nnmbox: Reading incoming mail...done"))))
-    (and (buffer-modified-p nnmbox-mbox-buffer) 
-        (save-excursion
-          (nnmail-save-active nnmbox-group-alist nnmbox-active-file)
-          (set-buffer nnmbox-mbox-buffer)
-          (save-buffer)))
-;    (if incoming
-;      (delete-file incoming))
-    ))
+    (if (or (not nnmbox-get-new-mail) (not nnmail-spool-file))
+       ()
+      ;; We go through all the existing spool files and split the
+      ;; mail from each.
+      (while spools
+       (and
+        (file-exists-p (car spools))
+        (> (nth 7 (file-attributes (car spools))) 0)
+        (progn
+          (and gnus-verbose-backends 
+               (message "nnmbox: Reading incoming mail..."))
+          (setq incoming 
+                (nnmail-move-inbox 
+                 (car spools) (concat nnmbox-mbox-file "-Incoming")))
+          (save-excursion
+            (let ((in-buf (nnmail-split-incoming 
+                           incoming 'nnmbox-save-mail t)))
+              (set-buffer nnmbox-mbox-buffer)
+              (goto-char (point-max))
+              (insert-buffer-substring in-buf)
+              (kill-buffer in-buf)))))
+       (setq spools (cdr spools)))
+      ;; If we did indeed read any incoming spools, we save all info. 
+      (and (buffer-modified-p nnmbox-mbox-buffer) 
+          (save-excursion
+            (nnmail-save-active nnmbox-group-alist nnmbox-active-file)
+            (set-buffer nnmbox-mbox-buffer)
+            (save-buffer)))
+      (while incomings
+       ;; The following has been commented away, just to make sure
+       ;; that nobody ever loses any mail. If you feel safe that
+       ;; nnfolder will never do anything strange, just remove those
+       ;; two semicolons, and avoid having lots of "Incoming*"
+       ;; files. 
+       ;; (and (file-writable-p incoming) (delete-file incoming))
+       (setq incomings (cdr incomings))))))
+
 
 (provide 'nnmbox)
 
index 420c4b0..e5e3394 100644 (file)
           (message "nnmh: Receiving headers... done"))
 
       ;; Fold continuation lines.
-      (goto-char 1)
+      (goto-char (point-min))
       (while (re-search-forward "\\(\r?\n[ \t]+\\)+" nil t)
        (replace-match " " t t))
       'headers)))
   (setq dir (expand-file-name dir))
   ;; Recurse down all directories.
   (let ((dirs (and (file-readable-p dir)
+                  (> (nth 1 (file-attributes (file-chase-links dir))) 2)
                   (directory-files dir t nil t))))
     (while dirs 
       (if (and (not (string-match "/\\.\\.$" (car dirs)))
 
 (defun nnmh-get-new-mail ()
   "Read new incoming mail."
-  (let (incoming)
-    (if (and nnmh-get-new-mail nnmail-spool-file
-            (file-exists-p nnmail-spool-file)
-            (> (nth 7 (file-attributes nnmail-spool-file)) 0))
-       (progn
-         (message "nnmh: Reading incoming mail...")
-         (setq incoming 
-               (nnmail-move-inbox nnmail-spool-file
-                                  (concat nnmh-directory "Incoming")))
-         (nnmh-request-list)
-         (setq nnmh-group-alist (nnmail-get-active))
-         (nnmail-split-incoming incoming 'nnmh-save-mail)
-         (run-hooks 'nnmail-read-incoming-hook)
-;;         (delete-file incoming)
-         (message "nnmh: Reading incoming mail...done")))))
+  (let ((spools (if (listp nnmail-spool-file) nnmail-spool-file
+                 (list nnmail-spool-file)))
+       incoming incomings)
+    (if (or (not nnmh-get-new-mail) (not nnmail-spool-file))
+       ()
+      ;; We first activate all the groups.
+      (nnmh-request-list)
+      (setq nnmh-group-alist (nnmail-get-active))
+      ;; The we go through all the existing spool files and split the
+      ;; mail from each.
+      (while spools
+       (and
+        (file-exists-p (car spools))
+        (> (nth 7 (file-attributes (car spools))) 0)
+        (progn
+          (and gnus-verbose-backends 
+               (message "nnmh: Reading incoming mail..."))
+          (setq incoming 
+                (nnmail-move-inbox 
+                 (car spools) (concat nnmh-directory "Incoming")))
+          (setq incomings (cons incoming incomings))
+          (nnmail-split-incoming incoming 'nnmh-save-mail)))
+       (setq spools (cdr spools)))
+      ;; If we did indeed read any incoming spools, we save all info. 
+      (if incoming 
+         (message "nnmh: Reading incoming mail...done"))
+      (while incomings
+       ;; The following has been commented away, just to make sure
+       ;; that nobody ever loses any mail. If you feel safe that
+       ;; nnfolder will never do anything strange, just remove those
+       ;; two semicolons, and avoid having lots of "Incoming*"
+       ;; files. 
+       ;; (and (file-writable-p incoming) (delete-file incoming))
+       (setq incomings (cdr incomings))))))
+      
 
 (defun nnmh-update-gnus-unreads (group)
   ;; Go through the .nnmh-articles file and compare with the actual
index 7c914a4..b4c98bf 100644 (file)
@@ -133,7 +133,7 @@ all. This may very well take some time.")
             (message "nnml: Receiving headers... done"))
 
        ;; Fold continuation lines.
-       (goto-char 1)
+       (goto-char (point-min))
        (while (re-search-forward "\\(\r?\n[ \t]+\\)+" nil t)
          (replace-match " " t t))
        'headers))))
@@ -386,7 +386,7 @@ all. This may very well take some time.")
            (set-buffer nntp-server-buffer)
            (erase-buffer)
            (insert-file-contents nov)
-           (goto-char 1)
+           (goto-char (point-min))
            (while (and (not (eobp)) (< first (read (current-buffer))))
              (forward-line 1))
            (beginning-of-line)
@@ -472,30 +472,52 @@ all. This may very well take some time.")
 
 (defun nnml-get-new-mail ()
   "Read new incoming mail."
-  (let (incoming)
-    (if (and nnml-get-new-mail nnmail-spool-file
-            (file-exists-p nnmail-spool-file)
-            (> (nth 7 (file-attributes nnmail-spool-file)) 0))
-       (progn
-         (and gnus-verbose-backends 
-              (message "nnml: Reading incoming mail..."))
-         (setq incoming 
-               (nnmail-move-inbox nnmail-spool-file 
-                                  (concat nnml-directory "Incoming")))
-         (nnml-request-list)
-         (setq nnml-group-alist (nnmail-get-active))
-         (nnmail-split-incoming incoming 'nnml-save-mail)
-         (nnmail-save-active nnml-group-alist nnml-active-file)
-         (nnml-save-nov)
-         (run-hooks 'nnmail-read-incoming-hook)
-         ;; The following has been commented away, just to make sure
-         ;; that nobody ever loses any mail. If you feel safe that
-         ;; nnml will never do anything strange, just remove those
-         ;; two semicolons, and avoid having lots of "Incoming*"
-         ;; files. 
-;;         (delete-file incoming)
-         (and gnus-verbose-backends
-              (message "nnml: Reading incoming mail...done"))))))
+  (let ((spools (if (listp nnmail-spool-file) nnmail-spool-file
+                 (list nnmail-spool-file)))
+       incoming incomings)
+    (if (or (not nnml-get-new-mail) (not nnmail-spool-file))
+       ()
+      ;; We first activate all the groups.
+      (nnml-request-list)
+      (setq nnml-group-alist (nnmail-get-active))
+      ;; The we go through all the existing spool files and split the
+      ;; mail from each.
+      (while spools
+       (and
+        (file-exists-p (car spools))
+        (> (nth 7 (file-attributes (car spools))) 0)
+        (progn
+          (and gnus-verbose-backends 
+               (message "nnml: Reading incoming mail..."))
+          (setq incoming 
+                (nnmail-move-inbox 
+                 (car spools) (concat nnml-directory "Incoming")))
+          (nnmail-split-incoming incoming 'nnml-save-mail)
+          (setq incomings (cons incoming incomings))
+          ;; The following has been commented away, just to make sure
+          ;; that nobody ever loses any mail. If you feel safe that
+          ;; nnml will never do anything strange, just remove those
+          ;; two semicolons, and avoid having lots of "Incoming*"
+          ;; files. 
+          ;; (delete-file incoming)
+          ))
+       (setq spools (cdr spools)))
+      ;; If we did indeed read any incoming spools, we save all info. 
+      (if incoming 
+         (progn
+           (nnmail-save-active nnml-group-alist nnml-active-file)
+           (nnml-save-nov)
+           (run-hooks 'nnmail-read-incoming-hook)
+           (and gnus-verbose-backends
+                (message "nnml: Reading incoming mail...done"))))
+      (while incomings
+       ;; The following has been commented away, just to make sure
+       ;; that nobody ever loses any mail. If you feel safe that
+       ;; nnfolder will never do anything strange, just remove those
+       ;; two semicolons, and avoid having lots of "Incoming*"
+       ;; files. 
+       ;; (and (file-writable-p incoming) (delete-file incoming))
+       (setq incomings (cdr incomings))))))
 
 
 (defun nnml-add-nov (group article line)
@@ -640,7 +662,7 @@ all. This may very well take some time.")
          (while files
            (erase-buffer)
            (insert-file-contents (concat dir "/" (int-to-string (car files))))
-           (goto-char 1)
+           (goto-char (point-min))
            (narrow-to-region 1 (save-excursion (search-forward "\n\n" nil t)
                                                (setq chars (- (point-max) 
                                                               (point)))
@@ -664,7 +686,7 @@ all. This may very well take some time.")
 (defun nnml-nov-delete-article (group article)
   (save-excursion
     (set-buffer (nnml-open-nov group))
-    (goto-char 1)
+    (goto-char (point-min))
     (if (re-search-forward (concat "^" (int-to-string article) "\t") nil t)
        (delete-region (match-beginning 0) (progn (forward-line 1) (point))))
     t))
index 8a2c929..7f9b686 100644 (file)
@@ -32,7 +32,7 @@
 (defvar nnspool-inews-program news-inews-program
   "Program to post news.")
 
-(defvar nnspool-inews-switches '("-h")
+(defvar nnspool-inews-switches '("-S" "-h")
   "Switches for nnspool-request-post to pass to `inews' for posting news.")
 
 (defvar nnspool-spool-directory news-path
@@ -152,7 +152,7 @@ Newsgroup must be selected before calling this function."
          (and do-message (message "NNSPOOL: Receiving headers... done"))
          
          ;; Fold continuation lines.
-         (goto-char 1)
+         (goto-char (point-min))
          (while (re-search-forward "\\(\r?\n[ \t]+\\)+" nil t)
            (replace-match " " t t))
          'headers)))))
index 2af1f44..d0a1df7 100644 (file)
@@ -33,7 +33,9 @@
   (autoload 'news-setup "rnewspost")
   (autoload 'news-reply-mode "rnewspost")
   (autoload 'nnmail-request-post-buffer "nnmail")
-  (autoload 'cancel-timer "timer"))
+  (autoload 'cancel-timer "timer")
+  (autoload 'telnet "telnet")
+  (autoload 'telnet-send-input "telnet"))
 
 (defvar nntp-server-hook nil
   "*Hooks for the NNTP server.
@@ -179,6 +181,7 @@ instead call function `nntp-status-message' to get status message.")
    (list 'nntp-connection-timeout nntp-connection-timeout)
    (list 'nntp-news-default-headers nntp-news-default-headers)
    (list 'nntp-prepare-server-hook nntp-prepare-server-hook) 
+   (list 'nntp-async-number nntp-async-number)
    '(nntp-async-process nil)
    '(nntp-async-buffer nil)
    '(nntp-async-articles nil)
@@ -241,7 +244,7 @@ instead call function `nntp-status-message' to get status message.")
        (if (looking-at "^[23]")
            (while (progn
                     (goto-char (- (point-max) 3))
-                    (not (looking-at "^\\.\r$")))
+                    (not (looking-at "^\\.\r?$")))
              (nntp-accept-response)))
        (and (numberp nntp-large-newsgroup)
             (> number nntp-large-newsgroup)
@@ -299,7 +302,7 @@ instead call function `nntp-status-message' to get status message.")
              (if (looking-at "^[23]")
                  (while (progn
                           (goto-char (- (point-max) 3))
-                          (not (looking-at "^\\.\r$")))
+                          (not (looking-at "^\\.\r?$")))
                    (nntp-accept-response)))))
 
        ;; Now all replies are received. We remove CRs.
@@ -449,7 +452,7 @@ instead call function `nntp-status-message' to get status message.")
                  (art (or (and (numberp id) (int-to-string id)) id)))
              ;; If NEmacs, end of message may look like: "\256\215" (".^M")
              (prog1
-                 (nntp-send-command "^\\.\r$" "ARTICLE" art)
+                 (nntp-send-command "^\\.\r?$" "ARTICLE" art)
                (nntp-decode-text)
                (and nntp-async-articles (nntp-async-fetch-articles id)))))
        (if buffer (set-process-buffer 
@@ -461,7 +464,7 @@ instead call function `nntp-status-message' to get status message.")
   (prog1
       ;; If NEmacs, end of message may look like: "\256\215" (".^M")
       (nntp-send-command
-       "^\\.\r$" "BODY" (or (and (numberp id) (int-to-string id)) id))
+       "^\\.\r?$" "BODY" (or (and (numberp id) (int-to-string id)) id))
     (nntp-decode-text)))
 
 (defun nntp-request-head (id &optional newsgroup server)
@@ -469,43 +472,49 @@ instead call function `nntp-status-message' to get status message.")
   (nntp-possibly-change-server newsgroup server)
   (prog1
       (nntp-send-command 
-       "^\\.\r$" "HEAD" (or (and (numberp id) (int-to-string id)) id))
+       "^\\.\r?$" "HEAD" (or (and (numberp id) (int-to-string id)) id))
     (nntp-decode-text)))
 
 (defun nntp-request-stat (id &optional newsgroup server)
   "Request STAT of article ID (message-id or number)."
   (nntp-possibly-change-server newsgroup server)
   (nntp-send-command 
-   "^[23].*\r$" "STAT" (or (and (numberp id) (int-to-string id)) id)))
+   "^[23].*\r?$" "STAT" (or (and (numberp id) (int-to-string id)) id)))
 
 (defun nntp-request-group (group &optional server dont-check)
   "Select GROUP."
-  (nntp-send-command "^.*\r$" "GROUP" group)
+  (nntp-send-command "^.*\r?$" "GROUP" group)
   (save-excursion
     (set-buffer nntp-server-buffer)
     (goto-char (point-min))
     (looking-at "[23]")))
 
 (defun nntp-request-asynchronous (group &optional server articles)
-  (or (nntp-async-server-opened)
-      (nntp-async-open-server)
-      (error "Can't open second connection to %s" nntp-address))
-  (setq nntp-async-articles articles)
-  (setq nntp-async-fetched nil)
-  (save-excursion
-    (set-buffer nntp-async-buffer)
-    (erase-buffer))
-  (nntp-async-send-strings "GROUP" group)
-  t)
+  (and 
+   nntp-async-number
+   (if (not (or (nntp-async-server-opened)
+               (nntp-async-open-server)))
+       (progn
+        (message "Can't open second connection to %s" nntp-address)
+        (ding)
+        (setq nntp-async-articles nil)
+        (sit-for 2))
+     (setq nntp-async-articles articles)
+     (setq nntp-async-fetched nil)
+     (save-excursion
+       (set-buffer nntp-async-buffer)
+       (erase-buffer))
+     (nntp-async-send-strings "GROUP" group)
+     t)))
 
 (defun nntp-list-active-group (group &optional server)
-  (nntp-send-command "^.*\r$" "LIST ACTIVE" group))
+  (nntp-send-command "^.*\r?$" "LIST ACTIVE" group))
 
 (defun nntp-request-group-description (group &optional server)
   "Get description of GROUP."
   (if (nntp-possibly-change-server nil server)
       (prog1
-         (nntp-send-command "^.*\r$" "XGTITLE" group)
+         (nntp-send-command "^.*\r?$" "XGTITLE" group)
        (nntp-decode-text))))
 
 (defun nntp-close-group (group &optional server)
@@ -515,14 +524,14 @@ instead call function `nntp-status-message' to get status message.")
   "List active groups."
   (nntp-possibly-change-server nil server)
   (prog1
-      (nntp-send-command "^\\.\r$" "LIST")
+      (nntp-send-command "^\\.\r?$" "LIST")
     (nntp-decode-text)))
 
 (defun nntp-request-list-newsgroups (&optional server)
   "List groups."
   (nntp-possibly-change-server nil server)
   (prog1
-      (nntp-send-command "^\\.\r$" "LIST NEWSGROUPS")
+      (nntp-send-command "^\\.\r?$" "LIST NEWSGROUPS")
     (nntp-decode-text)))
 
 (defun nntp-request-newgroups (date &optional server)
@@ -536,30 +545,30 @@ instead call function `nntp-status-message' to get status message.")
                  (substring 
                   (aref date 3) 3 5) (substring (aref date 3) 6 8))))
     (prog1
-       (nntp-send-command "^\\.\r$" "NEWGROUPS" time-string)
+       (nntp-send-command "^\\.\r?$" "NEWGROUPS" time-string)
       (nntp-decode-text))))
 
 (defun nntp-request-list-distributions (&optional server)
   "List distributions."
   (nntp-possibly-change-server nil server)
   (prog1
-      (nntp-send-command "^\\.\r$" "LIST DISTRIBUTIONS")
+      (nntp-send-command "^\\.\r?$" "LIST DISTRIBUTIONS")
     (nntp-decode-text)))
 
 (defun nntp-request-last (&optional newsgroup server)
   "Decrease the current article pointer."
   (nntp-possibly-change-server newsgroup server)
-  (nntp-send-command "^[23].*\r$" "LAST"))
+  (nntp-send-command "^[23].*\r?$" "LAST"))
 
 (defun nntp-request-next (&optional newsgroup server)
   "Advance the current article pointer."
   (nntp-possibly-change-server newsgroup server)
-  (nntp-send-command "^[23].*\r$" "NEXT"))
+  (nntp-send-command "^[23].*\r?$" "NEXT"))
 
 (defun nntp-request-post (&optional server)
   "Post the current buffer."
   (nntp-possibly-change-server nil server)
-  (if (nntp-send-command "^[23].*\r$" "POST")
+  (if (nntp-send-command "^[23].*\r?$" "POST")
       (progn
        (nntp-encode-text)
        (nntp-send-region-to-server (point-min) (point-max))
@@ -661,14 +670,14 @@ post to this group instead.  If RESPECT-POSTER, heed the special
 This function is supposed to be called from `nntp-server-opened-hook'.
 It will make innd servers spawn an nnrpd process to allow actual article
 reading."
-  (nntp-send-command "^.*\r$" "MODE READER"))
+  (nntp-send-command "^.*\r?$" "MODE READER"))
 
 (defun nntp-send-authinfo ()
   "Send the AUTHINFO to the nntp server.
 This function is supposed to be called from `nntp-server-opened-hook'.
 It will prompt for a password."
-  (nntp-send-command "^.*\r$" "AUTHINFO USER" (user-login-name))
-  (nntp-send-command "^.*\r$" "AUTHINFO PASS" (read-string "NNTP password: ")))
+  (nntp-send-command "^.*\r?$" "AUTHINFO USER" (user-login-name))
+  (nntp-send-command "^.*\r?$" "AUTHINFO PASS" (read-string "NNTP password: ")))
 
 (defun nntp-default-sentinel (proc status)
   "Default sentinel function for NNTP server process."
@@ -766,7 +775,7 @@ It will prompt for a password."
        (nntp-wait-for-response response)
       t)))
 
-(defun nntp-wait-for-response (regexp)
+(defun nntp-wait-for-response (regexp &optional slow)
   "Wait for server response which matches REGEXP."
   (save-excursion
     (let ((status t)
@@ -786,12 +795,23 @@ It will prompt for a password."
       (nntp-accept-response)
       (while wait
        (goto-char (point-min))
-       (cond ((looking-at "[23]")
-              (setq wait nil))
-             ((looking-at "[45]")
-              (setq status nil)
-              (setq wait nil))
-             (t (nntp-accept-response))))
+       (if slow
+           (progn
+             (cond ((re-search-forward "^[23][0-9][0-9]" nil t)
+                    (setq wait nil))
+                   ((re-search-forward "^[45][0-9][0-9]" nil t)
+                    (setq status nil)
+                    (setq wait nil))
+                   (t (nntp-accept-response)))
+             (if (not wait) (delete-region (point-min) 
+                                           (progn (beginning-of-line)
+                                                  (point)))))
+         (cond ((looking-at "[23]")
+                (setq wait nil))
+               ((looking-at "[45]")
+                (setq status nil)
+                (setq wait nil))
+               (t (nntp-accept-response)))))
       ;; Save status message.
       (end-of-line)
       (setq nntp-status-string
@@ -833,13 +853,13 @@ It will prompt for a password."
                         (nntp-last-element sequence))))
       (prog1
          (if (stringp nntp-server-xover)
-             (nntp-send-command "^\\.\r$" nntp-server-xover range)
+             (nntp-send-command "^\\.\r?$" nntp-server-xover range)
            (let ((commands nntp-xover-commands))
              (while (and commands (eq nntp-server-xover 'try))
-               (nntp-send-command "^\\.\r$" (car commands) range)
+               (nntp-send-command "^\\.\r?$" (car commands) range)
                (save-excursion
                  (set-buffer nntp-server-buffer)
-                 (goto-char 1)
+                 (goto-char (point-min))
                  (if (looking-at "[23]") 
                      (setq nntp-server-xover (car commands))))
                (setq commands (cdr commands)))
@@ -910,7 +930,7 @@ If SERVICE, this this as the port number."
           (setq nntp-address server)
           (setq status
                 (condition-case nil
-                    (nntp-wait-for-response "^[23].*\r$")
+                    (nntp-wait-for-response "^[23].*\r?$" 'slow)
                   (error nil)
                   (quit nil)))
           (or status (nntp-close-server-internal server))
@@ -961,6 +981,24 @@ If SERVICE, this this as the port number."
                                         " "))
     (process-send-string proc "\n")))
 
+(defun nntp-telnet-to-machine
+  (let (b)
+    (telnet "localhost")
+    (goto-char (point-min))
+    (while (not (re-search-forward "^login: *" nil t))
+      (sit-for 1)
+      (goto-char (point-min)))
+    (goto-char (point-max))
+    (insert "larsi")
+    (telnet-send-input)
+    (setq b (point))
+    (while (not (re-search-forward ">" nil t))
+      (sit-for 1)
+      (goto-char b))
+    (goto-char (point-max))
+    (insert "ls")
+    (telnet-send-input)))
+
 (defun nntp-close-server-internal (&optional server)
   "Close connection to news server."
   (nntp-possibly-change-server nil server)
@@ -1035,8 +1073,10 @@ defining this function as macro."
   (let ((nntp-server-process nil)
        (nntp-server-buffer nntp-async-buffer))
     (nntp-open-server-semi-internal nntp-address nntp-port-number)
-    (setq nntp-async-process nntp-server-process)
-    (set-process-buffer nntp-async-process nntp-async-buffer)))
+    (if (not (setq nntp-async-process nntp-server-process))
+       (progn
+         (setq nntp-async-number nil))
+      (set-process-buffer nntp-async-process nntp-async-buffer))))
 
 (defun nntp-async-fetch-articles (article)
   (if (stringp article)
index 60ea3b1..fdafafe 100644 (file)
@@ -1,7 +1,7 @@
 \input texinfo                  @c -*-texinfo-*-
 @comment %**start of header (This is for running Texinfo on a region.)
 @setfilename gnus
-@settitle Gnus 0.54 Manual
+@settitle Gnus 0.70 Manual
 @synindex fn cp
 @synindex vr cp
 @synindex pg cp
@@ -788,6 +788,7 @@ long as Gnus is active.
 * Selecting a Group::      Actually reading news.
 * Group Subscribing::      Unsubscribing, killing, subscribing.
 * Group Levels::           Levels? What are those, then?
+* Marking Groups::         You can mark groups for later processing.
 * Foreign Groups::         How to create foreign groups.
 * Group Parameters::       Each group may have different parameters set.
 * Listing Groups::         Gnus can list various subsets of the groups.
@@ -964,6 +965,11 @@ Jump to the first group with unread articles
 (@code{gnus-group-first-unread-group}).  
 @end table
 
+@vindex gnus-group-goto-unread
+If @code{gnus-group-goto-unread} is @code{nil}, all the movement
+commands will move to the next group, not the next unread group.  Even
+the commands that say they move to the next unread group. 
+
 @node Selecting a Group
 @section Selecting a Group
 @cindex group selection
@@ -1152,6 +1158,39 @@ All groups with a level less than or equal to
 @code{gnus-group-default-list-level} will be listed in the group buffer
 by default.
 
+@node Marking Groups
+@section Marking Groups
+@cindex marking groups
+
+If you want to perform some action on several groups, and they appear
+subsequently in the group buffer, you would normally just give a
+numerical prefix to the command.  Most group commands will then do your
+bidding on those groups.
+
+However, if the groups are not in sequential order, you can still
+perform an action on several groups.  You simply mark the groups first,
+and then execute the command.  
+
+@table @kbd
+@item #
+@kindex # (Group)
+@item G m
+@kindex G m (Group)
+@findex gnus-group-mark-group
+Set the mark on the current group (@code{gnus-group-mark-group}). 
+@item M-#
+@kindex M-# (Group)
+@item G u
+@kindex G u (Group)
+@findex gnus-group-unmark-group
+Remove the mark from the current group
+(@code{gnus-group-unmark-group}). 
+@item G w
+@kindex G w (Group)
+@findex gnus-group-mark-region
+Mark all groups between point and mark (@code{gnus-group-mark-region}). 
+@end table
+
 @node Foreign Groups
 @section Foreign Groups
 @cindex foreign groups
@@ -1163,10 +1202,10 @@ personal mail group.
 
 A foreign group (or any group, really) is specified by a @dfn{name} and
 a @dfn{select method}.  To take the latter first, a select method is a
-list where the first element says what backend to use (eg. nntp,
-nnspool, nnml) and the second element is the @dfn{server name}.  There
-may be additional elements in the select method, where the value may
-have special meaning for the backend in question.
+list where the first element says what backend to use (eg. @code{nntp},
+@code{nnspool}, @code{nnml}) and the second element is the @dfn{server
+name}.  There may be additional elements in the select method, where the
+value may have special meaning for the backend in question.
 
 One could say that a select method defines a @dfn{virtual server} - so
 we do just that (@pxref{The Server Buffer}).
@@ -1184,49 +1223,54 @@ Here are some commands for making and editing general foreign groups,
 and some commands to ease the creation of some special-purpose groups:
 
 @table @kbd
-@item M m
-@kindex M m (Group)
+@item G m
+@kindex G m (Group)
 @findex gnus-group-make-group
 Make a new group (@code{gnus-group-make-group}).  Gnus will prompt you
 for a name, a method and possibly an @dfn{address}.  For an easier way
 to subscribe to @sc{nntp} groups, @xref{Browse Foreign Server}.
-@item M e
-@kindex M e (Group)
+@item G e
+@kindex G e (Group)
 @findex gnus-group-edit-group-method
 Enter a buffer where you can edit the select method of the current
 group (@code{gnus-group-edit-group-method}).
-@item M p
-@kindex M p (Group)
+@item G p
+@kindex G p (Group)
 @findex gnus-group-edit-group-parameters
 Enter a buffer where you can edit the group parameters
 (@code{gnus-group-edit-group-parameters}). 
-@item M E
-@kindex M E (Group)
+@item G E
+@kindex G E (Group)
 @findex gnus-group-edit-group
 Enter a buffer where you can edit the group info
 (@code{gnus-group-edit-group}).
-@item M d
-@kindex M d (Group)
+@item G d
+@kindex G d (Group)
 @findex gnus-group-make-directory-group
 Make a directory group.  You will be prompted for a directory name
 (@code{gnus-group-make-directory-group}).  
-@item M h 
-@kindex M h (Group)
+@item G h 
+@kindex G h (Group)
 @findex gnus-group-make-help-group
 Make the (ding) Gnus help group (@code{gnus-group-make-help-group}).
-@item M a
-@kindex M a (Group)
+@item G a
+@kindex G a (Group)
 @findex gnus-group-make-archive-group
 @vindex gnus-group-archive-directory
 Make the (ding) Gnus archive group
 (@code{gnus-group-make-archive-group}).  The archive group will be
 fetched from @code{gnus-group-archive-directory}.
-@item M k
-@kindex M k (Group)
+@item G k
+@kindex G k (Group)
 @findex gnus-group-make-kiboze-group
 Make a kiboze group.  You will be prompted for a name, for a regexp to
 match groups to be "included" in the kiboze group, and a series of
 strings to match on headers (@code{gnus-group-make-kiboze-group}).
+@item G v
+@kindex G v (Group)
+@findex gnus-group-add-to-virtual
+Add the current group to an @code{nnvirtual} group
+(@code{gnus-group-add-to-virtual}).  Uses the process/prefix convention.
 @end table
 
 The different methods all have their peculiarities, of course.
@@ -1723,7 +1767,7 @@ The folders are located in @code{nnfolder-directory}, say,
 @file{~/Mail/}.  There are three folders, @file{foo}, @file{bar} and
 @file{mail.baz}.
 
-Go to the group buffer and type @kbd{M m}.  When prompted, answer
+Go to the group buffer and type @kbd{G m}.  When prompted, answer
 @samp{foo} for the name and @samp{nnfolder} for the method.  Repeat
 twice for the two other groups, @samp{bar} and @samp{mail.baz}.  Be sure
 to include all your mail groups.
@@ -1800,6 +1844,12 @@ If @code{nnmail-keep-last-article} is non-@code{nil}, Gnus will never
 expire the final article in a mail newsgroup.  This is to make life
 easier for procmail users.
 
+By the way, that line up there about Gnus never expiring non-expirable
+articles is a lies.  If you put @code{total-expire} in the group
+parameters, articles will not be marked as expirable, but all read
+articles will be put through the expiry process.  Use with extreme
+caution. 
+
 @node Not Reading Mail
 @subsubsection Not Reading Mail
 
@@ -1819,8 +1869,8 @@ This might be too much, if, for instance, you are reading mail quite
 happily with @code{nnml} and just want to peek at some old @sc{rmail}
 file you have stashed away with @code{nnbabyl}.  All backends have
 variables called backend-@code{get-new-mail}.  If you want to disable
-the @code{nnbabyl} mail reading, you just set
-@code{nnbabyl-get-new-mail} to @code{nil}. 
+the @code{nnbabyl} mail reading, you edit the virtual server for the
+group to have a setting where @code{nnbabyl-get-new-mail} to @code{nil}.
 
 @node nnmbox
 @subsubsection nnmbox
@@ -1833,6 +1883,8 @@ The @dfn{nnmbox} backend will use the standard Un*x mbox file to store
 mail.  @code{nnmbox} will add extra headers to each mail article to say
 which group it belongs in.
 
+Virtual server settings:
+
 @table @code
 @item nnmbox-mbox-file
 @vindex nnmbox-mbox-file
@@ -1859,6 +1911,8 @@ The @dfn{nnbabyl} backend will use a babyl mail box to store mail.
 @code{nnbabyl} will add extra headers to each mail article to say which
 group it belongs in.
 
+Virtual server settings:
+
 @table @code
 @item nnbabyl-mbox-file
 @vindex nnbabyl-mbox-file
@@ -1904,6 +1958,8 @@ splitting.  It has to create lots of files, and it also generates
 @sc{nov} databases for the incoming mails.  This makes is the fastest
 backend when it comes to reading mail.
 
+Virtual server settings:
+
 @table @code
 @item nnml-directory
 @vindex nnml-directory
@@ -1948,6 +2004,8 @@ might take a while to complete.
 @code{nnmh} a @emph{much} slower backend than @code{nnml}, but it also
 makes it easier to write procmail scripts for.
 
+Virtual server settings:
+
 @table @code
 @item nnmh-directory
 All @code{nnmh} directories will be located under this directory.
@@ -1966,6 +2024,8 @@ file.  Each file is in the standard Un*x mbox format.  @code{nnfolder}
 will add extra headers to keep track of article numbers and arrival
 dates.
 
+Virtual server settings:
+
 @table @code
 @item nnfolder-directory
 All the @code{nnfolder} mail boxes will be stored under this directory. 
@@ -2032,14 +2092,20 @@ IF the group parameter list contains an element like @code{(to-group
 If this symbol is present in the group parameter list, all articles that
 are read will be marked as expirable.  For an alternative approach,
 @xref{Expiring Old Mail Articles}.
+
+@item total-expire
+@cindex total-expire
+If this symbol is present, all read articles will be put through the
+expiry process, even if they are not marked as expirable.  Use with
+caution. 
 @end table
 
 If you want to change the group parameters (or anything else of the
-group info) you can use the @kbd{M E} to edit enter a buffer where you
+group info) you can use the @kbd{G E} to edit enter a buffer where you
 can edit the group info.
 
 You usually don't want to edit the entire group info, so you'd be better
-off using the @kbd{M p} command to just edit the group parameters.
+off using the @kbd{G p} command to just edit the group parameters.
 
 @node Listing Groups
 @section Listing Groups
@@ -2049,8 +2115,8 @@ These commands all list various slices of the groups that are available.
 
 @table @kbd
 @item l
-@itemx G s
-@kindex G s (Group)
+@itemx A s
+@kindex A s (Group)
 @kindex l (Group)
 @findex gnus-group-list-groups
 List all groups that have unread articles
@@ -2058,8 +2124,8 @@ List all groups that have unread articles
 command will list only groups of level ARG and lower.  By default, it
 only lists groups of level five or lower (ie. just subscribed groups).
 @item L
-@itemx G u
-@kindex G u (Group)
+@itemx A u
+@kindex A u (Group)
 @kindex L (Group)
 @findex gnus-group-list-all-groups
 List all groups, whether they have unread articles or not
@@ -2067,21 +2133,21 @@ List all groups, whether they have unread articles or not
 this command will list only groups of level ARG and lower.  By default,
 it lists groups of level seven or lower (ie. just subscribed and
 unsubscribed groups).
-@item G k
-@kindex G k (Group)
+@item A k
+@kindex A k (Group)
 @findex gnus-group-list-killed
 List all killed groups (@code{gnus-group-list-killed}).
-@item G z
-@kindex G z (Group)
+@item A z
+@kindex A z (Group)
 @findex gnus-group-list-zombies
 List all zombie groups (@code{gnus-group-list-zombies}).
-@item G m
-@kindex G m (Group)
+@item A m
+@kindex A m (Group)
 @findex gnus-group-list-matching
 List all subscribed groups with unread articles that match a regexp
 (@code{gnus-group-list-matching}). 
-@item G M
-@kindex G M (Group)
+@item A M
+@kindex A M (Group)
 @findex gnus-group-list-all-matching
 List groups that match a regexp (@code{gnus-group-list-all-matching}).
 @end table
@@ -2224,9 +2290,12 @@ plastic chair.
 @item g
 @kindex g (Group)
 @findex gnus-group-get-new-news
-Check server for new articles. 
-If the numeric prefix is used, this command will check only groups of
-level ARG and lower (@code{gnus-group-get-new-news}).
+@vindex gnus-group-always-list-unread
+Check server for new articles.  If the numeric prefix is used, this
+command will check only groups of level ARG and lower
+(@code{gnus-group-get-new-news}).  If
+@code{gnus-group-always-list-unread} is @code{nil}, only groups of level
+ARG and lower will be displayed.
 @item M-g
 @kindex M-g (Group)
 @findex gnus-group-get-new-news-this-group
@@ -2659,16 +2728,16 @@ be used for marking articles as read.
 This hook is run after selecting an article.  It is meant to be used for
 highlighting the article in some way.  It is not run if
 @code{gnus-visual} is @code{nil}.
-@item gnus-visual-summary-update-hook
-@vindex gnus-visual-summary-update-hook
+@item gnus-summary-update-hook
+@vindex gnus-summary-update-hook
 This hook is called when a summary line is changed.  It is not run if
 @code{gnus-visual} is @code{nil}.
 @item gnus-summary-selected-face
 @vindex gnus-summary-selected-face
 This is the face (or @dfn{font} as some people call it) that is used to
 highlight the current article in the summary buffer.
-@item gnus-visual-summary-highlight
-@vindex gnus-visual-summary-highlight
+@item gnus-summary-highlight
+@vindex gnus-summary-highlight
 Summary lines are highlighted according to this variable, which is a
 list where the elements are on the format @code{(FORM . FACE)}.  If you
 would, for instance, like ticked articles to be italic and high-scored
@@ -2755,7 +2824,8 @@ Mail a reply to the author of the current article
 @kindex S R (Summary)
 @findex gnus-summary-reply-with-original
 Mail a reply to the author of the current article and include the
-original message (@code{gnus-summary-reply-with-original}).
+original message (@code{gnus-summary-reply-with-original}).  This
+command uses the process/prefix convention.
 @item S o m
 @kindex S o m (Summary)
 @findex gnus-summary-mail-forward
@@ -2826,6 +2896,72 @@ the head of the outgoing mail.
 @vindex gnus-mail-send-method
 This variable says how a mail should be mailed.  It uses the function in
 the @code{send-mail-function} variable as the default.
+
+@item gnus-uu-digest-headers
+@vindex gnus-uu-digest-headers
+List of regexps to match headers included in digested messages.  The
+headers will be included in the sequence they are matched.
+
+@end table
+
+There are three "methods" for handling all mail.  The default is
+@code{sendmail}.  Some people like what @code{mh} does better, and some
+people prefer @code{vm}.
+
+Three variables for customizing what to use when:
+
+@table @code
+
+@vindex gnus-mail-reply-method
+@item gnus-mail-reply-method
+This function is used to compose replys.  The three functions avaibale
+are:
+
+@findex gnus-mail-reply-using-vm
+@findex gnus-mail-reply-using-mhe
+@findex gnus-mail-reply-using-mail
+@itemize @bullet
+@item 
+@code{gnus-mail-reply-using-mail} (sendmail)
+@item 
+@code{gnus-mail-reply-using-mhe} (mh)
+@item
+@code{gnus-mail-reply-using-vm} (vm)
+@end itemize
+
+@vindex gnus-mail-forward-method
+@item gnus-mail-forward-method
+This function is used to forward messages.  The three functions avaibale
+are:
+
+@findex gnus-mail-forward-using-vm
+@findex gnus-mail-forward-using-mhe
+@findex gnus-mail-forward-using-mail
+@itemize @bullet
+@item 
+@code{gnus-mail-forward-using-mail} (sendmail)
+@item 
+@code{gnus-mail-forward-using-mhe} (mh)
+@item
+@code{gnus-mail-forward-using-vm} (vm)
+@end itemize
+
+@vindex gnus-mail-other-window-method
+@item gnus-mail-other-window-method
+This function is used to send mails.  The three functions avaibale are:
+
+@findex gnus-mail-other-window-using-vm
+@findex gnus-mail-other-window-using-mhe
+@findex gnus-mail-other-window-using-mail
+@itemize @bullet
+@item 
+@code{gnus-mail-other-window-using-mail} (sendmail)
+@item 
+@code{gnus-mail-other-window-using-mhe} (mh)
+@item
+@code{gnus-mail-other-window-using-vm} (vm)
+@end itemize
+
 @end table
 
 
@@ -2854,7 +2990,8 @@ Post a followup to the current article (@code{gnus-summary-followup}).
 @kindex F (Summary)
 @findex gnus-summary-followup-with-original
 Post a followup to the current article and include the original message
-(@code{gnus-summary-followup-with-original}). 
+(@code{gnus-summary-followup-with-original}).   This command uses the
+process/prefix convention.
 @item S u
 @kindex S u (Summary)
 @findex gnus-uu-post-news
@@ -3028,6 +3165,7 @@ Post a followup and send a reply to the current article
 @findex gnus-summary-followup-and-reply-with-original
 Post a followup and send a reply to the current article and include the
 original message (@code{gnus-summary-followup-and-reply-with-original}).
+This command uses the process/prefix convention.
 @end table
 
 Here's a list of variables that are relevant to both mailing and
@@ -3829,6 +3967,16 @@ all articles, both read and unread.
 Exit the group, check for new articles in the group, and select the
 group (@code{gnus-summary-rescan-group}).  If given a prefix, select all
 articles, both read and unread.
+@item Z N
+@kindex Z N (Summary)
+@findex gnus-summary-next-group
+Exit the group and go to the next group
+(@code{gnus-summary-next-group}). 
+@item Z P
+@kindex Z P (Summary)
+@findex gnus-summary-prev-group
+Exit the group and go to the previous group
+(@code{gnus-summary-prev-group}). 
 @end table
 
 @vindex gnus-exit-group-hook
@@ -3977,6 +4125,10 @@ article in.  The default is @code{gnus-numeric-save-name}.
 @vindex gnus-summary-save-in-folder
 Save the article to an MH folder using @code{rcvstore} from the MH
 library.
+@item gnus-summary-save-in-vm
+@vindex gnus-summary-save-in-vm
+Save the article in a VM folder.  You have to have the VM mail
+reader to use this setting.
 @end table
 
 All of these functions, except for the last one, will save the article
@@ -4441,6 +4593,10 @@ Sort by subject (@code{gnus-summary-sort-by-subject}).
 @kindex V s d (Summary)
 @findex gnus-summary-sort-by-date
 Sort by date (@code{gnus-summary-sort-by-date}).
+@item V s i
+@kindex V s i (Summary)
+@findex gnus-summary-sort-by-score
+Sort by date (@code{gnus-summary-sort-by-score}).
 @end table
 
 These functions will work both when you use threading and when you don't
@@ -4600,6 +4756,11 @@ Increase the current subject temporarily
 @findex gnus-summary-raise-by-subject
 Increase the current subject permanently
 (@code{gnus-summary-raise-by-subject}).
+@item I s i 
+@kindex I s i  (Summary)
+@findex gnus-summary-immediately-raise-by-subject
+Increase the current subject immediately
+(@code{gnus-summary-immediately-raise-by-subject}).
 @item I a t
 @kindex I a t (Summary)
 @findex gnus-summary-temporarily-raise-by-author
@@ -4610,6 +4771,11 @@ Increase the current author temporarily
 @findex gnus-summary-raise-by-author
 Increase the current author permanently
 (@code{gnus-summary-raise-by-author}).
+@item I a i 
+@kindex I a i  (Summary)
+@findex gnus-summary-immediately-raise-by-author
+Increase the current author immediately
+(@code{gnus-summary-immediately-raise-by-author}).
 @item I b t
 @kindex I b t (Summary)
 @findex gnus-summary-temporarily-raise-by-body
@@ -4621,6 +4787,11 @@ operation.
 @findex gnus-summary-raise-by-body
 Increase based on a match on the body of an article
 (@code{gnus-summary-raise-by-body}). This is a very slow operation
+@item I b i 
+@kindex I b i  (Summary)
+@findex gnus-summary-immediately-raise-by-body
+Increase based on a match on the body of an article
+(@code{gnus-summary-immediately-raise-by-body}). This is a very slow operation
 @item I i t
 @kindex I i t (Summary)
 @findex gnus-summary-temporarily-raise-by-id
@@ -4631,6 +4802,11 @@ Increase the current message-id temporarily
 @findex gnus-summary-raise-by-id
 Increase the current message-id permanently
 (@code{gnus-summary-raise-by-id}).
+@item I i i 
+@kindex I i i  (Summary)
+@findex gnus-summary-immediately-raise-by-id
+Increase the current message-id immediately
+(@code{gnus-summary-immediately-raise-by-id}).
 @item I t t
 @kindex I t t (Summary)
 @findex gnus-summary-temporarily-raise-by-thread
@@ -4641,6 +4817,11 @@ Increase the current thread temporarily
 @findex gnus-summary-raise-by-thread
 Increase the current thread permanently
 (@code{gnus-summary-raise-by-thread}).
+@item I t i 
+@kindex I t i  (Summary)
+@findex gnus-summary-immediately-raise-by-thread
+Increase the current thread immediately
+(@code{gnus-summary-immediately-raise-by-thread}).
 @item I x t
 @kindex I x t (Summary)
 @findex gnus-summary-temporarily-raise-by-xref
@@ -4651,6 +4832,11 @@ Increase the current xref temporarily
 @findex gnus-summary-raise-by-xref
 Increase the current xref permanently
 (@code{gnus-summary-raise-by-xref}).
+@item I x i 
+@kindex I x i  (Summary)
+@findex gnus-summary-immediately-raise-by-xref
+Increase the current xref immediately
+(@code{gnus-summary-immediately-raise-by-xref}).
 @item I f t
 @kindex I f t (Summary)
 @findex gnus-summary-temporarily-raise-followups-to-author
@@ -4661,6 +4847,11 @@ Increase followups to the current author temporarily
 @findex gnus-summary-raise-followups-to-author
 Increase followups to the current author permanently
 (@code{gnus-summary-raise-followups-to-author}).
+@item I f i 
+@kindex I f i  (Summary)
+@findex gnus-summary-immediately-raise-followups-to-author
+Increase followups to the current author immediately
+(@code{gnus-summary-immediately-raise-followups-to-author}).
 @end table
 
 Commands for lowering the score:
@@ -4676,6 +4867,11 @@ Lower the current subject temporarily
 @findex gnus-summary-lower-by-subject
 Lower the current subject permanently
 (@code{gnus-summary-lower-by-subject}).
+@item L s i 
+@kindex L s i  (Summary)
+@findex gnus-summary-immediately-lower-by-subject
+Lower the current subject immediately
+(@code{gnus-summary-immediately-lower-by-subject}).
 @item L a t
 @kindex L a t (Summary)
 @findex gnus-summary-temporarily-lower-by-author
@@ -4686,6 +4882,11 @@ Lower the current author temporarily
 @findex gnus-summary-lower-by-author
 Lower the current author permanently
 (@code{gnus-summary-lower-by-author}).
+@item L a i 
+@kindex L a i  (Summary)
+@findex gnus-summary-immediately-lower-by-author
+Lower the current author immediately
+(@code{gnus-summary-immediately-lower-by-author}).
 @item L b t
 @kindex L b t (Summary)
 @findex gnus-summary-temporarily-lower-by-body
@@ -4697,6 +4898,11 @@ operation.
 @findex gnus-summary-lower-by-body
 Lower based on a match on the article body
 (@code{gnus-summary-lower-by-body}).  This is a very slow operation.
+@item L b i 
+@kindex L b i  (Summary)
+@findex gnus-summary-immediately-lower-by-body
+Lower based on a match on the article body
+(@code{gnus-summary-immediately-lower-by-body}).  This is a very slow operation.
 @item L i t
 @kindex L i t (Summary)
 @findex gnus-summary-temporarily-lower-by-id
@@ -4707,6 +4913,11 @@ Lower the current message-id temporarily
 @findex gnus-summary-lower-by-id
 Lower the current message-id permanently
 (@code{gnus-summary-lower-by-id}).
+@item L i i 
+@kindex L i i  (Summary)
+@findex gnus-summary-immediately-lower-by-id
+Lower the current message-id immediately
+(@code{gnus-summary-immediately-lower-by-id}).
 @item L t t
 @kindex L t t (Summary)
 @findex gnus-summary-temporarily-lower-by-thread
@@ -4717,6 +4928,11 @@ Lower the current thread temporarily
 @findex gnus-summary-lower-by-thread
 Lower the current thread permanently
 (@code{gnus-summary-lower-by-thread}).
+@item L t i 
+@kindex L t i  (Summary)
+@findex gnus-summary-immediately-lower-by-thread
+Lower the current thread immediately
+(@code{gnus-summary-immediately-lower-by-thread}).
 @item L x t
 @kindex L x t (Summary)
 @findex gnus-summary-temporarily-lower-by-xref
@@ -4727,6 +4943,11 @@ Lower the current xref temporarily
 @findex gnus-summary-lower-by-xref
 Lower the current xref permanently
 (@code{gnus-summary-lower-by-xref}).
+@item L x i 
+@kindex L x i  (Summary)
+@findex gnus-summary-immediately-lower-by-xref
+Lower the current xref immediately
+(@code{gnus-summary-immediately-lower-by-xref}).
 @item L f t
 @kindex L f t (Summary)
 @findex gnus-summary-temporarily-lower-followups-to-author
@@ -4737,6 +4958,11 @@ Lower followups to the current author temporarily
 @findex gnus-summary-lower-followups-to-author
 Lower followups to the current author permanently
 (@code{gnus-summary-lower-followups-to-author}).
+@item L f i 
+@kindex L f i  (Summary)
+@findex gnus-summary-immediately-lower-followups-to-author
+Lower followups to the current author immediately
+(@code{gnus-summary-immediately-lower-followups-to-author}).
 @end table
 
 @node Score Variables
@@ -4744,6 +4970,10 @@ Lower followups to the current author permanently
 @cindex score variables
 
 @table @code
+@item gnus-use-scoring
+@vindex gnus-use-scoring
+If @code{nil}, Gnus will not check for score files, and will not, in
+general, do any score-related work.
 @item gnus-kill-killed
 @vindex gnus-kill-killed
 If this variable is @code{nil}, Gnus will never apply score files to
@@ -4947,7 +5177,15 @@ parents will get this number added to their scores.
 This entry controls the adaptive scoring.  If it is @code{t}, the
 default adaptive scoring rules will be used.  If it is @code{ignore}, no
 adaptive scoring will be performed on this group.  If it is a list, this
-list will be used as the adaptive scoring rules.
+list will be used as the adaptive scoring rules.  If it isn't present,
+or is something other than @code{t} or @code{ignore}, the default
+adaptive scoring rules will be used.  If you want to use adaptive
+scoring on most groups, you'd set @code{gnus-use-adaptive-scoring} to
+@code{t}, and insert an @code{(adapt ignore)} in the groups where you do
+not want adaptive scoring.  If you only want adaptive scoring in a few
+groups, you'd set @code{gnus-use-adaptive-scoring} to @code{nil}, and
+insert @code{(adapt t)} in the score files of the groups where you want
+it. 
 @end table
 
 @node Score File Editing
@@ -5028,6 +5266,10 @@ You can control what groups the adaptive scoring is to be performed on
 by using the score files (@pxref{Score File Format}).  This will also
 let you use different rules in different groups.
 
+@vindex gnus-adaptive-file-suffix
+The adaptive score entries will be put into a file where the name is the
+group name with @code{gnus-adaptive-file-suffix} appended.
+
 @node Scoring Tips
 @subsection Scoring Tips
 @cindex scoring tips
@@ -5700,6 +5942,7 @@ Here's the method for the public spool:
 @menu
 * Interactive::                Making Gnus ask you many questions.
 * Windows Configuration::      Configuring the Gnus buffer windows.
+* Buttons::                    Get tendonitis in ten easy steps!
 * Various Various::            Things that are really various.
 @end menu
 
@@ -5742,45 +5985,154 @@ No, there's nothing here about X, so be quiet.
 @vindex gnus-use-full-window
 If non-@code{nil}, Gnus will delete all other windows and occupy the
 entire Emacs screen by itself.  It is @code{t} by default.
-@item gnus-window-configuration
-@vindex gnus-window-configuration
-This variable describes how much space each Gnus buffer should be given,
-compared to the other Gnus buffers.  Here's an example:
+
+@item gnus-buffer-configuration
+@vindex gnus-buffer-configuration
+This variable describes how much space each Gnus buffer should be given.
+Here's an excerpt of this variable:
+
+@lisp
+((group ([group 1.0 point] 
+        (if gnus-carpal [group-carpal 4])))
+ (article ([summary 0.25 point] 
+          [article 1.0])))
+@end lisp
+
+This is an alist.  The @dfn{key} is a symbol that names some action or
+other.  For instance, when displaying the group buffer, the window
+configuration function will use @code{group} as the key.  A full list of
+possible names is listed below.
+
+The @dfn{value} is a @dfn{rule} that says how much space each buffer
+should occupy.  To take the @code{article} rule as an example -
+
+@lisp
+(article ([summary 0.25 point] 
+         [article 1.0]))
+@end lisp
+
+This rule says that the summary buffer should occupy 25% of the screen,
+and that it is placed over the article buffer.  As you may have noticed,
+100% + 25% is actually 125% (yup, I saw y'all reaching for that
+calculator there).  However, the special number @code{1.0} is used to
+signal that this buffer should soak up all the rest of the space
+avaiable after the rest of the buffers have taken whatever they need.  
+There should be only one buffer with the @code{1.0} size spec.
+
+Point will be put in the buffer that has the optional third element
+@code{point}. 
+
+Here's a more complicated example:
 
 @lisp
-(setq gnus-window-configuration
-  '((summary (0 1 0))
-    (groups (1 0 0))
-    (article (0 3 10))))
+(article ([group 4]
+          [summary 0.25 point]
+          (if gnus-carpal [summary-carpal 4])
+          [article 1.0])
 @end lisp
 
-This variable is a list of lists, where each of these small lists is on
-the form @var{(action (g s a))}.  As you can see, there are three
-possible @var{action}s - @code{group} (which is what happens when
-you first start Gnus, or returns from the summary buffer),
-@code{summary} (which is what happens when there are no unread articles
-in the group, and @code{article} (which is what happens when there
-is an unread article in the group). 
-
-We see that in the first two actions, the respective buffers will fill
-the screen, and in the last, the article buffer will take ten lines for
-each three the summary buffer gets.
-
-@findex gnus-window-configuration-split
-This variable can also have a function as its value.  In that case,
-whenever Gnus tries to configure the Gnus buffers, that function will be
-called with the @var{action} as its parameter.  There is one pre-made
-function supplied, @code{gnus-window-configuration-split}, which may be
-suitable if you have a very wide Emacs window, and want to have the
-summary buffer and the article buffer side by side.
+If the size spec is an integer instead of a floating point number, 
+then that number will be used to say how many lines a buffer should
+occupy, not a percentage.
+
+If an element is a list instead of a vector, this list will be
+@code{eval}ed.  If the result is non-@code{nil}, it will be used.  This
+means that there will be three buffers if @code{gnus-carpal} is
+@code{nil}, and four buffers if @code{gnus-carpal} is non-@code{nil}. 
+
+Not complicated enough for you?  Well, try this on for size:
+
+@lisp
+(article ([group 1.0]
+          [gnus-carpal 4])
+         ((horizontal 0.5)
+          [summary 0.25 point]
+          [summary-carpal 4]
+          [article 1.0]))
+@end lisp
+
+Whoops.  Two buffers with the mystery 100% tag.  And what's that
+@code{horizontal} thingie?  
+
+If the first element in one of the rule lists is a list with
+@code{horizontal} as the first element, Gnus will split the window
+horizontally, giving you two windows side-by-side.  Inside each of these
+strips you may carry on all you like in the normal fashion.  The number
+following @code{horizontal} says what percentage of the screen is to be
+given to this strip.  
+
+For each horizontal split, there @emph{must} be one element that has the
+100% tag.  The splitting is never accurate, and this buffer will eat any
+leftover lines from the splits. 
+
+Here's a list of all possible keys:
+
+@code{group}, @code{summary}, @code{article}, @code{server},
+@code{browse}, @code{group-mail}, @code{summary-mail},
+@code{summary-reply}, @code{info}, @code{summary-faq},
+@code{edit-group}, @code{edit-server}, @code{reply}, @code{reply-yank},
+@code{followup}, @code{followup-yank}.  
+
+@end table
+
+@node Buttons
+@section Buttons
+@cindex buttons
+@cindex mouse
+@cindex click
+
+Those new-fangled @dfn{mouse} contraptions is very popular with the
+young, hep kids who don't want to learn the proper way to do things
+these days.  Why, I remember way back in the summer of '89, when I was
+using Emacs on a Tops 20 system.  Three hundred users on one single
+machine, and every user was running Simula compilers.  Bah!
+
+Right.
+
+@vindex gnus-carpal
+Well, you can make Gnus display bufferfuls of buttons you can click to
+do anything by setting @code{gnus-carpal} to @code{t}.  Pretty simple,
+really.  Tell the chiropractor I sent you.
+
+
+@table @code
+@item gnus-carpal-mode-hook
+@vindex gnus-carpal-mode-hook
+Hook run in all carpal mode buffers.
+@item gnus-carpal-button-face
+@vindex gnus-carpal-button-face
+Face used on buttons.
+@item gnus-carpal-group-buffer-buttons
+@vindex gnus-carpal-group-buffer-buttons
+Buttons in the group buffer.
+@item gnus-carpal-summary-buffer-buttons
+@vindex gnus-carpal-summary-buffer-buttons
+Buttons in the summary buffer.
+@item gnus-carpal-server-buffer-buttons
+@vindex gnus-carpal-server-buffer-buttons
+Buttons in the server buffer.
+@item gnus-carpal-browse-buffer-buttons
+@vindex gnus-carpal-browse-buffer-buttons
+Buttons in the browse buffer.
 @end table
 
+All the @code{buttons} variables are lists.  The elements in these list
+is either a cons cell where the car contains a text to be displayed and
+the cdr contains a function symbol, or a simple string.
+
 @node Various Various
 @section Various Various
 @cindex mode lines
 @cindex highlights
 
 @table @code
+@item gnus-verbose
+@vindex gnus-verbose
+This variable is an integer between zero and ten.  The higher the value,
+the more messages will be displayed.  If this variable is zero, Gnus
+will never flash any messages, if it is seven, most important messages
+will be shown, and if it is ten, Gnus won't ever shut up, but will flash
+so many messages it will make your head swim.
 @item gnus-updated-mode-lines
 @vindex gnus-updated-mode-lines
 This is a list of buffers that should keep their mode lines updated.
@@ -5826,13 +6178,13 @@ section is designed to give general pointers on how to customize Gnus
 for some quite common situations.
 
 @menu
-* Slow @sc{nntp} Connection::      You run a local Emacs and get the news elsewhere.
+* Slow NNTP Connection::      You run a local Emacs and get the news elsewhere.
 * Slow Terminal Connection::  You run a remote Emacs.
 * Little Disk Space::         You feel that having large setup files is icky.
 * Slow Machine::              You feel like buying a faster machine.
 @end menu
 
-@node Slow @sc{nntp} Connection
+@node Slow NNTP Connection
 @section Slow @sc{nntp} Connection
 
 If you run Emacs on a machine locally, and get your news from a machine