;;; nnshimbun.el --- interfacing with web newspapers
+;; Copyright (C) 2000,2001,2002 TSUCHIYA Masatoshi <tsuchiya@namazu.org>
+
;; Authors: TSUCHIYA Masatoshi <tsuchiya@namazu.org>,
;; Akihiro Arisawa <ari@atesoft.advantest.co.jp>,
;; Katsumi Yamaoka <yamaoka@jpl.org>,
;; Yuuichi Teranishi <teranisi@gohome.org>
;; Keywords: news
-;;; Copyright:
-
;; This file is a part of Semi-Gnus.
;; This program is free software; you can redistribute it and/or modify
;; '(index-range all prefetch-articles off encapsulate-images on
;; expiry-wait 6)
+(unless (fboundp 'gnus-define-group-parameter)
+ (defmacro gnus-define-group-parameter (&rest args) nil)
+ (defun nnshimbun-find-group-parameters (name)
+ "Return a nnshimbun GROUP's group parameters."
+ (when name
+ (or (gnus-group-find-parameter name 'nnshimbun-group-parameters t)
+ (assoc-default name
+ (and (boundp 'nnshimbun-group-parameters-alist)
+ (symbol-value 'nnshimbun-group-parameters-alist))
+ (function string-match))))))
+
(gnus-define-group-parameter
nnshimbun-group-parameters
:type list
(deffoo nnshimbun-request-article (article &optional group server to-buffer)
(when (nnshimbun-possibly-change-group group server)
(when (stringp article)
- (setq article (nnshimbun-search-id group article)))
+ (let ((num (when (or group (setq group nnshimbun-current-group))
+ (nnshimbun-search-id group article))))
+ (unless num
+ (let ((groups (shimbun-groups (shimbun-open server))))
+ (while (and (not num) groups)
+ (setq group (pop groups)
+ num (nnshimbun-search-id group article)))))
+ (setq article num)))
(if (integerp article)
(nnshimbun-request-article-1 article group server to-buffer)
(nnheader-report 'nnshimbun "Couldn't retrieve article: %s"
(when (buffer-live-p buffer)
(save-excursion
(set-buffer buffer)
- (buffer-modified-p)
- (nnmail-write-region 1 (point-max) nnshimbun-nov-buffer-file-name
- nil 'nomesg)))))
+ (and (> (buffer-size) 0)
+ (buffer-modified-p)
+ (nnmail-write-region 1 (point-max) nnshimbun-nov-buffer-file-name
+ nil 'nomesg))))))
(defun nnshimbun-save-nov ()
(save-excursion
(while nnshimbun-nov-buffer-alist
(when (buffer-name (cdar nnshimbun-nov-buffer-alist))
(set-buffer (cdar nnshimbun-nov-buffer-alist))
- (when (buffer-modified-p)
- (nnmail-write-region 1 (point-max) nnshimbun-nov-buffer-file-name
- nil 'nomesg))
- (set-buffer-modified-p nil)
+ (and (> (buffer-size) 0)
+ (buffer-modified-p)
+ (nnmail-write-region 1 (point-max) nnshimbun-nov-buffer-file-name
+ nil 'nomesg))
(kill-buffer (current-buffer)))
(setq nnshimbun-nov-buffer-alist (cdr nnshimbun-nov-buffer-alist)))))
(let* ((expirable (copy-sequence articles))
(name (concat "nnshimbun+" server ":" group))
;; If the group's parameter `expiry-wait' is non-nil,
- ;; `nnmail-expiry-wait' is bound to that value, and
- ;; `nnmail-expiry-wait-function' is bound to nil.
- ;; See the source code of `gnus-summary-expire-articles'.
- ;; Prefer the shimbun's default to `nnmail-expiry-wait'
- ;; only when the group's parameter is nil.
- (nnmail-expiry-wait
+ ;; the value of the option `nnmail-expiry-wait' will be
+ ;; bound to that value, and the value of the option
+ ;; `nnmail-expiry-wait-function' will be bound to nil.
+ ;; See the source code of `gnus-summary-expire-articles'
+ ;; how does it work. If the group's parameter is not
+ ;; specified by user, the shimbun's default value will
+ ;; be used.
+ (expiry-wait
(or (nnshimbun-find-parameter name 'expiry-wait t)
- (shimbun-article-expiration-days nnshimbun-shimbun)
- nnmail-expiry-wait))
+ (shimbun-article-expiration-days nnshimbun-shimbun)))
+ (nnmail-expiry-wait (or expiry-wait nnmail-expiry-wait))
+ (nnmail-expiry-wait-function (if expiry-wait
+ nil
+ nnmail-expiry-wait-function))
article end time)
(save-excursion
(set-buffer buffer)
'nnshimbun-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)))))
+ (if (setq groups (shimbun-groups (shimbun-open server)))
+ (gnus-group-make-group
+ (completing-read "Group name: " (mapcar 'list groups) nil t nil)
+ (list 'nnshimbun server))
+ (error "%s" "Can't find group"))))
(provide 'nnshimbun)
-;;; nnshimbun.el ends here.
+
+;;; nnshimbun.el ends here