Cosmetic fix.
[gnus] / lisp / nnspool.el
index ca3616b..ecc2872 100644 (file)
@@ -1,16 +1,19 @@
 ;;; nnspool.el --- spool access for GNU Emacs
-;; Copyright (C) 1988,89,90,93,94,95,96 Free Software Foundation, Inc.
+
+;; Copyright (C) 1988, 1989, 1990, 1993, 1994, 1995, 1996, 1997, 1998,
+;;   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
+;;   Free Software Foundation, Inc.
 
 ;; Author: Masanobu UMEDA <umerin@flab.flab.fujitsu.junet>
-;;     Lars Magne Ingebrigtsen <larsi@ifi.uio.no>
+;;     Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; Keywords: news
 
 ;; This file is part of GNU Emacs.
 
-;; GNU Emacs is free software; you can redistribute it and/or modify
+;; GNU Emacs is free software: you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
-;; any later version.
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -18,9 +21,7 @@
 ;; GNU General Public License for more details.
 
 ;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
 
 ;;; Commentary:
 
@@ -28,7 +29,6 @@
 
 (require 'nnheader)
 (require 'nntp)
-(require 'timezone)
 (require 'nnoo)
 (eval-when-compile (require 'cl))
 
@@ -42,13 +42,19 @@ This is most commonly `inews' or `injnews'.")
   "Switches for nnspool-request-post to pass to `inews' for posting news.
 If you are using Cnews, you probably should set this variable to nil.")
 
-(defvoo nnspool-spool-directory (file-name-as-directory news-path)
+(defvoo nnspool-spool-directory
+    (file-name-as-directory (if (boundp 'news-directory)
+                               (symbol-value 'news-directory)
+                             news-path))
   "Local news spool directory.")
 
 (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")
@@ -57,7 +63,7 @@ If you are using Cnews, you probably should set this variable to nil.")
 (defvoo nnspool-newsgroups-file (concat nnspool-lib-dir "newsgroups")
   "Local news newsgroups file.")
 
-(defvoo nnspool-distributions-file (concat nnspool-lib-dir "distributions")
+(defvoo nnspool-distributions-file (concat nnspool-lib-dir "distribs.pat")
   "Local news distributions file.")
 
 (defvoo nnspool-history-file (concat nnspool-lib-dir "history")
@@ -67,8 +73,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,6 +88,9 @@ there.")
 (defvoo nnspool-rejected-article-hook nil
   "*A hook that will be run when an article has been rejected by the server.")
 
+(defvoo nnspool-file-coding-system nnheader-file-coding-system
+  "Coding system for nnspool.")
+
 \f
 
 (defconst nnspool-version "nnspool 2.0"
@@ -100,8 +109,7 @@ there.")
 
 (deffoo nnspool-retrieve-headers (articles &optional group server fetch-old)
   "Retrieve the headers of ARTICLES."
-  (save-excursion
-    (set-buffer nntp-server-buffer)
+  (with-current-buffer nntp-server-buffer
     (erase-buffer)
     (when (nnspool-possibly-change-directory group)
       (let* ((number (length articles))
@@ -109,6 +117,7 @@ there.")
             (default-directory nnspool-current-directory)
             (do-message (and (numberp nnspool-large-newsgroup)
                              (> number nnspool-large-newsgroup)))
+            (nnheader-file-coding-system nnspool-file-coding-system)
             file beg article ag)
        (if (and (numberp (car articles))
                 (nnspool-retrieve-headers-with-nov articles fetch-old))
@@ -119,7 +128,7 @@ there.")
            (if (stringp article)
                ;; This is a Message-ID.
                (setq ag (nnspool-find-id article)
-                     file (and ag (nnspool-article-pathname 
+                     file (and ag (nnspool-article-pathname
                                    (car ag) (cdr ag)))
                      article (cdr ag))
              ;; This is an article in the current group.
@@ -133,26 +142,31 @@ 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))))
-         
-         (and do-message
-              (message "nnspool: Receiving headers...done"))
-         
+                (nnheader-message&nb