* wl-thread.el (wl-thread-save-top-list)
authorkaoru <kaoru>
Sun, 30 Jan 2005 15:01:56 +0000 (15:01 +0000)
committerkaoru <kaoru>
Sun, 30 Jan 2005 15:01:56 +0000 (15:01 +0000)
(wl-thread-save-entities): Use `with-temp-buffer'.
* wl-news.el.in (wl-news-previous-version-load):
(wl-news-previous-version-save): Ditto.
* wl-summary.el (wl-summary-load-file-object)
(wl-summary-save-view-cache): Ditto.

wl/ChangeLog
wl/wl-news.el.in
wl/wl-summary.el
wl/wl-thread.el

index 6dc114c..c702193 100644 (file)
@@ -1,3 +1,12 @@
+2005-01-30  TAKAHASHI Kaoru  <kaoru@kaisei.org>
+
+       * wl-thread.el (wl-thread-save-top-list)
+       (wl-thread-save-entities): Use `with-temp-buffer'.
+       * wl-news.el.in (wl-news-previous-version-load):
+       (wl-news-previous-version-save): Ditto.
+       * wl-summary.el (wl-summary-load-file-object)
+       (wl-summary-save-view-cache): Ditto.
+
 2005-01-30  Hiroya Murata  <lapis-lazuli@pop06.odn.ne.jp>
 
        * wl-util.el (toplevel): Require 'elmo-flag'.
index 4ca7839..1996f83 100644 (file)
 ;;; -*- news-list-end -*-
 
 (defun wl-news-previous-version-load ()
-  (save-excursion
+  (with-temp-buffer
     (let ((filename (expand-file-name
                     wl-news-version-file-name
                     elmo-msgdb-directory))
-         (tmp-buffer (get-buffer-create " *wl-news-version-tmp*"))
          insert-file-contents-pre-hook
          insert-file-contents-post-hook
          ret-val)
       (if (not (file-readable-p filename))
          (cons wl-news-default-previous-version
                wl-news-default-previous-version)
-       (set-buffer tmp-buffer)
        (insert-file-contents filename)
-       (setq ret-val
-             (condition-case nil
-                 (read (current-buffer))
-               (error nil nil)))
-       (kill-buffer tmp-buffer)
-       ret-val))))
+       (condition-case nil
+           (read (current-buffer))
+         (error nil nil))))))
 
 (defun wl-news-previous-version-save (current-version previous-version)
-  (save-excursion
+  (with-temp-buffer
     (let ((filename (expand-file-name
                     wl-news-version-file-name
                     elmo-msgdb-directory))
-         (tmp-buffer (get-buffer-create " *wl-news-version-tmp*"))
          print-length print-level)
-      (set-buffer tmp-buffer)
-      (erase-buffer)
-      (prin1 (cons current-version previous-version) tmp-buffer)
-      (princ "\n" tmp-buffer)
+      (prin1 (cons current-version previous-version) (current-buffer))
+      (princ "\n" (current-buffer))
       (if (file-writable-p filename)
          (write-region (point-min) (point-max)
                        filename nil 'no-msg)
-       (message "%s is not writable." filename))
-      (kill-buffer tmp-buffer))))
+       (message "%s is not writable." filename)))))
 
 (defun wl-news-append-news (lang previous-version &optional no-mime-tag)
   (require 'wl-mime)
index 3cc4b96..d895a91 100644 (file)
@@ -2193,21 +2193,16 @@ If ARG, without confirm."
 
 (defun wl-summary-load-file-object (filename)
   "Load lisp object from dir."
-  (save-excursion
-    (let ((tmp-buffer (get-buffer-create " *wl-summary-load-file-object*"))
-         insert-file-contents-pre-hook   ; To avoid autoconv-xmas...
+  (with-temp-buffer
+    (let (insert-file-contents-pre-hook        ; To avoid autoconv-xmas...
          insert-file-contents-post-hook
          ret-val)
       (if (not (file-readable-p filename))
          ()
-       (set-buffer tmp-buffer)
        (as-binary-input-file (insert-file-contents filename))
-       (setq ret-val
-             (condition-case nil
-                 (read (current-buffer))
-               (error (error "Reading failed")))))
-      (kill-buffer tmp-buffer)
-      ret-val)))
+       (condition-case nil
+           (read (current-buffer))
+         (error (error "Reading failed")))))))
 
 (defun wl-summary-goto-folder (&optional arg)
   (interactive "P")
@@ -3682,11 +3677,9 @@ Return non-nil if the mark is updated"
                  (write-region-as-binary (point-min)(point-max)
                                          cache nil 'no-msg)))
              (when (file-writable-p view) ; 'thread or 'sequence
-               (save-excursion
-                 (set-buffer tmp-buffer)
-                 (erase-buffer)
-                 (prin1 save-view tmp-buffer)
-                 (princ "\n" tmp-buffer)
+               (with-temp-buffer
+                 (prin1 save-view (current-buffer))
+                 (princ "\n" (current-buffer))
                  (write-region (point-min) (point-max) view nil 'no-msg))))
          ;; kill tmp buffer.
          (kill-buffer tmp-buffer))))))
index ad69175..0979da1 100644 (file)
 (defun wl-thread-save-top-list (dir)
   (let ((top-file (expand-file-name wl-thread-entity-list-file dir))
        (entity wl-thread-entity-list)
-       (tmp-buffer (get-buffer-create " *wl-thread-save-top-list*"))
        print-length)
-    (save-excursion
-      (set-buffer tmp-buffer)
-      (erase-buffer)
+    (with-temp-buffer
       (when (file-writable-p top-file)
-       (prin1 entity tmp-buffer)
-       (princ "\n" tmp-buffer)
-       (write-region (point-min) (point-max) top-file nil 'no-msg)
-       (kill-buffer tmp-buffer)))))
+       (prin1 entity (current-buffer))
+       (princ "\n" (current-buffer))
+       (write-region (point-min) (point-max) top-file nil 'no-msg)))))
 
 (defun wl-thread-save-entities (dir)
   (let ((top-file (expand-file-name wl-thread-entity-file dir))
        (entities wl-thread-entities)
-       (tmp-buffer (get-buffer-create " *wl-thread-save-entities*"))
        print-length print-level)
-    (save-excursion
-      (set-buffer tmp-buffer)
-      (erase-buffer)
+    (with-temp-buffer
       (when (file-writable-p top-file)
-       (prin1 entities tmp-buffer)
-       (princ "\n" tmp-buffer)
-       (write-region (point-min) (point-max) top-file nil 'no-msg)
-       (kill-buffer tmp-buffer)))))
+       (prin1 entities (current-buffer))
+       (princ "\n" (current-buffer))
+       (write-region (point-min) (point-max) top-file nil 'no-msg)))))
 
 (defsubst wl-thread-entity-get-number (entity)
   (nth 0 entity))