*** empty log message ***
[gnus] / lisp / gnus.el
index 2793693..61cbeb5 100644 (file)
 (require 'nnheader)
 (require 'message)
 (require 'nnmail)
+(require 'backquote)
 
 (eval-when-compile (require 'cl))
 
+;;;###autoload
 (defvar gnus-directory (or (getenv "SAVEDIR") "~/News/")
   "*Directory variable from which all other Gnus file variables are derived.")
 
@@ -356,7 +358,7 @@ It uses the same syntax as the `gnus-split-methods' variable.")
 (defvar gnus-use-adaptive-scoring nil
   "*If non-nil, use some adaptive scoring scheme.")
 
-(defvar gnus-use-cache nil
+(defvar gnus-use-cache 'passive
   "*If nil, Gnus will ignore the article cache.
 If `passive', it will allow entering (and reading) articles
 explicitly entered into the cache.  If anything else, use the
@@ -1362,6 +1364,9 @@ It calls `gnus-summary-expire-articles' by default.")
 (defvar gnus-group-catchup-group-hook nil
   "*A hook run when catching up a group from the group buffer.")
 
+(defvar gnus-group-update-group-hook nil
+  "*A hook called when updating group lines.")
+
 (defvar gnus-open-server-hook nil
   "*A hook called just before opening connection to the news server.")
 
@@ -1723,14 +1728,17 @@ variable (string, integer, character, etc).")
   "gnus-bug@ifi.uio.no (The Gnus Bugfixing Girls + Boys)"
   "The mail address of the Gnus maintainers.")
 
-(defconst gnus-version "September Gnus v0.96"
+(defconst gnus-version-number "5.2.11"
   "Version number for this version of Gnus.")
 
+(defconst gnus-version (format "Gnus v%s" gnus-version-number)
+  "Version string for this version of Gnus.")
+
 (defvar gnus-info-nodes
   '((gnus-group-mode "(gnus)The Group Buffer")
     (gnus-summary-mode "(gnus)The Summary Buffer")
     (gnus-article-mode "(gnus)The Article Buffer"))
-  "Assoc list of major modes and related Info nodes.")
+  "Alist of major modes and related Info nodes.")
 
 (defvar gnus-group-buffer "*Group*")
 (defvar gnus-summary-buffer "*Summary*")
@@ -1931,7 +1939,7 @@ gnus-newsrc-hashtb should be kept so that both hold the same information.")
     gnus-newsgroup-scored gnus-newsgroup-kill-headers
     gnus-newsgroup-async gnus-thread-expunge-below
     gnus-score-alist gnus-current-score-file gnus-summary-expunge-below
-    (gnus-summary-mark-below . 0)
+    (gnus-summary-mark-below . global)
     gnus-newsgroup-active gnus-scores-exclude-files
     gnus-newsgroup-history gnus-newsgroup-ancient
     gnus-newsgroup-sparse
@@ -1992,10 +2000,7 @@ Thank you for your help in stamping out bugs.
      ("nnvirtual" nnvirtual-catchup-group)
      ("timezone" timezone-make-date-arpa-standard timezone-fix-time
       timezone-make-sortable-date timezone-make-time-string)
-     ("sendmail" mail-position-on-field mail-setup)
      ("rmailout" rmail-output)
-     ("rnewspost" news-mail-other-window news-reply-yank-original
-      news-caesar-buffer-body)
      ("rmail" rmail-insert-rmail-file-header rmail-count-new-messages
       rmail-show-message)
      ("gnus-soup" :interactive t
@@ -2080,8 +2085,6 @@ Thank you for your help in stamping out bugs.
      ("gnus-msg" :interactive t
       gnus-group-post-news gnus-group-mail gnus-summary-post-news
       gnus-summary-followup gnus-summary-followup-with-original
-      gnus-summary-followup-and-reply
-      gnus-summary-followup-and-reply-with-original
       gnus-summary-cancel-article gnus-summary-supersede-article
       gnus-post-news gnus-inews-news gnus-cancel-news
       gnus-summary-reply gnus-summary-reply-with-original
@@ -2093,7 +2096,7 @@ Thank you for your help in stamping out bugs.
       gnus-grouplens-mode)
      ("gnus-vm" gnus-vm-mail-setup)
      ("gnus-vm" :interactive t gnus-summary-save-in-vm
-      gnus-summary-save-article-vm gnus-yank-article))))
+      gnus-summary-save-article-vm))))
 
 \f
 
@@ -2215,6 +2218,18 @@ Thank you for your help in stamping out bugs.
   (and gnus-group-buffer
        (get-buffer gnus-group-buffer)))
 
+(defun gnus-delete-first (elt list)
+  "Delete by side effect the first occurrence of ELT as a member of LIST."
+  (if (equal (car list) elt)
+      (cdr list)
+    (let ((total list))
+      (while (and (cdr list)
+                 (not (equal (cadr list) elt)))
+       (setq list (cdr list)))
+      (when (cdr list)
+       (setcdr list (cddr list)))
+      total)))
+
 ;; Delete the current line (and the next N lines.);
 (defmacro gnus-delete-line (&optional n)
   `(delete-region (progn (beginning-of-line) (point))
@@ -2297,6 +2312,16 @@ Thank you for your help in stamping out bugs.
          flist)
       (cons 'progn (cddr fval)))))
 
+;; Find out whether the gnus-visual TYPE is wanted.
+(defun gnus-visual-p (&optional type class)
+  (and gnus-visual                     ; Has to be non-nil, at least.
+       (if (not type)                  ; We don't care about type.
+          gnus-visual
+        (if (listp gnus-visual)        ; It's a list, so we check it.
+            (or (memq type gnus-visual)
+                (memq class gnus-visual))
+          t))))
+
 ;;; Load the compatability functions.
 
 (require 'gnus-cus)
@@ -2898,7 +2923,10 @@ If variable `gnus-use-long-file-name' is non-nil, it is
              (setq prefixes (cons prefix prefixes))
              (message "Descend hierarchy %s? ([y]nsq): "
                       (substring prefix 1 (1- (length prefix))))
-             (setq ans (read-char))
+             (while (not (memq (setq ans (read-char)) '(?y ?\n ?n ?s ?q)))
+               (ding)
+               (message "Descend hierarchy %s? ([y]nsq): "
+                        (substring prefix 1 (1- (length prefix)))))
              (cond ((= ans ?n)
                     (while (and groups
                                 (string-match prefix
@@ -2924,7 +2952,9 @@ If variable `gnus-use-long-file-name' is non-nil, it is
                       (setq groups (cdr groups))))
                    (t nil)))
          (message "Subscribe %s? ([n]yq)" (car groups))
-         (setq ans (read-char))
+         (while (not (memq (setq ans (read-char)) '(?y ?\n ?q ?n)))
+           (ding)
+           (message "Subscribe %s? ([n]yq)" (car groups)))
          (setq group (car groups))
          (cond ((= ans ?y)
                 (gnus-subscribe-alphabetically (car groups))
@@ -3504,9 +3534,10 @@ should have point."
             (delete-windows-on (car bufs)))
        (setq bufs (cdr bufs))))))
 
-(defun gnus-version ()
-  "Version numbers of this version of Gnus."
-  (interactive)
+(defun gnus-version (&optional arg)
+  "Version number of this version of Gnus.
+If ARG, insert string at point."
+  (interactive "P")
   (let ((methods gnus-valid-select-methods)
        (mess gnus-version)
        meth)
@@ -3520,7 +3551,9 @@ should have point."
           (stringp (symbol-value meth))
           (setq mess (concat mess "; " (symbol-value meth))))
       (setq methods (cdr methods)))
-    (gnus-message 2 mess)))
+    (if arg
+       (insert (message mess))
+      (message mess))))
 
 (defun gnus-info-find-node ()
   "Find Info documentation of Gnus."
@@ -3787,16 +3820,6 @@ simple-first is t, first argument is already simplified."
   "Hide text of TYPE between B and E."
   (gnus-hide-text b e (cons 'gnus-type (cons type gnus-hidden-properties))))
 
-;; Find out whether the gnus-visual TYPE is wanted.
-(defun gnus-visual-p (&optional type class)
-  (and gnus-visual                     ; Has to be non-nil, at least.
-       (if (not type)                  ; We don't care about type.
-          gnus-visual
-        (if (listp gnus-visual)        ; It's a list, so we check it.
-            (or (memq type gnus-visual)
-                (memq class gnus-visual))
-          t))))
-
 (defun gnus-parent-headers (headers &optional generation)
   "Return the headers of the GENERATIONeth parent of HEADERS."
   (unless generation 
@@ -4266,7 +4289,7 @@ The following commands are available:
   (setq truncate-lines t)
   (setq buffer-read-only t)
   (gnus-make-local-hook 'post-command-hook)
-  (add-hook 'post-command-hook 'gnus-clear-inboxes-moved)
+  (gnus-add-hook 'post-command-hook 'gnus-clear-inboxes-moved nil t)
   (run-hooks 'gnus-group-mode-hook))
 
 (defun gnus-clear-inboxes-moved ()
@@ -5022,7 +5045,10 @@ already."
          (goto-char loc)
          (let ((gnus-group-indentation (gnus-group-group-indentation)))
            (gnus-delete-line)
-           (gnus-group-insert-group-line-info group))
+           (gnus-group-insert-group-line-info group)
+           (save-excursion
+             (forward-line -1)
+             (run-hooks 'gnus-group-update-group-hook)))
          (setq loc (1+ loc)))
        (unless (or found visible-only)
          ;; No such line in the buffer, find out where it's supposed to
@@ -5041,7 +5067,10 @@ already."
              (or entry (goto-char (point-max)))))
          ;; Finally insert the line.
          (let ((gnus-group-indentation (gnus-group-group-indentation)))
-           (gnus-group-insert-group-line-info group)))
+           (gnus-group-insert-group-line-info group)
+           (save-excursion
+             (forward-line -1)
+             (run-hooks 'gnus-group-update-group-hook))))
        (gnus-group-set-mode-line)))))
 
 (defun gnus-group-set-mode-line ()
@@ -6026,6 +6055,8 @@ 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")
+  (unless (gnus-group-group-name)
+    (error "No group on the current line"))
   (if (not (or (not gnus-interactive-catchup) ;Without confirmation?
               gnus-expert-user
               (gnus-y-or-n-p
@@ -6600,7 +6631,7 @@ This command may read the active file."
   (interactive "P\nsList newsgroups matching: ")
   ;; First make sure active file has been read.
   (when (and level
-            (>= (prefix-numeric-value level) gnus-level-killed))
+            (> (prefix-numeric-value level) gnus-level-killed))
     (gnus-get-killed-groups))
   (gnus-group-prepare-flat (or level gnus-level-subscribed)
                           all (or lowest 1) regexp)
@@ -7120,15 +7151,7 @@ The following commands are available:
             (gnus-visual-p 'summary-menu 'menu))
     (gnus-summary-make-menu-bar))
   (kill-all-local-variables)
-  (let ((locals gnus-summary-local-variables))
-    (while locals
-      (if (consp (car locals))
-         (progn
-           (make-local-variable (caar locals))
-           (set (caar locals) (eval (cdar locals))))
-       (make-local-variable (car locals))
-       (set (car locals) nil))
-      (setq locals (cdr locals))))
+  (gnus-summary-make-local-variables)
   (gnus-make-thread-indent-array)
   (gnus-simplify-mode-line)
   (setq major-mode 'gnus-summary-mode)
@@ -7147,6 +7170,24 @@ The following commands are available:
   (make-local-variable 'gnus-summary-mark-positions)
   (run-hooks 'gnus-summary-mode-hook))
 
+(defun gnus-summary-make-local-variables ()
+  "Make all the local summary buffer variables."
+  (let ((locals gnus-summary-local-variables)
+       global local)
+    (while (setq local (pop locals))
+      (if (consp local)
+         (progn
+           (if (eq (cdr local) 'global)
+               ;; Copy the global value of the variable.
+               (setq global (symbol-value (car local)))
+             ;; Use the value from the list.
+             (setq global (eval (cdr local))))
+           (make-local-variable (car local))
+           (set (car local) global))
+       ;; Simple nil-valued local variable.
+       (make-local-variable local)
+       (set local nil)))))
+
 (defun gnus-summary-make-display-table ()
   ;; Change the display table. Odd characters have a tendency to mess
   ;; up nicely formatted displays - we make all possible glyphs
@@ -8039,26 +8080,32 @@ If NO-DISPLAY, don't generate a summary buffer."
                      (delq number gnus-newsgroup-unselected)))
            (push number gnus-newsgroup-ancient)))))))
 
-(defun gnus-summary-update-article (article &optional header)
+(defun gnus-summary-update-article (article &optional iheader)
   "Update ARTICLE in the summary buffer."
   (set-buffer gnus-summary-buffer)
-  (let* ((header (or header (gnus-summary-article-header article)))
+  (let* ((header (or iheader (gnus-summary-article-header article)))
         (id (mail-header-id header))
         (data (gnus-data-find article))
         (thread (gnus-id-to-thread id))
+        (references (mail-header-references header))
         (parent
-         (gnus-id-to-thread (or (gnus-parent-id 
-                                 (mail-header-references header))
-                                "tull")))
+         (gnus-id-to-thread
+          (or (gnus-parent-id 
+               (if (and references
+                        (not (equal "" references)))
+                   references))
+              "none")))
         (buffer-read-only nil)
         (old (car thread))
         (number (mail-header-number header))
         pos)
     (when thread
-      (setcar thread nil)
+      ;; !!! Should this be in or not?
+      (unless iheader
+       (setcar thread nil))
       (when parent
        (delq thread parent))
-      (if (gnus-summary-insert-subject id header)
+      (if (gnus-summary-insert-subject id header iheader)
          ;; Set the (possibly) new article number in the data structure.
          (gnus-data-set-number data (gnus-id-to-article id))
        (setcar thread old)
@@ -8103,6 +8150,15 @@ If NO-DISPLAY, don't generate a summary buffer."
       (gnus-data-compute-positions)
       (setq gnus-newsgroup-threads (nconc threads gnus-newsgroup-threads)))))
 
+(defun gnus-number-to-header (number)
+  "Return the header for article NUMBER."
+  (let ((headers gnus-newsgroup-headers))
+    (while (and headers
+               (not (= number (mail-header-number (car headers)))))
+      (pop headers))
+    (when headers
+      (car headers))))
+
 (defun gnus-id-to-thread (id)
   "Return the (sub-)thread where ID appears."
   (gnus-gethash id gnus-newsgroup-dependencies))
@@ -8295,8 +8351,8 @@ If NO-DISPLAY, don't generate a summary buffer."
 (defsubst gnus-article-sort-by-date (h1 h2)
   "Sort articles by root article date."
   (string-lessp
-   (gnus-sortable-date (mail-header-date h1))
-   (gnus-sortable-date (mail-header-date h2))))
+   (inline (gnus-sortable-date (mail-header-date h1)))
+   (inline (gnus-sortable-date (mail-header-date h2)))))
 
 (defun gnus-thread-sort-by-date (h1 h2)
   "Sort threads by root article date."
@@ -8325,12 +8381,15 @@ Unscored articles will be counted as having a score of zero."
 
 (defun gnus-thread-total-score (thread)
   ;;  This function find the total score of THREAD.
-  (if (consp thread)
-      (if (stringp (car thread))
-         (apply gnus-thread-score-function 0
-                (mapcar 'gnus-thread-total-score-1 (cdr thread)))
-       (gnus-thread-total-score-1 thread))
-    (gnus-thread-total-score-1 (list thread))))
+  (cond ((null thread)
+        0)
+       ((consp thread)
+        (if (stringp (car thread))
+            (apply gnus-thread-score-function 0
+                   (mapcar 'gnus-thread-total-score-1 (cdr thread)))
+          (gnus-thread-total-score-1 thread)))
+       (t
+        (gnus-thread-total-score-1 (list thread)))))
 
 (defun gnus-thread-total-score-1 (root)
   ;; This function find the total score of the thread below ROOT.
@@ -8743,12 +8802,12 @@ If READ-ALL is non-nil, all articles in the group are selected."
       (unless gnus-single-article-buffer
        (gnus-article-setup-buffer))
       ;; First and last article in this newsgroup.
-      (and gnus-newsgroup-headers
-          (setq gnus-newsgroup-begin
-                (mail-header-number (car gnus-newsgroup-headers)))
-          (setq gnus-newsgroup-end
-                (mail-header-number
-                 (gnus-last-element gnus-newsgroup-headers))))
+      (when gnus-newsgroup-headers
+       (setq gnus-newsgroup-begin
+             (mail-header-number (car gnus-newsgroup-headers))
+             gnus-newsgroup-end
+             (mail-header-number
+              (gnus-last-element gnus-newsgroup-headers))))
       (setq gnus-reffed-article-number -1)
       ;; GROUP is successfully selected.
       (or gnus-newsgroup-headers t)))))
@@ -9130,7 +9189,13 @@ The resulting hash table is returned, or nil if no Xrefs were found."
                 (equal (nth 1 m1) (nth 1 m2)))))))
 
 (defsubst gnus-header-value ()
-  (buffer-substring (match-end 0) (gnus-point-at-eol)))
+  (buffer-substring 
+   (match-end 0) 
+   (if (re-search-forward "^[^ \t]" nil t)
+       (progn
+        (backward-char 2)
+        (point))
+     (gnus-point-at-eol))))
 
 (defvar gnus-newsgroup-none-id 0)
 
@@ -9200,10 +9265,10 @@ The resulting hash table is returned, or nil if no Xrefs were found."
            (progn
              (goto-char p)
              (if (search-forward "\nreferences: " nil t)
-                 (prog1
-                     (gnus-header-value)
-                   (setq end (match-end 0))
-                   (save-excursion
+                 (progn
+                   (setq end (point))
+                   (prog1
+                       (gnus-header-value)
                      (setq ref
                            (buffer-substring
                             (progn
@@ -9382,13 +9447,12 @@ list of headers that match SEQUENCE (see `nntp-retrieve-headers')."
                (setq header nil))
            (setcar (symbol-value id-dep) header))
        (set id-dep (list header))))
-    (if header
-       (progn
-         (if (boundp (setq ref-dep (intern (or ref "none") dependencies)))
-             (setcdr (symbol-value ref-dep)
-                     (nconc (cdr (symbol-value ref-dep))
-                            (list (symbol-value id-dep))))
-           (set ref-dep (list nil (symbol-value id-dep))))))
+    (when header
+      (if (boundp (setq ref-dep (intern (or ref "none") dependencies)))
+         (setcdr (symbol-value ref-dep)
+                 (nconc (cdr (symbol-value ref-dep))
+                        (list (symbol-value id-dep))))
+       (set ref-dep (list nil (symbol-value id-dep)))))
     header))
 
 (defun gnus-article-get-xrefs ()
@@ -9414,15 +9478,17 @@ This is meant to be called in `gnus-article-internal-prepare-hook'."
                                               (progn (end-of-line) (point))))
                  (mail-header-set-xref headers xref))))))))
 
-(defun gnus-summary-insert-subject (id &optional old-header)
+(defun gnus-summary-insert-subject (id &optional old-header use-old-header)
   "Find article ID and insert the summary line for that article."
-  (let ((header (or old-header (gnus-read-header id)))
+  (let ((header (if (and old-header use-old-header)
+                   old-header (gnus-read-header id)))
        (number (and (numberp id) id))
        pos)
     (when header
       ;; Rebuild the thread that this article is part of and go to the
       ;; article we have fetched.
-      (when old-header
+      (when (and (not gnus-show-threads)
+                old-header)
        (when (setq pos (text-property-any
                         (point-min) (point-max) 'gnus-number 
                         (mail-header-number old-header)))
@@ -10197,7 +10263,7 @@ If FORCE, also allow jumping to articles not currently shown."
     ;; We read in the article if we have to.
     (and (not data)
         force
-        (gnus-summary-insert-subject article (and (vectorp force) force))
+        (gnus-summary-insert-subject article (and (vectorp force) force) t)
         (setq data (gnus-data-find article)))
     (goto-char b)
     (if (not data)
@@ -11017,10 +11083,15 @@ Return how many articles were fetched."
       (setq message-id (concat "<" message-id)))
     (unless (string-match ">$" message-id)
       (setq message-id (concat message-id ">")))
-    (let ((header (gnus-id-to-header message-id)))
+    (let* ((header (gnus-id-to-header message-id))
+          (sparse (memq (mail-header-number header) gnus-newsgroup-sparse)))
       (if header
-         ;; The article is present in the buffer, to we just go to it.
-         (gnus-summary-goto-article (mail-header-number header) nil header)
+         (prog1
+             ;; The article is present in the buffer, to we just go to it.
+             (gnus-summary-goto-article 
+              (mail-header-number header) nil header)
+           (when sparse
+             (gnus-summary-update-article (mail-header-number header))))
        ;; We fetch the article
        (let ((gnus-override-method 
               (and (gnus-news-group-p gnus-newsgroup-name)
@@ -11331,8 +11402,9 @@ forward."
      gnus-article-buffer
      (save-restriction
        (widen)
-       (let ((start (window-start)))
-        (news-caesar-buffer-body arg)
+       (let ((start (window-start))
+            buffer-read-only)
+        (message-caesar-buffer-body arg)
         (set-window-start (get-buffer-window (current-buffer)) start))))))
 
 (defun gnus-summary-stop-page-breaking ()
@@ -12837,12 +12909,19 @@ Argument REVERSE means reverse order."
 (defun gnus-sortable-date (date)
   "Make sortable string by string-lessp from DATE.
 Timezone package is used."
-  (setq date (timezone-fix-time date nil nil))
-  (timezone-make-sortable-date
-   (aref date 0) (aref date 1) (aref date 2)
-   (timezone-make-time-string
-    (aref date 3) (aref date 4) (aref date 5))))
-
+  (condition-case ()
+      (progn
+       (setq date (inline (timezone-fix-time 
+                           date nil 
+                           (aref (inline (timezone-parse-date date)) 4))))
+       (inline
+         (timezone-make-sortable-date
+          (aref date 0) (aref date 1) (aref date 2)
+          (inline
+            (timezone-make-time-string
+             (aref date 3) (aref date 4) (aref date 5))))))
+    (error "")))
+  
 ;; Summary saving commands.
 
 (defun gnus-summary-save-article (&optional n not-saved)
@@ -12855,6 +12934,8 @@ The variable `gnus-default-article-saver' specifies the saver function."
   (interactive "P")
   (gnus-set-global-variables)
   (let ((articles (gnus-summary-work-articles n))
+       (save-buffer (save-excursion 
+                      (nnheader-set-temp-buffer " *Gnus Save*")))
        file header article)
     (while articles
       (setq header (gnus-summary-article-header
@@ -12867,33 +12948,35 @@ The variable `gnus-default-article-saver' specifies the saver function."
        ;; This is a real article.
        (save-window-excursion
          (gnus-summary-select-article t nil nil article))
+       (save-excursion
+         (set-buffer save-buffer)
+         (insert-buffer-substring gnus-original-article-buffer))
        (unless gnus-save-all-headers
          ;; Remove headers accoring to `gnus-saved-headers'.
          (let ((gnus-visible-headers
-                (or gnus-saved-headers gnus-visible-headers)))
-           (gnus-article-hide-headers nil t)))
-       ;; Remove any X-Gnus lines.
-       (save-excursion
-         (set-buffer gnus-article-buffer)
-         (save-restriction
-           (let ((buffer-read-only nil))
-             (nnheader-narrow-to-headers)
-             (while (re-search-forward "^X-Gnus" nil t)
-               (gnus-delete-line)))))
+                (or gnus-saved-headers gnus-visible-headers))
+               (gnus-article-buffer save-buffer))
+           (gnus-article-hide-headers 1 t)))
        (save-window-excursion
          (if (not gnus-default-article-saver)
              (error "No default saver is defined.")
-           (setq file (funcall
-                       gnus-default-article-saver
-                       (cond
-                        ((not gnus-prompt-before-saving)
-                         'default)
-                        ((eq gnus-prompt-before-saving 'always)
-                         nil)
-                        (t file))))))
+           ;; !!! Magic!  The saving functions all save
+           ;; `gnus-original-article-buffer' (or so they think),
+           ;; but we bind that variable to out save-buffer.
+           (set-buffer gnus-article-buffer)
+           (let ((gnus-original-article-buffer save-buffer))
+             (setq file (funcall
+                         gnus-default-article-saver
+                         (cond
+                          ((not gnus-prompt-before-saving)
+                           'default)
+                          ((eq gnus-prompt-before-saving 'always)
+                           nil)
+                          (t file)))))))
        (gnus-summary-remove-process-mark article)
        (unless not-saved
          (gnus-summary-set-saved-mark article))))
+    (gnus-kill-buffer save-buffer)
     (gnus-summary-position-point)
     n))
 
@@ -13563,7 +13646,7 @@ The following commands are available:
       ;; Take the article from the original article buffer
       ;; and place it in the buffer it's supposed to be in.
       (when (and (get-buffer gnus-article-buffer)
-                (numberp article)
+                ;;(numberp article)
                 (equal (buffer-name (current-buffer))
                        (buffer-name (get-buffer gnus-article-buffer))))
        (save-excursion
@@ -13643,11 +13726,24 @@ The following commands are available:
                ;; numbers for this article.
                (mail-header-set-number header gnus-reffed-article-number))
            (decf gnus-reffed-article-number)
+           (gnus-remove-header (mail-header-number header))
            (push header gnus-newsgroup-headers)
            (setq gnus-current-headers header)
            (push (mail-header-number header) gnus-newsgroup-limit))
          header)))))
 
+(defun gnus-remove-header (number)
+  "Remove header NUMBER from `gnus-newsgroup-headers'."
+  (if (and gnus-newsgroup-headers
+          (= number (mail-header-number (car gnus-newsgroup-headers))))
+      (pop gnus-newsgroup-headers)
+    (let ((headers gnus-newsgroup-headers))
+      (while (and (cdr headers)
+                 (not (= number (mail-header-number (cadr headers)))))
+       (pop headers))
+      (when (cdr headers)
+       (setcdr headers (cddr headers))))))
+
 (defun gnus-article-prepare (article &optional all-headers header)
   "Prepare ARTICLE in article mode buffer.
 ARTICLE should either be an article number or a Message-ID.
@@ -13797,7 +13893,9 @@ Provided for backwards compatibility."
 If given a negative prefix, always show; if given a positive prefix,
 always hide."
   (interactive "P")
-  (unless (gnus-article-check-hidden-text 'headers arg)
+  (if (gnus-article-check-hidden-text 'headers arg)
+      ;; Show boring headers as well.
+      (gnus-article-show-hidden-text 'boring-headers)
     ;; This function might be inhibited.
     (unless gnus-inhibit-hiding
       (save-excursion
@@ -13827,7 +13925,9 @@ always hide."
            (while (looking-at "From ")
              (forward-line 1))
            (unless (bobp)
-             (gnus-hide-text (point-min) (point) props))
+             (if delete
+                 (delete-region (point-min) (point))
+               (gnus-hide-text (point-min) (point) props)))
            ;; Then treat the rest of the header lines.
            (narrow-to-region
             (point)
@@ -13939,17 +14039,18 @@ always hide."
       (while (search-forward "\b" nil t)
        (let ((next (following-char))
              (previous (char-after (- (point) 2))))
-         (cond ((eq next previous)
-                (gnus-put-text-property (- (point) 2) (point) 'invisible t)
-                (gnus-put-text-property (point) (1+ (point)) 'face 'bold))
-               ((eq next ?_)
-                (gnus-put-text-property (1- (point)) (1+ (point)) 'invisible t)
-                (gnus-put-text-property
-                 (- (point) 2) (1- (point)) 'face 'underline))
-               ((eq previous ?_)
-                (gnus-put-text-property (- (point) 2) (point) 'invisible t)
-                (gnus-put-text-property
-                 (point) (1+ (point))  'face 'underline))))))))
+         (cond 
+          ((eq next previous)
+           (gnus-put-text-property (- (point) 2) (point) 'invisible t)
+           (gnus-put-text-property (point) (1+ (point)) 'face 'bold))
+          ((eq next ?_)
+           (gnus-put-text-property (1- (point)) (1+ (point)) 'invisible t)
+           (gnus-put-text-property
+            (- (point) 2) (1- (point)) 'face 'underline))
+          ((eq previous ?_)
+           (gnus-put-text-property (- (point) 2) (point) 'invisible t)
+           (gnus-put-text-property
+            (point) (1+ (point))       'face 'underline))))))))
 
 (defun gnus-article-word-wrap ()
   "Format too long lines."
@@ -14037,7 +14138,7 @@ always hide."
                (process-send-region "gnus-x-face" beg end)
                (process-send-eof "gnus-x-face")))))))))
 
-(defalias 'gnus-header-decode-quoted-printable 'gnus-decode-rfc1522)
+(defalias 'gnus-headers-decode-quoted-printable 'gnus-decode-rfc1522)
 (defun gnus-decode-rfc1522 ()
   "Hack to remove QP encoding from headers."
   (let ((case-fold-search t)
@@ -14188,8 +14289,10 @@ always hide."
     (set-buffer gnus-article-buffer)
     (let ((hide (gnus-article-hidden-text-p type)))
       (cond ((or (and (null arg) (eq hide 'hidden))
-                (and arg (< 0 (prefix-numeric-value arg))))
+                (and arg (< (prefix-numeric-value arg) 1)))
             (gnus-article-show-hidden-text type))
+           ((and (numberp arg) (> (prefix-numeric-value arg) 0))
+            nil)
            ((eq hide 'shown)
             (gnus-article-show-hidden-text type t))
            (t nil)))))
@@ -14343,7 +14446,7 @@ how much time has lapsed since DATE."
              (prog1
                  (concat (if prev ", " "") (int-to-string
                                             (floor num))
-                         " " (symbol-name (car unit))
+                         " " (symbol-name (car unit)) 
                          (if (> num 1) "s" ""))
                (setq prev t))))
          gnus-article-time-units "")
@@ -14377,7 +14480,7 @@ function and want to see what the date was before converting."
   (if (gnus-visual-p 'article-highlight 'highlight)
       (gnus-article-highlight-some)))
 
-;; Article savers.
+;;; Article savers.
 
 (defun gnus-output-to-rmail (file-name)
   "Append the current article to an Rmail file named FILE-NAME."
@@ -16061,6 +16164,7 @@ Returns whether the updating was successful."
                  (unless (equal method gnus-message-archive-method)
                    (gnus-error 1 "Cannot read active file from %s server."
                                (car method)))
+               (gnus-message 5 mesg)
                (gnus-active-to-gnus-format method gnus-active-hashtb)
                ;; We mark this active file as read.
                (push method gnus-have-read-active-file)
@@ -16265,7 +16369,8 @@ If FORCE is non-nil, the .newsrc file is read."
 
 (defun gnus-continuum-version (version)
   "Return VERSION as a floating point number."
-  (when (string-match "^\\([^ ]+\\)? ?Gnus v?\\([0-9.]+\\)$" version)
+  (when (or (string-match "^\\([^ ]+\\)? ?Gnus v?\\([0-9.]+\\)$" version)
+           (string-match "^\\(.?\\)gnus-\\([0-9.]+\\)$" version))
     (let* ((alpha (and (match-beginning 1) (match-string 1 version)))
           (number (match-string 2 version))
           major minor least)
@@ -16279,11 +16384,11 @@ If FORCE is non-nil, the .newsrc file is read."
        (if (zerop major)
           (format "%s00%02d%02d"
                   (cond 
-                   ((string= alpha "(ding)") "4.99")
-                   ((string= alpha "September") "5.01")
-                   ((string= alpha "Red") "5.03"))
+                   ((member alpha '("(ding)" "d")) "4.99")
+                   ((member alpha '("September" "s")) "5.01")
+                   ((member alpha '("Red" "r")) "5.03"))
                   minor least)
-        (format "%d.%02d%20d" major minor least))))))
+        (format "%d.%02d%02d" major minor least))))))
 
 (defun gnus-convert-old-newsrc ()
   "Convert old newsrc into the new format, if needed."
@@ -16344,8 +16449,8 @@ If FORCE is non-nil, the .newsrc file is read."
                  killed gnus-killed-assoc
                  marked gnus-marked-assoc)))
       (setq gnus-newsrc-alist nil)
-      (while (setq info (gnus-get-info (setq group (pop newsrc))))
-       (if info
+      (while (setq group (pop newsrc))
+       (if (setq info (gnus-get-info (car group)))
            (progn
              (gnus-info-set-read info (cddr group))
              (gnus-info-set-level