changeset 32970:343a1c02c422

2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu> * 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. (nnkiboze-request-article): Use gnus-cache-request-article.
author Dave Love <fx@gnu.org>
date Fri, 27 Oct 2000 18:09:37 +0000
parents 899478c14a26
children 831149d9d733
files lisp/gnus/nnkiboze.el
diffstat 1 files changed, 23 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/gnus/nnkiboze.el	Fri Oct 27 18:06:48 2000 +0000
+++ b/lisp/gnus/nnkiboze.el	Fri Oct 27 18:09:37 2000 +0000
@@ -1,9 +1,10 @@
 ;;; nnkiboze.el --- select virtual news access for Gnus
 
-;; Copyright (C) 1995, 1996, 1997, 1998, 1999,.2000
+;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000
 ;;	Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
+;; Maintainer: bugs@gnus.org
 ;; Keywords: news
 
 ;; This file is part of GNU Emacs.
@@ -100,14 +101,17 @@
       ;; article fetching by message-id at all.
       (nntp-request-article article newsgroup gnus-nntp-server buffer)
     (let* ((header (gnus-summary-article-header article))
-	   (xref (mail-header-xref header)))
+	   (xref (mail-header-xref header))
+	   num group)
       (unless xref
 	(error "nnkiboze: No xref"))
       (unless (string-match " \\([^ ]+\\):\\([0-9]+\\)" xref)
 	(error "nnkiboze: Malformed xref"))
-      (gnus-request-article (string-to-int (match-string 2 xref))
-			    (match-string 1 xref)
-			    buffer))))
+      (setq num (string-to-int (match-string 2 xref))
+	    group (match-string 1 xref))
+      (or (with-current-buffer buffer
+	    (gnus-cache-request-article num group))
+	  (gnus-request-article num group buffer)))))
 
 (deffoo nnkiboze-request-scan (&optional group server)
   (nnkiboze-generate-group (concat "nnkiboze:" group)))
@@ -209,7 +213,10 @@
       (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
@@ -218,7 +225,7 @@
 		  (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
@@ -232,6 +239,9 @@
 	 (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
@@ -334,9 +344,10 @@
       (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)
@@ -353,11 +364,11 @@
 	(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.