Importing pgnus-0.13
[elisp/gnus.git-] / lisp / gnus-cache.el
index b6a2248..bce2f54 100644 (file)
@@ -74,6 +74,9 @@ it's not cached."
   :type '(choice (const :tag "off" nil)
                 regexp))
 
+(defvar gnus-cache-overview-coding-system 'raw-text
+  "Coding system used on Gnus cache files.")
+
 \f
 
 ;;; Internal variables.
@@ -121,7 +124,9 @@ it's not cached."
          (set-buffer buffer)
          (if (> (buffer-size) 0)
              ;; Non-empty overview, write it to a file.
-             (gnus-write-buffer overview-file)
+             (let ((coding-system-for-write
+                    gnus-cache-overview-coding-system))
+               (gnus-write-buffer overview-file))
            ;; Empty overview file, remove it
            (when (file-exists-p overview-file)
              (delete-file overview-file))
@@ -150,7 +155,7 @@ it's not cached."
              headers (copy-sequence headers))
        (mail-header-set-number headers (cdr result))))
     (let ((number (mail-header-number headers))
-         file dir)
+         file)
       (when (and number
                 (> number 0)           ; Reffed article.
                 (or force
@@ -164,7 +169,7 @@ it's not cached."
                 (not (file-exists-p (setq file (gnus-cache-file-name
                                                 group number)))))
        ;; Possibly create the cache directory.
-       (gnus-make-directory (setq dir (file-name-directory file)))
+       (gnus-make-directory (file-name-directory file))
        ;; Save the article in the cache.
        (if (file-exists-p file)
            t                           ; The article already is saved.
@@ -388,7 +393,8 @@ Returns the list of articles removed."
     (save-excursion
       (setq gnus-cache-buffer
            (cons group
-                 (set-buffer (gnus-get-buffer-create " *gnus-cache-overview*"))))
+                 (set-buffer (gnus-get-buffer-create
+                              " *gnus-cache-overview*"))))
       (buffer-disable-undo (current-buffer))
       ;; Insert the contents of this group's cache overview.
       (erase-buffer)
@@ -589,7 +595,7 @@ $ emacs -batch -l ~/.emacs -l gnus -f gnus-jog-cache"
   (when (or force
            (and gnus-cache-active-hashtb
                 gnus-cache-active-altered))
-    (nnheader-temp-write gnus-cache-active-file
+    (with-temp-file gnus-cache-active-file
       (mapatoms
        (lambda (sym)
         (when (and sym (boundp sym))