From 1daec21c938335f20d21eedbf6131e9f91894951 Mon Sep 17 00:00:00 2001 From: tsuchiya Date: Fri, 8 Jun 2001 22:39:23 +0000 Subject: [PATCH] * lisp/nnshimbun.el (top-level): Updated comments. (nnshimbun): New customize group. (nnshimbun-keep-last-article): Defined as customize variable. (nnshimbun-keep-unparsable-dated-articles): Ditto. (nnshimbun-insert-nov): Use `when' instead of `if'. (gnus-group-shimbun-server-history): Imported from `gnus-group.el'. (gnus-group-make-shimbun-group): Ditto. * lisp/gnus-group.el (gnus-group-make-shimbun-group): Its real definition is moved to `nnshimbun.el' and autload code is added. (gnus-group-shimbun-server-history): Its definition is moved to `nnshimbun.el'. --- ChangeLog | 16 ++++++++ lisp/gnus-group.el | 38 +------------------ lisp/nnshimbun.el | 106 +++++++++++++++++++++++++++++++++++++--------------- 3 files changed, 94 insertions(+), 66 deletions(-) diff --git a/ChangeLog b/ChangeLog index 646eb69..4ba5fcf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2001-06-09 TSUCHIYA Masatoshi + + * lisp/nnshimbun.el (top-level): Updated comments. + (nnshimbun): New customize group. + (nnshimbun-keep-last-article): Defined as customize variable. + (nnshimbun-keep-unparsable-dated-articles): Ditto. + (nnshimbun-insert-nov): Use `when' instead of `if'. + (gnus-group-shimbun-server-history): Imported from + `gnus-group.el'. + (gnus-group-make-shimbun-group): Ditto. + + * lisp/gnus-group.el (gnus-group-make-shimbun-group): Its real + definition is moved to `nnshimbun.el' and autload code is added. + (gnus-group-shimbun-server-history): Its definition is moved to + `nnshimbun.el'. + 2001-06-08 TSUCHIYA Masatoshi * lisp/nnshimbun.el (nnshimbun-use-entire-index): Removed. diff --git a/lisp/gnus-group.el b/lisp/gnus-group.el index ff81bf7..2a7e530 100644 --- a/lisp/gnus-group.el +++ b/lisp/gnus-group.el @@ -2426,42 +2426,8 @@ If SOLID (the prefix), create a solid group." (nnwarchive-login ,login)))) (gnus-group-make-group group method))) -(defvar gnus-group-shimbun-server-history nil) - -(defun gnus-group-make-shimbun-group () - "Create a nnshimbun group." - (interactive) - (require 'nnshimbun) - (let* ((minibuffer-setup-hook - (append minibuffer-setup-hook '(beginning-of-line))) - (alist - (apply 'nconc - (mapcar - (lambda (d) - (and (stringp d) - (file-directory-p d) - (delq nil - (mapcar - (lambda (f) - (and (string-match "^sb-\\(.*\\)\\.el$" f) - (list (match-string 1 f)))) - (directory-files d))))) - load-path))) - (server (completing-read - "Shimbun address: " - alist nil t - (or (car gnus-group-shimbun-server-history) - (caar alist)) - 'gnus-group-shimbun-server-history)) - (groups) - (nnshimbun-pre-fetch-article)) - (require (intern (concat "sb-" server))) - (when (setq groups (intern-soft (concat "shimbun-" server "-groups"))) - (gnus-group-make-group - (completing-read "Group name: " - (mapcar 'list (symbol-value groups)) - nil t nil) - (list 'nnshimbun server))))) +(autoload 'gnus-group-make-shimbun-group + "nnshimbun" "Create a nnshimbun group." t) (defun gnus-group-make-archive-group (&optional all) "Create the (ding) Gnus archive group of the most recent articles. diff --git a/lisp/nnshimbun.el b/lisp/nnshimbun.el index 000d067..3a1c393 100644 --- a/lisp/nnshimbun.el +++ b/lisp/nnshimbun.el @@ -35,23 +35,16 @@ ;; http://ei5nazha.yz.yamagata-u.ac.jp/~aito/w3m/ ;; If you would like to use this module in Gnus (not T-gnus), put this -;; file into the lisp/ directory in the Gnus source tree and run -;; `make install'. And then, copy the function definition of -;; `gnus-group-make-shimbun-group' from the file gnus-group.el of -;; T-gnus to somewhere else, for example .gnus file as follows: -;; -;;(eval-after-load "gnus-group" -;; '(if (not (fboundp 'gnus-group-make-shimbun-group)) -;; (defun gnus-group-make-shimbun-group () -;; "Create a nnshimbun group." -;; [...a function definition...]))) +;; file into the lisp/ directory in the Gnus source tree and run `make +;; install'. And then, put the following expression into your ~/.gnus. -;;; Definitions: +;; (autoload 'gnus-group-make-shimbun-group +;; "nnshimbun" "Create a nnshimbun group." t) -(gnus-declare-backend "nnshimbun" 'address) -(eval-when-compile (require 'cl)) +;;; Definitions: +(eval-when-compile (require 'cl)) (require 'nnheader) (require 'nnmail) (require 'nnoo) @@ -60,6 +53,26 @@ (require 'message) +;; Customize variables +(defgroup nnshimbun nil + "Reading Web Newspapers with Gnus." + :group 'gnus) + +(defcustom nnshimbun-keep-last-article t + "*If non-nil, nnshimbun will never delete a group's last article. +It can be marked expirable, so it will be deleted when it is no +longer last." + :group 'nnshimbun + :type 'boolean) + +(defcustom nnshimbun-keep-unparsable-dated-articles t + "*If non-nil, nnshimbun will never delete articles whose NOV date is unparsable." + :group 'nnshimbun + :type 'boolean) + + +;; Define baekend +(gnus-declare-backend "nnshimbun" 'address) (nnoo-declare nnshimbun) (defvoo nnshimbun-directory (nnheader-concat gnus-directory "shimbun/") @@ -394,11 +407,11 @@ also be nil." (insert "Xref: " xref "\t") (when id (insert "X-Nnshimbun-Id: " id "\t"))) - (if id - (insert "\tX-Nnshimbun-Id: " id "\t"))) + (when id + (insert "\tX-Nnshimbun-Id: " id "\t"))) ;; Replace newlines with spaces in the current NOV line. (while (progn - (beginning-of-line) + (forward-line 0) (> (point) start)) (backward-delete-char 1) (insert " ")) @@ -452,11 +465,11 @@ also be nil." (forward-line 1) (forward-line 0) (setq found t)))) - (if found - (if nov - (nnheader-parse-nov) - ;; We return the article number. - (ignore-errors (read (current-buffer)))))))) + (when found + (if nov + (nnheader-parse-nov) + ;; We return the article number. + (ignore-errors (read (current-buffer)))))))) (defun nnshimbun-open-nov (group) (let ((buffer (cdr (assoc group nnshimbun-nov-buffer-alist)))) @@ -499,15 +512,6 @@ also be nil." (kill-buffer (current-buffer))) (setq nnshimbun-nov-buffer-alist (cdr nnshimbun-nov-buffer-alist))))) -(defvar nnshimbun-keep-last-article t - "*If non-nil, nnshimbun will never delete a group's last article. It -can be marked expirable, so it will be deleted when it is no longer -last.") - -(defvar nnshimbun-keep-unparsable-dated-articles t - "*If non-nil, nnshimbun will never delete articles whose NOV date is -unparsable.") - (deffoo nnshimbun-request-expire-articles (articles group &optional server force) "Do expiration for the specified ARTICLES in the nnshimbun GROUP. @@ -615,5 +619,47 @@ and the NOV is open. The optional fourth argument FORCE is ignored." id)) + +;;; Command to create nnshimbun group + +(defvar gnus-group-shimbun-server-history nil) + +;;;###autoload +(defun gnus-group-make-shimbun-group () + "Create a nnshimbun group." + (interactive) + (require 'nnshimbun) + (let* ((minibuffer-setup-hook + (append minibuffer-setup-hook '(beginning-of-line))) + (alist + (apply 'nconc + (mapcar + (lambda (d) + (and (stringp d) + (file-directory-p d) + (delq nil + (mapcar + (lambda (f) + (and (string-match "^sb-\\(.*\\)\\.el$" f) + (list (match-string 1 f)))) + (directory-files d))))) + load-path))) + (server (completing-read + "Shimbun address: " + alist nil t + (or (car gnus-group-shimbun-server-history) + (caar alist)) + 'gnus-group-shimbun-server-history)) + (groups) + (nnshimbun-pre-fetch-article)) + (require (intern (concat "sb-" server))) + (when (setq groups (intern-soft (concat "shimbun-" server "-groups"))) + (gnus-group-make-group + (completing-read "Group name: " + (mapcar 'list (symbol-value groups)) + nil t nil) + (list 'nnshimbun server))))) + + (provide 'nnshimbun) ;;; nnshimbun.el ends here. -- 1.7.10.4