X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;ds=inline;f=lisp%2Fnnspool.el;h=cafc796041cc28a26fb40cf829360e616f10df92;hb=249142f014344b6f7e1a85fdebc289fd45819a84;hp=967a4c807e6cc937c9e6d8ebfde64b124d0f2563;hpb=4c2e20a67169654caf07221554d9e637d3f7bbfa;p=elisp%2Fgnus.git- diff --git a/lisp/nnspool.el b/lisp/nnspool.el index 967a4c8..cafc796 100644 --- a/lisp/nnspool.el +++ b/lisp/nnspool.el @@ -1,8 +1,11 @@ ;;; nnspool.el --- spool access for GNU Emacs -;; Copyright (C) 1988,89,90,93,94,95,96,97 Free Software Foundation, Inc. + +;; Copyright (C) 1988, 1989, 1990, 1993, 1994, 1995, 1996, 1997, 1998, +;; 2000, 2002, 2003 +;; Free Software Foundation, Inc. ;; Author: Masanobu UMEDA -;; Lars Magne Ingebrigtsen +;; Lars Magne Ingebrigtsen ;; Keywords: news ;; This file is part of GNU Emacs. @@ -28,7 +31,6 @@ (require 'nnheader) (require 'nntp) -(require 'timezone) (require 'nnoo) (eval-when-compile (require 'cl)) @@ -48,7 +50,10 @@ If you are using Cnews, you probably should set this variable to nil.") (defvoo nnspool-nov-directory (concat nnspool-spool-directory "over.view/") "Local news nov directory.") -(defvoo nnspool-lib-dir "/usr/lib/news/" +(defvoo nnspool-lib-dir + (if (file-exists-p "/usr/lib/news/active") + "/usr/lib/news/" + "/var/lib/news/") "Where the local news library files are stored.") (defvoo nnspool-active-file (concat nnspool-lib-dir "active") @@ -67,8 +72,8 @@ If you are using Cnews, you probably should set this variable to nil.") "Local news active date file.") (defvoo nnspool-large-newsgroup 50 - "The number of the articles which indicates a large newsgroup. -If the number of the articles is greater than the value, verbose + "The number of articles which indicates a large newsgroup. +If the number of articles is greater than the value, verbose messages will be shown to indicate the current status.") (defvoo nnspool-nov-is-evil nil @@ -82,7 +87,6 @@ there.") (defvoo nnspool-rejected-article-hook nil "*A hook that will be run when an article has been rejected by the server.") -;; 1997/8/14 by MORIOKA Tomohiko (defvoo nnspool-file-coding-system nnheader-file-coding-system "Coding system for nnspool.") @@ -138,18 +142,23 @@ there.") (setq beg (point)) (inline (nnheader-insert-head file)) (goto-char beg) - (search-forward "\n\n" nil t) - (forward-char -1) - (insert ".\n") + (if (search-forward "\n\n" nil t) + (progn + (forward-char -1) + (insert ".\n")) + (goto-char (point-max)) + (if (bolp) + (insert ".\n") + (insert "\n.\n"))) (delete-region (point) (point-max))) (and do-message (zerop (% (incf count) 20)) - (message "nnspool: Receiving headers... %d%%" - (/ (* count 100) number)))) + (nnheader-message 5 "nnspool: Receiving headers... %d%%" + (/ (* count 100) number)))) (when do-message - (message "nnspool: Receiving headers...done")) + (nnheader-message 5 "nnspool: Receiving headers...done")) ;; Fold continuation lines. (nnheader-fold-continuation-lines) @@ -235,8 +244,7 @@ there.") ;; Yes, completely empty spool directories *are* possible. ;; Fix by Sudish Joseph (when (setq dir (directory-files pathname nil "^[0-9]+$" t)) - (setq dir - (sort (mapcar (lambda (name) (string-to-int name)) dir) '<))) + (setq dir (sort (mapcar 'string-to-int dir) '<))) (if dir (nnheader-insert "211 %d %d %d %s\n" (length dir) (car dir) @@ -281,7 +289,7 @@ there.") (while (and (not (looking-at "\\([^ ]+\\) +\\([0-9]+\\)[0-9][0-9][0-9] ")) (zerop (forward-line -1)))) - (let ((seconds (nnspool-seconds-since-epoch date)) + (let ((seconds (time-to-seconds (date-to-time date))) groups) ;; Go through lines and add the latest groups to a list. (while (and (looking-at "\\([^ ]+\\) +[0-9]+ ") @@ -296,8 +304,8 @@ there.") (read (current-buffer))) seconds)) (push (buffer-substring - (match-beginning 1) (match-end 1)) - groups) + (match-beginning 1) (match-end 1)) + groups) (zerop (forward-line -1)))) (erase-buffer) (while groups @@ -322,7 +330,8 @@ there.") () (nnheader-report 'nnspool "") (set-process-sentinel proc 'nnspool-inews-sentinel) - (process-send-region proc (point-min) (point-max)) + (mm-with-unibyte-current-buffer + (process-send-region proc (point-min) (point-max))) ;; We slap a condition-case around this, because the process may ;; have exited already... (ignore-errors @@ -344,7 +353,7 @@ there.") (while (re-search-forward "[ \t\n]+" nil t) (replace-match " " t t)) (nnheader-report 'nnspool "%s" (buffer-string)) - (message "nnspool: %s" nnspool-status-string) + (nnheader-message 5 "nnspool: %s" nnspool-status-string) (ding) (run-hooks 'nnspool-rejected-article-hook)))) @@ -354,7 +363,7 @@ there.") (let ((nov (nnheader-group-pathname nnspool-current-group nnspool-nov-directory ".overview")) (arts articles) - (nnheader-file-coding-system nnspool-file-coding-system) + (nnheader-file-coding-system nnspool-file-coding-system) last) (if (not (file-exists-p nov)) () @@ -421,7 +430,6 @@ there.") (defun nnspool-find-id (id) (save-excursion (set-buffer (get-buffer-create " *nnspool work*")) - (buffer-disable-undo (current-buffer)) (erase-buffer) (ignore-errors (call-process "grep" nil t nil (regexp-quote id) nnspool-history-file)) @@ -436,8 +444,8 @@ there.") (set-buffer nntp-server-buffer) (erase-buffer) (condition-case () - (let ((nnheader-file-coding-system nnspool-file-coding-system)) - (nnheader-insert-file-contents file) + (let ((coding-system-for-read nnspool-file-coding-system)) + (mm-insert-file-contents file) t) (file-error nil))) @@ -451,21 +459,9 @@ there.") (nnheader-report 'nnspool "No such newsgroup: %s" group))))) (defun nnspool-article-pathname (group &optional article) - "Find the path for GROUP." + "Find the file name for GROUP." (nnheader-group-pathname group nnspool-spool-directory article)) -(defun nnspool-seconds-since-epoch (date) - (let* ((tdate (mapcar (lambda (ti) (and ti (string-to-int ti))) - (timezone-parse-date date))) - (ttime (mapcar (lambda (ti) (and ti (string-to-int ti))) - (timezone-parse-time - (aref (timezone-parse-date date) 3)))) - (unix (encode-time (nth 2 ttime) (nth 1 ttime) (nth 0 ttime) - (nth 2 tdate) (nth 1 tdate) (nth 0 tdate) - (nth 4 tdate)))) - (+ (* (car unix) 65536.0) - (cadr unix)))) - (provide 'nnspool) ;;; nnspool.el ends here