From: kaoru Date: Sun, 30 Jan 2005 15:01:56 +0000 (+0000) Subject: * wl-thread.el (wl-thread-save-top-list) X-Git-Tag: wl-2_14-root~68 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=95bf3e6af3bb3c0048ab8b1134729b532c638471;p=elisp%2Fwanderlust.git * 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. --- diff --git a/wl/ChangeLog b/wl/ChangeLog index 6dc114c..c702193 100644 --- a/wl/ChangeLog +++ b/wl/ChangeLog @@ -1,3 +1,12 @@ +2005-01-30 TAKAHASHI Kaoru + + * 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 * wl-util.el (toplevel): Require 'elmo-flag'. diff --git a/wl/wl-news.el.in b/wl/wl-news.el.in index 4ca7839..1996f83 100644 --- a/wl/wl-news.el.in +++ b/wl/wl-news.el.in @@ -68,42 +68,33 @@ ;;; -*- 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) diff --git a/wl/wl-summary.el b/wl/wl-summary.el index 3cc4b96..d895a91 100644 --- a/wl/wl-summary.el +++ b/wl/wl-summary.el @@ -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)))))) diff --git a/wl/wl-thread.el b/wl/wl-thread.el index ad69175..0979da1 100644 --- a/wl/wl-thread.el +++ b/wl/wl-thread.el @@ -119,30 +119,22 @@ (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))