From: hmurata Date: Sat, 6 Sep 2003 14:12:01 +0000 (+0000) Subject: * elmo-map.el (elmo-folder-pack-numbers): Rewrite. X-Git-Tag: wl-2_11_11~9 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5a293ad4874a8e65fd5f5ce876eb0813df473219;p=elisp%2Fwanderlust.git * elmo-map.el (elmo-folder-pack-numbers): Rewrite. * elmo-localdir.el (elmo-folder-pack-numbers): Fixed last chagne. * elmo-msgdb.el (elmo-msgdb-append-entity): Fixed. --- diff --git a/elmo/ChangeLog b/elmo/ChangeLog index b593fbe..d869f8e 100644 --- a/elmo/ChangeLog +++ b/elmo/ChangeLog @@ -1,5 +1,11 @@ 2003-09-06 Hiroya Murata + * elmo-map.el (elmo-folder-pack-numbers): Rewrite. + + * elmo-localdir.el (elmo-folder-pack-numbers): Fixed last chagne. + + * elmo-msgdb.el (elmo-msgdb-append-entity): Fixed. + * elmo-util.el (elmo-with-progress-display): New macro. * elmo-localdir.el (elmo-folder-pack-numbers): Rewrite. diff --git a/elmo/elmo-localdir.el b/elmo/elmo-localdir.el index e128a3f..5e8d96c 100644 --- a/elmo/elmo-localdir.el +++ b/elmo/elmo-localdir.el @@ -340,9 +340,10 @@ (let* ((dir (elmo-localdir-folder-directory-internal folder)) (msgdb (elmo-folder-msgdb folder)) (new-msgdb (elmo-make-msgdb)) - (numbers (elmo-folder-list-messages - folder - (not elmo-pack-number-check-strict))) + (numbers (sort (elmo-folder-list-messages + folder + (not elmo-pack-number-check-strict)) + '<)) (new-number 1) ; first ordinal position in localdir total entity) (elmo-msgdb-set-path new-msgdb (elmo-folder-msgdb-path folder)) diff --git a/elmo/elmo-map.el b/elmo/elmo-map.el index 2657ea5..4d422a6 100644 --- a/elmo/elmo-map.el +++ b/elmo/elmo-map.el @@ -138,36 +138,27 @@ (luna-define-method elmo-folder-pack-numbers ((folder elmo-map-folder)) (let* ((msgdb (elmo-folder-msgdb folder)) - (old-number-alist (elmo-msgdb-get-number-alist msgdb)) - (old-overview (elmo-msgdb-get-overview msgdb)) - (old-mark-alist (elmo-msgdb-get-mark-alist msgdb)) - (old-location (elmo-map-folder-location-alist-internal folder)) - old-number overview number-alist mark-alist location - mark (number 1)) - (setq overview old-overview) - (while old-overview - (setq old-number - (elmo-msgdb-overview-entity-get-number (car old-overview))) - (elmo-msgdb-overview-entity-set-number (car old-overview) number) - (setq number-alist - (cons (cons number (cdr (assq old-number old-number-alist))) - number-alist)) - (when (setq mark (cadr (assq old-number old-mark-alist))) - (setq mark-alist - (elmo-msgdb-mark-append - mark-alist number mark))) - (setq location - (cons (cons number - (elmo-map-message-location folder old-number)) - location)) - (setq number (1+ number)) - (setq old-overview (cdr old-overview))) + (numbers (sort (elmo-folder-list-messages folder 'in-db) '<)) + (new-msgdb (elmo-make-msgdb)) + (number 1) + total location entity) + (elmo-msgdb-set-path new-msgdb (elmo-folder-msgdb-path folder)) + (setq total (length numbers)) + (elmo-with-progress-display (> total elmo-display-progress-threshold) + (elmo-folder-pack-numbers total "Packing...") + (dolist (old-number numbers) + (setq entity (elmo-msgdb-message-entity msgdb old-number)) + (elmo-msgdb-overview-entity-set-number entity number) + (elmo-msgdb-append-entity new-msgdb entity + (elmo-msgdb-get-mark msgdb old-number)) + (setq location + (cons (cons number + (elmo-map-message-location folder old-number)) + location)) + (setq number (1+ number)))) + (message "Packing...done") (elmo-map-folder-location-setup folder (nreverse location)) - (elmo-folder-set-msgdb-internal - folder - (elmo-make-msgdb overview - (nreverse number-alist) - (nreverse mark-alist))))) + (elmo-folder-set-msgdb-internal folder new-msgdb))) (defun elmo-map-folder-location-setup (folder locations) (elmo-map-folder-set-location-alist-internal diff --git a/elmo/elmo-msgdb.el b/elmo/elmo-msgdb.el index fc66b2b..4ea7e10 100644 --- a/elmo/elmo-msgdb.el +++ b/elmo/elmo-msgdb.el @@ -416,7 +416,7 @@ FLAG is a symbol which is one of the following: (elmo-msgdb-make-index msgdb (list entity) - (list (cons number mark)))))) + (list (list number mark)))))) (defsubst elmo-msgdb-get-number (msgdb message-id) "Get number of the message which corrensponds to MESSAGE-ID from MSGDB."