From 61ffbfeee776229d3bb0b0fa895033107802ff8a Mon Sep 17 00:00:00 2001 From: yamaoka Date: Fri, 22 Sep 2000 03:02:01 +0000 Subject: [PATCH] Synch with Gnus. --- lisp/ChangeLog | 18 ++++++++++++++++++ lisp/gnus-group.el | 5 +++-- lisp/gnus-score.el | 47 ++++++++++++++++++++++++++--------------------- lisp/lpath.el | 3 +++ lisp/nnkiboze.el | 32 +++++++++++++++++++++----------- 5 files changed, 71 insertions(+), 34 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 0ad7478..a7926f5 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,21 @@ +2000-09-21 21:54:48 ShengHuo ZHU + + * lpath.el: Bind nnkiboze-score-file. + +2000-09-21 16:15:25 ShengHuo ZHU + + * 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. + + * nnkiboze.el (nnkiboze-request-article): Use + gnus-cache-request-article. + * gnus-group.el (gnus-group-make-kiboze-group): Fix prompt. + 2000-07-16 Dmitry Bely * nnheader.el (nnheader-translate-file-chars): Path splitting on NT. diff --git a/lisp/gnus-group.el b/lisp/gnus-group.el index da63fda..308e94d 100644 --- a/lisp/gnus-group.el +++ b/lisp/gnus-group.el @@ -2365,13 +2365,14 @@ score file entries for articles to include in the group." "Match on header: " headers nil t)))) (setq regexps nil) (while (not (equal "" (setq regexp (read-string - (format "Match on %s (string): " + (format "Match on %s (regexp): " header))))) (push (list regexp nil nil 'r) regexps)) (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)) diff --git a/lisp/gnus-score.el b/lisp/gnus-score.el index e0927e2..85c91e3 100644 --- a/lisp/gnus-score.el +++ b/lisp/gnus-score.el @@ -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))) @@ -2741,19 +2744,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 @@ -2761,14 +2765,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 diff --git a/lisp/lpath.el b/lisp/lpath.el index a12dc0f..d258187 100644 --- a/lisp/lpath.el +++ b/lisp/lpath.el @@ -117,4 +117,7 @@ (defun md5 (object &optional start end coding noerror) ) +(defun nnkiboze-score-file (a) + ) + (provide 'lpath) diff --git a/lisp/nnkiboze.el b/lisp/nnkiboze.el index 3c32a03..2f112e0 100644 --- a/lisp/nnkiboze.el +++ b/lisp/nnkiboze.el @@ -99,14 +99,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 +212,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 @@ -218,7 +224,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 @@ -232,6 +238,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 @@ -335,9 +344,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) @@ -354,11 +364,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. -- 1.7.10.4