Synch to Oort Gnus.
authoryamaoka <yamaoka>
Mon, 24 Feb 2003 22:26:27 +0000 (22:26 +0000)
committeryamaoka <yamaoka>
Mon, 24 Feb 2003 22:26:27 +0000 (22:26 +0000)
lisp/ChangeLog
lisp/gnus-group.el
lisp/gnus-start.el
lisp/gnus-sum.el
lisp/gnus-topic.el
lisp/gnus.el
lisp/nnheader.el
lisp/spam.el

index c1c86d4..cad8a15 100644 (file)
@@ -1,3 +1,47 @@
+2003-02-24  Teodor Zlatanov  <tzz@lifelogs.com>
+
+       * spam.el (spam-stat-register-spam-routine,
+       spam-stat-register-ham-routine): remove spam-stat-save
+       (spam-stat hook): add spam-stat-save to the gnus-save-newsrc-hook
+
+2002-02-24  Kevin Greiner  <kgreiner@xpediantsolutions.com>
+
+       * gnus-group.el (gnus-topic-mode-p): Fixed free variable
+       reference.
+
+2002-02-24  Kevin Greiner  <kgreiner@xpediantsolutions.com>
+
+       * nnheader.el (nnheader-find-nov-line): Changed midpoint
+       calculation to avoid integer overflow.
+
+2003-02-24  Reiner Steib  <Reiner.Steib@gmx.de>
+
+       * gnus-start.el (gnus-backup-startup-file): Fixed custom type.
+
+2003-02-24  Ted Zlatanov <tzz@lifelogs.com>
+       * spam.el: disabled spam-get-article-as-filename
+
+       From Michael Shields  <shields@msrl.com>
+
+       * gnus-group.el (gnus-group-is-exiting-without-update-p): New.
+       * gnus-sum.el (gnus-summary-exit-no-update): Use it.
+       * gnus-sum.el (gnus-summary-expire-articles): Use it.
+       * spam.el (spam-summary-prepare-exit): Use it.
+       * gnus.el (gnus-install-group-spam-parameters): New.
+       * spam.el (spam-group-ham-processor-copy-p): New.
+       * spam.el (spam-summary-prepare-exit): Support for ham copying.
+       * spam.el (spam-mark-spam-as-expired-and-move-routine): Fix bug
+       that would cause the current message to be moved if the group had
+       no spam.
+       * spam.el (spam-ham-move-routine): New `copy' argument.
+
+2003-02-24  Kai Gro\e,A_\e(Bjohann  <kai.grossjohann@uni-duisburg.de>
+       From Martin Thornquist <martint@ifi.uio.no>
+
+       * gnus-topic.el (gnus-topic-select-group): Select last group if
+       after last group.
+       * gnus-group.el (gnus-group-select-group): Ditto.
+
 2003-02-24  Katsumi Yamaoka  <yamaoka@jpl.org>
 
        * gnus-art.el (popup-menu): Compiler macro for Emacs 20.
index de23c64..77c41a5 100644 (file)
@@ -446,6 +446,7 @@ simple manner.")
 ;;; Internal variables
 
 (defvar gnus-group-is-exiting-p nil)
+(defvar gnus-group-is-exiting-without-update-p nil)
 (defvar gnus-group-sort-alist-function 'gnus-group-sort-flat
   "Function for sorting the group buffer.")
 
@@ -740,7 +741,7 @@ simple manner.")
 (defun gnus-topic-mode-p ()
   "Return non-nil in `gnus-topic-mode'."
   (and (boundp 'gnus-topic-mode) 
-       gnus-topic-mode))
+       (symbol-value 'gnus-topic-mode)))
 
 (defun gnus-group-make-menu-bar ()
   (gnus-turn-off-edit-menu 'group)
@@ -1917,6 +1918,8 @@ If the group is opened, just switch the summary buffer.
 If ALL is non-nil, already read articles become readable.
 If ALL is a number, fetch this number of articles."
   (interactive "P")
+  (when (and (eobp) (not (gnus-group-group-name)))
+    (forward-line -1))
   (gnus-group-read-group all t))
 
 (defun gnus-group-quick-select-group (&optional all)
index 657c0be..1105790 100644 (file)
@@ -54,7 +54,9 @@
 This variable takes the same values as the `version-control'
 variable."
   :group 'gnus-start
-  :type 'boolean)
+  :type '(choice (const :tag "Never" never)
+                (const :tag "If existing" nil)
+                (other :tag "Always" t)))
 
 (defcustom gnus-init-file (nnheader-concat gnus-home-directory ".gnus")
   "Your Gnus Emacs-Lisp startup file name.
index 6b8ac41..973163c 100644 (file)
@@ -6479,14 +6479,13 @@ If FORCE (the prefix), also save the .newsrc file(s)."
   (interactive)
   (let* ((group gnus-newsgroup-name)
         (gnus-group-is-exiting-p t)
+        (gnus-group-is-exiting-without-update-p t)
         (quit-config (gnus-group-quit-config group)))
     (when (or no-questions
              gnus-expert-user
              (gnus-y-or-n-p "Discard changes to this group and exit? "))
       (gnus-async-halt-prefetch)
-      (mapcar 'funcall
-             (delq 'gnus-summary-expire-articles
-                   (copy-sequence gnus-summary-prepare-exit-hook)))
+      (run-hooks 'gnus-summary-prepare-exit-hook)
       ;; If we have several article buffers, we kill them at exit.
       (unless gnus-single-article-buffer
        (gnus-kill-buffer gnus-article-buffer)
@@ -9198,8 +9197,9 @@ This will be the case if the article has both been mailed and posted."
 (defun gnus-summary-expire-articles (&optional now)
   "Expire all articles that are marked as expirable in the current group."
   (interactive)
-  (when (gnus-check-backend-function
-        'request-expire-articles gnus-newsgroup-name)
+  (when (and (not gnus-group-is-exiting-without-update-p)
+            (gnus-check-backend-function
+             'request-expire-articles gnus-newsgroup-name))
     ;; This backend supports expiry.
     (let* ((total (gnus-group-total-expirable-p gnus-newsgroup-name))
           (expirable (if total
index db0e68a..d2879d9 100644 (file)
@@ -1181,6 +1181,8 @@ If ALL is a number, fetch this number of articles.
 
 If performed over a topic line, toggle folding the topic."
   (interactive "P")
+  (when (and (eobp) (not (gnus-group-group-name)))
+    (forward-line -1))
   (if (gnus-group-topic-p)
       (let ((gnus-group-list-mode
             (if all (cons (if (numberp all) all 7) t) gnus-group-list-mode)))
index f8d383c..3ceb041 100644 (file)
@@ -1879,6 +1879,10 @@ Only applicable to non-spam (unclassified and ham) groups.")
     "The BBDB summary exit ham processor.
 Only applicable to non-spam (unclassified and ham) groups.")
 
+  (defvar gnus-group-ham-exit-processor-copy "copy"
+    "The ham copy exit ham processor.
+Only applicable to non-spam (unclassified and ham) groups.")
+
   (gnus-define-group-parameter
    spam-process
    :type list
@@ -1894,7 +1898,8 @@ Only applicable to non-spam (unclassified and ham) groups.")
                                   (variable-item gnus-group-ham-exit-processor-ifile)
                                   (variable-item gnus-group-ham-exit-processor-stat)
                                   (variable-item gnus-group-ham-exit-processor-whitelist)
-                                  (variable-item gnus-group-ham-exit-processor-BBDB))))
+                                  (variable-item gnus-group-ham-exit-processor-BBDB)
+                                  (variable-item gnus-group-ham-exit-processor-copy))))
    :function-document
    "Which spam or ham processors will be applied to the GROUP articles at summary exit."
    :variable gnus-spam-process-newsgroups
@@ -1918,7 +1923,8 @@ for mail groups."
                                      (variable-item gnus-group-ham-exit-processor-ifile)
                                      (variable-item gnus-group-ham-exit-processor-stat)
                                      (variable-item gnus-group-ham-exit-processor-whitelist)
-                                     (variable-item gnus-group-ham-exit-processor-BBDB))))
+                                     (variable-item gnus-group-ham-exit-processor-BBDB)
+                                     (variable-item gnus-group-ham-exit-processor-copy))))
    :parameter-document
    "Which spam processors will be applied to the spam or ham GROUP articles at summary exit.")
 
index 34e45b1..3a8a179 100644 (file)
@@ -880,7 +880,7 @@ the line could be found."
        (prev (point-min))
        num found)
     (while (not found)
-      (goto-char (/ (+ max min) 2))
+      (goto-char (+ min (/ (- max min) 2)))
       (beginning-of-line)
       (if (or (= (point) prev)
              (eobp))
index 28a7146..a63c86b 100644 (file)
@@ -333,6 +333,9 @@ your main source of newsgroup names."
 (defun spam-group-ham-processor-BBDB-p (group)
   (spam-group-processor-p group 'gnus-group-ham-exit-processor-BBDB))
 
+(defun spam-group-ham-processor-copy-p (group)
+  (spam-group-processor-p group 'gnus-group-ham-exit-processor-copy))
+
 ;;; Summary entry and exit processing.
 
 (defun spam-summary-prepare ()
@@ -340,62 +343,68 @@ your main source of newsgroup names."
 
 (add-hook 'gnus-summary-prepare-hook 'spam-summary-prepare)
 
+;; The spam processors are invoked for any group, spam or ham or neither
 (defun spam-summary-prepare-exit ()
-  ;; The spam processors are invoked for any group, spam or ham or neither
-  (gnus-message 6 "Exiting summary buffer and applying spam rules")
-  (when (and spam-bogofilter-path
-            (spam-group-spam-processor-bogofilter-p gnus-newsgroup-name))
-    (gnus-message 5 "Registering spam with bogofilter")
-    (spam-bogofilter-register-spam-routine))
+  (unless gnus-group-is-exiting-without-update-p
+    (gnus-message 6 "Exiting summary buffer and applying spam rules")
+    (when (and spam-bogofilter-path
+              (spam-group-spam-processor-bogofilter-p gnus-newsgroup-name))
+      (gnus-message 5 "Registering spam with bogofilter")
+      (spam-bogofilter-register-spam-routine))
   
-  (when (and spam-ifile-path
-            (spam-group-spam-processor-ifile-p gnus-newsgroup-name))
-    (gnus-message 5 "Registering spam with ifile")
-    (spam-ifile-register-spam-routine))
+    (when (and spam-ifile-path
+              (spam-group-spam-processor-ifile-p gnus-newsgroup-name))
+      (gnus-message 5 "Registering spam with ifile")
+      (spam-ifile-register-spam-routine))
   
-  (when (spam-group-spam-processor-stat-p gnus-newsgroup-name)
-    (gnus-message 5 "Registering spam with spam-stat")
-    (spam-stat-register-spam-routine))
-
-  (when (spam-group-spam-processor-blacklist-p gnus-newsgroup-name)
-    (gnus-message 5 "Registering spam with the blacklist")
-    (spam-blacklist-register-routine))
-
-  (if spam-move-spam-nonspam-groups-only      
-      (when (not (spam-group-spam-contents-p gnus-newsgroup-name))
-       (spam-mark-spam-as-expired-and-move-routine
-        (gnus-parameter-spam-process-destination gnus-newsgroup-name)))
-    (gnus-message 5 "Marking spam as expired and moving it to %s" gnus-newsgroup-name)
-    (spam-mark-spam-as-expired-and-move-routine 
-     (gnus-parameter-spam-process-destination gnus-newsgroup-name)))
-
-  ;; now we redo spam-mark-spam-as-expired-and-move-routine to only
-  ;; expire spam, in case the above did not expire them
-  (gnus-message 5 "Marking spam as expired without moving it")
-  (spam-mark-spam-as-expired-and-move-routine nil)
-
-  (when (spam-group-ham-contents-p gnus-newsgroup-name)
-    (when (spam-group-ham-processor-whitelist-p gnus-newsgroup-name)
-      (gnus-message 5 "Registering ham with the whitelist")
-      (spam-whitelist-register-routine))
-    (when (spam-group-ham-processor-ifile-p gnus-newsgroup-name)
-      (gnus-message 5 "Registering ham with ifile")
-      (spam-ifile-register-ham-routine))
-    (when (spam-group-ham-processor-bogofilter-p gnus-newsgroup-name)
-      (gnus-message 5 "Registering ham with Bogofilter")
-      (spam-bogofilter-register-ham-routine))
-    (when (spam-group-ham-processor-stat-p gnus-newsgroup-name)
-      (gnus-message 5 "Registering ham with spam-stat")
-      (spam-stat-register-ham-routine))
-    (when (spam-group-ham-processor-BBDB-p gnus-newsgroup-name)
-      (gnus-message 5 "Registering ham with the BBDB")
-      (spam-BBDB-register-routine)))
-
-  ;; now move all ham articles out of spam groups
-  (when (spam-group-spam-contents-p gnus-newsgroup-name)
-    (gnus-message 5 "Moving ham messages from spam group")
-    (spam-ham-move-routine
-     (gnus-parameter-ham-process-destination gnus-newsgroup-name))))
+    (when (spam-group-spam-processor-stat-p gnus-newsgroup-name)
+      (gnus-message 5 "Registering spam with spam-stat")
+      (spam-stat-register-spam-routine))
+
+    (when (spam-group-spam-processor-blacklist-p gnus-newsgroup-name)
+      (gnus-message 5 "Registering spam with the blacklist")
+      (spam-blacklist-register-routine))
+
+    (if spam-move-spam-nonspam-groups-only      
+       (when (not (spam-group-spam-contents-p gnus-newsgroup-name))
+         (spam-mark-spam-as-expired-and-move-routine
+          (gnus-parameter-spam-process-destination gnus-newsgroup-name)))
+      (gnus-message 5 "Marking spam as expired and moving it to %s" gnus-newsgroup-name)
+      (spam-mark-spam-as-expired-and-move-routine 
+       (gnus-parameter-spam-process-destination gnus-newsgroup-name)))
+
+    ;; now we redo spam-mark-spam-as-expired-and-move-routine to only
+    ;; expire spam, in case the above did not expire them
+    (gnus-message 5 "Marking spam as expired without moving it")
+    (spam-mark-spam-as-expired-and-move-routine nil)
+
+    (when (spam-group-ham-contents-p gnus-newsgroup-name)
+      (when (spam-group-ham-processor-whitelist-p gnus-newsgroup-name)
+       (gnus-message 5 "Registering ham with the whitelist")
+       (spam-whitelist-register-routine))
+      (when (spam-group-ham-processor-ifile-p gnus-newsgroup-name)
+       (gnus-message 5 "Registering ham with ifile")
+       (spam-ifile-register-ham-routine))
+      (when (spam-group-ham-processor-bogofilter-p gnus-newsgroup-name)
+       (gnus-message 5 "Registering ham with Bogofilter")
+       (spam-bogofilter-register-ham-routine))
+      (when (spam-group-ham-processor-stat-p gnus-newsgroup-name)
+       (gnus-message 5 "Registering ham with spam-stat")
+       (spam-stat-register-ham-routine))
+      (when (spam-group-ham-processor-BBDB-p gnus-newsgroup-name)
+       (gnus-message 5 "Registering ham with the BBDB")
+       (spam-BBDB-register-routine)))
+
+    (when (spam-group-ham-processor-copy-p gnus-newsgroup-name)
+      (gnus-message 5 "Copying ham")
+      (spam-ham-move-routine
+       (gnus-parameter-ham-process-destination gnus-newsgroup-name) t))
+
+    ;; now move all ham articles out of spam groups
+    (when (spam-group-spam-contents-p gnus-newsgroup-name)
+      (gnus-message 5 "Moving ham messages from spam group")
+      (spam-ham-move-routine
+       (gnus-parameter-ham-process-destination gnus-newsgroup-name)))))
 
 (add-hook 'gnus-summary-prepare-exit-hook 'spam-summary-prepare-exit)
 
@@ -421,13 +430,14 @@ your main source of newsgroup names."
        (push article tomove)))
 
     ;; now do the actual move
-    (when (stringp group)
+    (when (and tomove
+              (stringp group))
       (dolist (article tomove)
        (gnus-summary-set-process-mark article))
       (when tomove (gnus-summary-move-article nil group))))
   (gnus-summary-yank-process-mark))
  
-(defun spam-ham-move-routine (&optional group)
+(defun spam-ham-move-routine (&optional group copy)
   (gnus-summary-kill-process-mark)
   (let ((articles gnus-newsgroup-articles)
        article ham-mark-values mark tomove)
@@ -440,9 +450,12 @@ your main source of newsgroup names."
          (push article tomove)))
 
       ;; now do the actual move
-      (dolist (article tomove)
-       (gnus-summary-set-process-mark article))
-      (when tomove (gnus-summary-move-article nil group))))
+      (when tomove
+       (dolist (article tomove)
+         (gnus-summary-set-process-mark article))
+       (if copy
+           (gnus-summary-copy-article nil group)
+         (gnus-summary-move-article nil group)))))
   (gnus-summary-yank-process-mark))
  
 (defun spam-generic-register-routine (spam-func ham-func)
@@ -497,14 +510,15 @@ your main source of newsgroup names."
        (setq article-buffer (get-buffer gnus-article-buffer))))
     article-buffer))
 
-(defun spam-get-article-as-filename (article)
-  (let ((article-filename))
-    (when (numberp article)
-      (nnml-possibly-change-directory (gnus-group-real-name gnus-newsgroup-name))
-      (setq article-filename (expand-file-name (int-to-string article) nnml-current-directory)))
-    (if (file-exists-p article-filename)
-       article-filename
-      nil)))
+;; disabled for now
+;; (defun spam-get-article-as-filename (article)
+;;   (let ((article-filename))
+;;     (when (numberp article)
+;;       (nnml-possibly-change-directory (gnus-group-real-name gnus-newsgroup-name))
+;;       (setq article-filename (expand-file-name (int-to-string article) nnml-current-directory)))
+;;     (if (file-exists-p article-filename)
+;;     article-filename
+;;       nil)))
 
 (defun spam-fetch-field-from-fast (article)
   "Fetch the `from' field quickly, using the internal gnus-data-list function"
@@ -764,8 +778,7 @@ Uses `gnus-newsgroup-name' if category is nil (for ham registration)."
             (with-temp-buffer
               (insert article-string)
               (spam-stat-buffer-is-spam))))
-        nil)
-       (spam-stat-save))
+        nil))
 
       (defun spam-stat-register-ham-routine ()
        (spam-generic-register-routine 
@@ -774,8 +787,10 @@ Uses `gnus-newsgroup-name' if category is nil (for ham registration)."
           (let ((article-string (spam-get-article-as-string article)))
             (with-temp-buffer
               (insert article-string)
-              (spam-stat-buffer-is-non-spam)))))
-       (spam-stat-save)))
+              (spam-stat-buffer-is-non-spam))))))
+
+      (when spam-use-stat
+       (add-hook 'gnus-save-newsrc-hook 'spam-stat-save)))
 
   (file-error (progn
                (defalias 'spam-stat-register-ham-routine 'ignore)