From 42f66fbe287d225c2ec50af83023c13c7bfd8ee7 Mon Sep 17 00:00:00 2001 From: bg66 Date: Mon, 25 Dec 2006 05:08:48 +0000 Subject: [PATCH] * mixi.el (mixi-save-cache): Change the location of cache files. (mixi-load-cache): Ditto. --- ChangeLog | 5 +++++ mixi.el | 73 ++++++++++++++++++++++++++++++++----------------------------- 2 files changed, 43 insertions(+), 35 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0f39637..aafc591 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2006-12-25 OHASHI Akira + * mixi.el (mixi-save-cache): Change the location of cache files. + (mixi-load-cache): Ditto. + +2006-12-25 OHASHI Akira + * sb-mixi.el (shimbun-get-headers): Use `mixi-bbs-p'. (shimbun-mixi-get-comment-p): Abolish. (shimbun-mixi-get-headers): Follow the change above. diff --git a/mixi.el b/mixi.el index fa11c4d..fee9297 100644 --- a/mixi.el +++ b/mixi.el @@ -579,27 +579,28 @@ Increase this value when unexpected error frequently occurs." mixi-cache-file-regexp)) (defun mixi-save-cache () - (unless (file-directory-p mixi-directory) - (make-directory mixi-directory t)) - (let ((caches (apropos-internal mixi-cache-regexp 'boundp))) - (mapc (lambda (symbol) - (with-temp-file (expand-file-name - (substring (symbol-name symbol) - (length mixi-object-prefix)) - mixi-directory) - (let ((coding-system-for-write mixi-coding-system) - (cache (symbol-value symbol))) - (insert "#s(hash-table size " - (number-to-string (hash-table-count cache)) - " test equal data (\n") - (maphash - (lambda (key value) - (let (print-level print-length) - (insert (prin1-to-string key) " " - (prin1-to-string value) "\n"))) - cache)) - (insert "))"))) - caches))) + (let ((cache-directory (expand-file-name "cache" mixi-directory))) + (unless (file-directory-p cache-directory) + (make-directory cache-directory t)) + (let ((caches (apropos-internal mixi-cache-regexp 'boundp))) + (mapc (lambda (symbol) + (with-temp-file (expand-file-name + (substring (symbol-name symbol) + (length mixi-object-prefix)) + cache-directory) + (let ((coding-system-for-write mixi-coding-system) + (cache (symbol-value symbol))) + (insert "#s(hash-table size " + (number-to-string (hash-table-count cache)) + " test equal data (\n") + (maphash + (lambda (key value) + (let (print-level print-length) + (insert (prin1-to-string key) " " + (prin1-to-string value) "\n"))) + cache)) + (insert "))"))) + caches)))) ;; stolen (and modified) from lsdb.el (defun mixi-read-cache (&optional marker) @@ -630,20 +631,22 @@ Increase this value when unexpected error frequently occurs." (read marker)))) (defun mixi-load-cache () - (when (file-directory-p mixi-directory) - ;; FIXME: Load friend and community first. - (let ((files (directory-files mixi-directory t mixi-cache-file-regexp))) - (mapc (lambda (file) - (let ((buffer (find-file-noselect file))) - (unwind-protect - (save-excursion - (set-buffer buffer) - (goto-char (point-min)) - (re-search-forward "^#s(") - (goto-char (match-beginning 0)) - (mixi-read-cache (point-marker))) - (kill-buffer buffer)))) - files)))) + (let ((cache-directory (expand-file-name "cache" mixi-directory))) + (when (file-directory-p cache-directory) + ;; FIXME: Load friend and community first. + (let ((files (directory-files cache-directory t + mixi-cache-file-regexp))) + (mapc (lambda (file) + (let ((buffer (find-file-noselect file))) + (unwind-protect + (save-excursion + (set-buffer buffer) + (goto-char (point-min)) + (re-search-forward "^#s(") + (goto-char (match-beginning 0)) + (mixi-read-cache (point-marker))) + (kill-buffer buffer)))) + files))))) ;; Friend object. (defvar mixi-friend-cache (make-hash-table :test 'equal)) -- 1.7.10.4