X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=lisp%2Fnnshimbun.el;h=e961d7801c19a1a89f9029b723c523297f6d9947;hb=9b741e050b400987d68ff761c6cc3276c932839c;hp=baf57a07b70c010f7dd9dd288045bcc9f7f00d93;hpb=fcdfb85830a56d070ebb30ba5da1174b3660b0b0;p=elisp%2Fgnus.git- diff --git a/lisp/nnshimbun.el b/lisp/nnshimbun.el index baf57a0..e961d78 100644 --- a/lisp/nnshimbun.el +++ b/lisp/nnshimbun.el @@ -1,13 +1,13 @@ ;;; nnshimbun.el --- interfacing with web newspapers +;; Copyright (C) 2000,2001,2002 TSUCHIYA Masatoshi + ;; Authors: TSUCHIYA Masatoshi , ;; Akihiro Arisawa , ;; Katsumi Yamaoka , ;; Yuuichi Teranishi ;; Keywords: news -;;; Copyright: - ;; This file is a part of Semi-Gnus. ;; This program is free software; you can redistribute it and/or modify @@ -103,6 +103,17 @@ ;; '(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 @@ -389,7 +400,14 @@ GROUP has a full name." (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" @@ -637,19 +655,20 @@ also be nil." (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))))) @@ -668,15 +687,20 @@ and the NOV is open. The optional fourth argument FORCE is ignored." (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) @@ -791,14 +815,13 @@ and the NOV is open. The optional fourth argument FORCE is ignored." '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