Fix nnkiboze bugs.
authorShengHuo ZHU <zsh@cs.rochester.edu>
Thu, 21 Sep 2000 20:03:21 +0000 (20:03 +0000)
committerShengHuo ZHU <zsh@cs.rochester.edu>
Thu, 21 Sep 2000 20:03:21 +0000 (20:03 +0000)
lisp/ChangeLog
lisp/gnus-group.el
lisp/gnus-score.el
lisp/nnkiboze.el

index 0ad7478..9dc8db7 100644 (file)
@@ -1,3 +1,13 @@
+2000-09-21 16:15:25  ShengHuo ZHU  <zsh@cs.rochester.edu>
+
+       * gnus-score.el (gnus-score-use-all-scores): New variable.
+       (gnus-all-score-files): Use it.
+       * nnkiboze.el (nnkiboze-generate-group): Use it. Inhibit list groups.
+       (nnkiboze-enter-nov): Fix it when there is no xref.
+       (nnkiboze-generate-groups): List groups.
+       * gnus-group.el (gnus-group-make-kiboze-group): Use 
+       nnkiboze-score-file.
+
 2000-07-16 Dmitry Bely <dbely@mail.ru>
 
        * nnheader.el (nnheader-translate-file-chars): Path splitting on NT.
index 0aead88..84ca742 100644 (file)
@@ -2337,7 +2337,8 @@ score file entries for articles to include in the group."
        (push (cons header regexps) scores))
       scores)))
   (gnus-group-make-group group "nnkiboze" address)
-  (let* ((score-file (gnus-score-file-name (concat "nnkiboze:" group)))
+  (let* ((nnkiboze-current-group group)
+        (score-file (car (nnkiboze-score-file "")))
         (score-dir (file-name-directory score-file)))
     (unless (file-exists-p score-dir)
       (make-directory score-dir))
index 5ee3fd6..0baed3b 100644 (file)
@@ -395,6 +395,9 @@ If nil, the user will be asked for a duration."
 
 ;; Internal variables.
 
+(defvar gnus-score-use-all-scores t
+  "If nil, only `gnus-score-find-score-files-function' is used.")
+
 (defvar gnus-adaptive-word-syntax-table
   (let ((table (copy-syntax-table (standard-syntax-table)))
        (numbers '(?0 ?1 ?2 ?3 ?4 ?5 ?6 ?7 ?8 ?9)))
@@ -2707,19 +2710,20 @@ The list is determined from the variable gnus-score-file-alist."
       (and funcs
           (not (listp funcs))
           (setq funcs (list funcs)))
-      ;; Get the initial score files for this group.
-      (when funcs
-       (setq score-files (nreverse (gnus-score-find-alist group))))
-      ;; Add any home adapt files.
-      (let ((home (gnus-home-score-file group t)))
-       (when home
-         (push home score-files)
-         (setq gnus-newsgroup-adaptive-score-file home)))
-      ;; Check whether there is a `adapt-file' group parameter.
-      (let ((param-file (gnus-group-find-parameter group 'adapt-file)))
-       (when param-file
-         (push param-file score-files)
-         (setq gnus-newsgroup-adaptive-score-file param-file)))
+      (when gnus-score-use-all-scores
+       ;; Get the initial score files for this group.
+       (when funcs
+         (setq score-files (nreverse (gnus-score-find-alist group))))
+       ;; Add any home adapt files.
+       (let ((home (gnus-home-score-file group t)))
+         (when home
+           (push home score-files)
+           (setq gnus-newsgroup-adaptive-score-file home)))
+       ;; Check whether there is a `adapt-file' group parameter.
+       (let ((param-file (gnus-group-find-parameter group 'adapt-file)))
+         (when param-file
+           (push param-file score-files)
+           (setq gnus-newsgroup-adaptive-score-file param-file))))
       ;; Go through all the functions for finding score files (or actual
       ;; scores) and add them to a list.
       (while funcs
@@ -2727,14 +2731,15 @@ The list is determined from the variable gnus-score-file-alist."
          (setq score-files
                (nconc score-files (nreverse (funcall (car funcs) group)))))
        (setq funcs (cdr funcs)))
-      ;; Add any home score files.
-      (let ((home (gnus-home-score-file group)))
-       (when home
-         (push home score-files)))
-      ;; Check whether there is a `score-file' group parameter.
-      (let ((param-file (gnus-group-find-parameter group 'score-file)))
-       (when param-file
-         (push param-file score-files)))
+      (when gnus-score-use-all-scores
+       ;; Add any home score files.
+       (let ((home (gnus-home-score-file group)))
+         (when home
+           (push home score-files)))
+       ;; Check whether there is a `score-file' group parameter.
+       (let ((param-file (gnus-group-find-parameter group 'score-file)))
+         (when param-file
+           (push param-file score-files))))
       ;; Expand all files names.
       (let ((files score-files))
        (while files
index 1f85c79..fb826da 100644 (file)
@@ -207,7 +207,10 @@ Finds out what articles are to be part of the nnkiboze groups."
       (when (string-match "nnkiboze" (gnus-info-group info))
        ;; For each kiboze group, we call this function to generate
        ;; it.
-       (nnkiboze-generate-group (gnus-info-group info))))))
+       (nnkiboze-generate-group (gnus-info-group info) t))))
+  (save-excursion
+    (set-buffer gnus-group-buffer)
+    (gnus-group-list-groups)))
 
 (defun nnkiboze-score-file (group)
   (list (expand-file-name
@@ -216,7 +219,7 @@ Finds out what articles are to be part of the nnkiboze groups."
                  (concat (nnkiboze-prefixed-name nnkiboze-current-group)
                          "." gnus-score-file-suffix))))))
 
-(defun nnkiboze-generate-group (group)
+(defun nnkiboze-generate-group (group &optional inhibit-list-groups)
   (let* ((info (nth 2 (gnus-gethash group gnus-newsrc-hashtb)))
         (newsrc-file (concat nnkiboze-directory
                               (nnheader-translate-file-chars
@@ -230,6 +233,9 @@ Finds out what articles are to be part of the nnkiboze groups."
         (gnus-expert-user t)
         (gnus-large-newsgroup nil)
         (gnus-score-find-score-files-function 'nnkiboze-score-file)
+        ;; Use only nnkiboze-score-file!
+        (gnus-score-use-all-scores nil)
+        (gnus-use-scoring t)
         (gnus-verbose (min gnus-verbose 3))
         gnus-select-group-hook gnus-summary-prepare-hook
         gnus-thread-sort-functions gnus-show-threads
@@ -332,9 +338,10 @@ Finds out what articles are to be part of the nnkiboze groups."
       (insert "(setq nnkiboze-newsrc '")
       (gnus-prin1 nnkiboze-newsrc)
       (insert ")\n")))
-  (save-excursion
-    (set-buffer gnus-group-buffer)
-    (gnus-group-list-groups))
+  (unless inhibit-list-groups
+    (save-excursion
+      (set-buffer gnus-group-buffer)
+      (gnus-group-list-groups)))
   t)
 
 (defun nnkiboze-enter-nov (buffer header group)
@@ -351,11 +358,11 @@ Finds out what articles are to be part of the nnkiboze groups."
        (setq article 1))
       (mail-header-set-number oheader article)
       (with-temp-buffer
-       (insert (mail-header-xref oheader))
+       (insert (or (mail-header-xref oheader) ""))
        (goto-char (point-min))
        (if (re-search-forward " [^ ]+:[0-9]+" nil t)
            (goto-char (match-beginning 0))
-       (forward-char 1))
+         (or (eobp) (forward-char 1)))
        ;; The first Xref has to be the group this article
        ;; really came for - this is the article nnkiboze
        ;; will request when it is asked for the article.