From 1bc81d471a54b028d965fe271b2a5067f182e9aa Mon Sep 17 00:00:00 2001 From: hmurata Date: Mon, 3 Jul 2006 00:25:27 +0000 Subject: [PATCH] (elmo-folder-initialize): Set slot `number-list' as 'not-loaded. (elmo-folder-close): Ditto. (elmo-filter-folder-number-list-loaded-p): New function. (elmo-filter-folder-number-list): Check whether loaded or not. (elmo-folder-commit): Use `elmo-filter-folder-number-list' instead of `elmo-filter-folder-number-list-internal'. (elmo-folder-delete-messages): Ditto. (elmo-folder-length): Check whether number-list is loaded or not. --- elmo/ChangeLog | 12 ++++++++++++ elmo/elmo-filter.el | 24 ++++++++++++++++-------- 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/elmo/ChangeLog b/elmo/ChangeLog index 2603d6f..67d8036 100644 --- a/elmo/ChangeLog +++ b/elmo/ChangeLog @@ -1,3 +1,15 @@ +2006-07-03 Hiroya Murata + + * elmo-filter.el (elmo-folder-initialize): Set slot `number-list' + as 'not-loaded. + (elmo-folder-close): Ditto. + (elmo-filter-folder-number-list-loaded-p): New function. + (elmo-filter-folder-number-list): Check whether loaded or not. + (elmo-folder-commit): Use `elmo-filter-folder-number-list' instead + of `elmo-filter-folder-number-list-internal'. + (elmo-folder-delete-messages): Ditto. + (elmo-folder-length): Check whether number-list is loaded or not. + 2006-06-17 Hiroya Murata * modb-entity.el (modb-entity-field-extractor-alist): Add 3rd diff --git a/elmo/elmo-filter.el b/elmo/elmo-filter.el index 05d8b5a..5d3ec54 100644 --- a/elmo/elmo-filter.el +++ b/elmo/elmo-filter.el @@ -57,6 +57,7 @@ (elmo-folder-search-requires-msgdb-p (elmo-filter-folder-target-internal folder) (elmo-filter-folder-condition-internal folder))) + (elmo-filter-folder-set-number-list-internal folder 'not-loaded) (elmo-filter-connect-signals folder (elmo-filter-folder-target-internal folder)) @@ -103,11 +104,16 @@ (expand-file-name elmo-filter-number-filename dir) number-list)) +(defun elmo-filter-folder-number-list-loaded-p (folder) + (listp (elmo-filter-folder-number-list-internal folder))) + (defun elmo-filter-folder-number-list (folder) - (or (elmo-filter-folder-number-list-internal folder) + (let ((numbers (elmo-filter-folder-number-list-internal folder))) + (if (listp numbers) + numbers (elmo-filter-folder-set-number-list-internal folder - (elmo-filter-number-list-load (elmo-folder-msgdb-path folder))))) + (elmo-filter-number-list-load (elmo-folder-msgdb-path folder)))))) (defsubst elmo-filter-folder-countup-message-flags (folder numbers &optional delta) @@ -159,7 +165,7 @@ (luna-define-method elmo-folder-close ((folder elmo-filter-folder)) (elmo-generic-folder-close folder) - (elmo-filter-folder-set-number-list-internal folder nil) + (elmo-filter-folder-set-number-list-internal folder 'not-loaded) (elmo-filter-folder-set-flag-count-internal folder nil) (elmo-folder-close (elmo-filter-folder-target-internal folder))) @@ -172,9 +178,10 @@ (elmo-msgdb-killed-list-save (elmo-folder-msgdb-path folder) (elmo-folder-killed-list-internal folder)) - (elmo-filter-number-list-save - (elmo-folder-msgdb-path folder) - (elmo-filter-folder-number-list-internal folder)))) + (when (elmo-filter-folder-number-list-loaded-p folder) + (elmo-filter-number-list-save + (elmo-folder-msgdb-path folder) + (elmo-filter-folder-number-list folder))))) (luna-define-method elmo-folder-expand-msgdb-path ((folder elmo-filter-folder)) @@ -234,7 +241,7 @@ (let ((flag-count (elmo-filter-folder-copy-flag-count (elmo-filter-folder-flag-count-internal folder))) (messages (copy-sequence - (elmo-filter-folder-number-list-internal folder))) + (elmo-filter-folder-number-list folder))) success) (elmo-folder-detach-messages folder numbers) (unless (setq success @@ -489,7 +496,8 @@ t) (luna-define-method elmo-folder-length ((folder elmo-filter-folder)) - (length (elmo-filter-folder-number-list-internal folder))) + (and (elmo-filter-folder-number-list-loaded-p folder) + (length (elmo-filter-folder-number-list-internal folder)))) (require 'product) (product-provide (provide 'elmo-filter) (require 'elmo-version)) -- 1.7.10.4