From 935c150017a08f807fbcfe26ab16abc74d70a8c1 Mon Sep 17 00:00:00 2001 From: yamaoka Date: Thu, 14 Jun 2001 01:55:40 +0000 Subject: [PATCH] * nnshimbun.el (nnshimbun-request-expire-articles): Use `nnshimbun-find-parameter'. (nnshimbun-generate-nov-database): Bind a full group name while processing. (nnshimbun-find-parameter): New implementation to refer to the nnshimbun group parameters. (nnshimbun-index-range): Add a document that it's just a default. (nnshimbun-pre-fetch-article): Ditto. (nnshimbun-group-parameters): Specify a parameter type as `list'. (TopLevel): Remove the local variable "-*- coding: junet; -*-". --- ChangeLog | 13 ++++++++ lisp/nnshimbun.el | 88 +++++++++++++++++++++++++++++++++++++---------------- 2 files changed, 74 insertions(+), 27 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0ba0a35..a3125ba 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2001-06-14 Katsumi Yamaoka + + * lisp/nnshimbun.el (nnshimbun-request-expire-articles): Use + `nnshimbun-find-parameter'. + (nnshimbun-generate-nov-database): Bind a full group name while + processing. + (nnshimbun-find-parameter): New implementation to refer to the + nnshimbun group parameters. + (nnshimbun-index-range): Add a document that it's just a default. + (nnshimbun-pre-fetch-article): Ditto. + (nnshimbun-group-parameters): Specify a parameter type as `list'. + (TopLevel): Remove the local variable "-*- coding: junet; -*-". + 2001-06-13 Katsumi Yamaoka * lisp/nnshimbun.el (nnshimbun-group-parameters): New group diff --git a/lisp/nnshimbun.el b/lisp/nnshimbun.el index 6d6044f..7e11d52 100644 --- a/lisp/nnshimbun.el +++ b/lisp/nnshimbun.el @@ -1,4 +1,4 @@ -;;; nnshimbun.el --- interfacing with web newspapers -*- coding: junet; -*- +;;; nnshimbun.el --- interfacing with web newspapers ;; Authors: TSUCHIYA Masatoshi , ;; Akihiro Arisawa , @@ -84,23 +84,20 @@ (list :inline t :format "%v" (symbol :tag "Keyword") (sexp :tag "Value")))) - "A type definition for customizing `nnshimbun-group-parameters'.") + "A type definition for customizing the nnshimbun group parameters.") ;; The following definition provides the group parameter ;; `nnshimbun-group-parameters', the user option ;; `nnshimbun-group-parameters-alist' and the function ;; `nnshimbun-find-group-parameters'. -;; -;; Note that the group parameter `nnshimbun-group-parameters' will -;; have a property list like the following: +;; The group parameter `nnshimbun-group-parameters' will have a +;; property list like the following: ;; ;; '(index-range all prefetch-articles t expiry-wait 6) -;; -;; So the third argument of the function `gnus-group-find-parameter' -;; should be non-nil to get the value of the group parameter. (gnus-define-group-parameter nnshimbun-group-parameters + :type list :function nnshimbun-find-group-parameters :function-document "\ Return a nnshimbun GROUP's group parameters." @@ -108,10 +105,21 @@ Return a nnshimbun GROUP's group parameters." :variable-default nil :variable-document "\ Alist of nnshimbun group parameters. Each element should be a cons of -group name regexp and a plist which consists of a keyword and a value +a group name regexp and a plist which consists of a keyword and a value pairs like the following: -'(\"^nnshimbun\\\\+asahi:\" index-range all prefetch-articles t expiry-wait 6)" +'(\"^nnshimbun\\\\+asahi:\" index-range all prefetch-articles t expiry-wait 6) + +`index-range' specifies a range of header indices as described below: + all: Retrieve all header indices. + last: Retrieve the last header index. +integer N: Retrieve N pages of header indices. + +`prefetch-articles' specifies whether to pre-fetch the unread articles +when scanning the group. + +`expiry-wait' is similar to the generic group parameter `expiry-wait', +but it has a preference." :variable-group shimbun :variable-type `(repeat (cons :format "%v" (regexp :tag "Group name regexp" :value "^nnshimbun\\+") @@ -150,10 +158,15 @@ but it has a preference.") (defvoo nnshimbun-nov-file-name ".overview") (defvoo nnshimbun-pre-fetch-article nil - "*Non nil means that nnshimbun fetch unread articles when scanning groups.") + "*Non nil means that nnshimbun fetch unread articles when scanning +groups. Note that this variable has just a default value for all the +nnshimbun groups. You can specify the nnshimbun group parameter +`prefecth-articles' for each nnshimbun group.") (defvoo nnshimbun-index-range nil - "*Range of indecis to detect new pages.") + "*Range of indecis to detect new pages. Note that this variable has +just a default value for all the nnshimbun groups. You can specify +the nnshimbun group parameter `index-range' for each nnshimbun group.") ;; set by nnshimbun-possibly-change-group (defvoo nnshimbun-buffer nil) @@ -483,34 +496,55 @@ also be nil." (insert " ")) (forward-line 1))) -(defmacro nnshimbun-find-parameter (group variable) - `(or (let ((v (gnus-group-find-parameter - (concat "nnshimbun+" - (nnoo-current-server 'nnshimbun) - ":" ,group) - (quote ,variable) - 'allow-list))) - (if (listp v) (car v) v)) - ,variable)) +(defmacro nnshimbun-find-parameter (group symbol &optional full-name-p) + "Return the value of a nnshimbun group parameter for GROUP which is +associated with SYMBOL. If FULL-NAME-P is non-nil, it treats that +GROUP has a full name." + (let ((name (if full-name-p + group + `(concat "nnshimbun+" (nnoo-current-server 'nnshimbun) + ":" ,group)))) + (cond ((eq 'index-range (eval symbol)) + `(or (plist-get (nnshimbun-find-group-parameters ,name) + 'index-range) + ;; For the backward compatibility. + nnshimbun-index-range)) + ((eq 'prefetch-articles (eval symbol)) + `(or (plist-get (nnshimbun-find-group-parameters ,name) + 'prefetch-articles) + ;; For the backward compatibility. + nnshimbun-pre-fetch-article)) + ((eq 'expiry-wait (eval symbol)) + (if full-name-p + `(or (plist-get (nnshimbun-find-group-parameters ,group) + 'expiry-wait) + (gnus-group-find-parameter ,group 'expiry-wait)) + `(let ((name ,name)) + (or (plist-get (nnshimbun-find-group-parameters name) + 'expiry-wait) + (gnus-group-find-parameter name 'expiry-wait))))) + (t + `(plist-get (nnshimbun-find-group-parameters ,name) ,symbol))))) (defun nnshimbun-generate-nov-database (group) (nnshimbun-possibly-change-group group) (with-current-buffer (nnshimbun-open-nov group) (goto-char (point-max)) (forward-line -1) - (let ((i (or (ignore-errors (read (current-buffer))) 0)) - (pre-fetch - (nnshimbun-find-parameter group nnshimbun-pre-fetch-article))) + (let* ((i (or (ignore-errors (read (current-buffer))) 0)) + (name (concat "nnshimbun+" (nnoo-current-server 'nnshimbun) + ":" group)) + (pre-fetch (nnshimbun-find-parameter name 'prefetch-articles t))) (dolist (header (shimbun-headers nnshimbun-shimbun - (nnshimbun-find-parameter group nnshimbun-index-range))) + (nnshimbun-find-parameter name 'index-range t))) (unless (nnshimbun-search-id group (shimbun-header-id header)) (goto-char (point-max)) (nnshimbun-insert-nov (setq i (1+ i)) header) (when pre-fetch (nnshimbun-request-article-1 i group nil nnshimbun-buffer))))) - (nnshimbun-write-nov group))) + (nnshimbun-write-nov group))) (defun nnshimbun-replace-nov-entry (group article header &optional id) (with-current-buffer (nnshimbun-open-nov group) @@ -607,7 +641,7 @@ and the NOV is open. The optional fourth argument FORCE is ignored." ;; Prefer the shimbun's default to `nnmail-expiry-wait' ;; only when the group's parameter is nil. (nnmail-expiry-wait - (or (gnus-group-find-parameter name 'expiry-wait) + (or (nnshimbun-find-parameter name 'expiry-wait t) (shimbun-article-expiration-days nnshimbun-shimbun) nnmail-expiry-wait)) article end time) -- 1.7.10.4