From e458f269fc1394692cfbbde25707fb272d37fa40 Mon Sep 17 00:00:00 2001 From: hmurata Date: Sun, 7 Sep 2003 06:01:31 +0000 Subject: [PATCH] * elmo-pop3.el (elmo-pop3-sort-overview-by-original-number): Abolish. (elmo-pop3-sort-msgdb-by-original-number): Use `elmo-msgdb-sort-entities'. * elmo-msgdb.el (elmo-msgdb-sort-entities): New function. (elmo-msgdb-sort-by-date): Use it. (elmo-msgdb-overview-sort-by-date): Abolish. --- elmo/ChangeLog | 8 ++++++++ elmo/elmo-msgdb.el | 29 ++++++++++++++--------------- elmo/elmo-pop3.el | 32 ++++++++++++-------------------- 3 files changed, 34 insertions(+), 35 deletions(-) diff --git a/elmo/ChangeLog b/elmo/ChangeLog index 5ca311e..dd4a679 100644 --- a/elmo/ChangeLog +++ b/elmo/ChangeLog @@ -1,5 +1,13 @@ 2003-09-07 Hiroya Murata + * elmo-pop3.el (elmo-pop3-sort-overview-by-original-number): Abolish. + (elmo-pop3-sort-msgdb-by-original-number): Use + `elmo-msgdb-sort-entities'. + + * elmo-msgdb.el (elmo-msgdb-sort-entities): New function. + (elmo-msgdb-sort-by-date): Use it. + (elmo-msgdb-overview-sort-by-date): Abolish. + * elmo-dop.el (elmo-folder-status-dop): Fixed. * elmo-msgdb.el (elmo-msgdb-list-messages): Undo last change. diff --git a/elmo/elmo-msgdb.el b/elmo/elmo-msgdb.el index 8f91dc1..3422a01 100644 --- a/elmo/elmo-msgdb.el +++ b/elmo/elmo-msgdb.el @@ -154,7 +154,6 @@ ;; elmo-msgdb-create-overview-from-buffer NUMBER SIZE TIME ;; elmo-msgdb-copy-overview-entity ENTITY ;; elmo-msgdb-create-overview-entity-from-file NUMBER FILE -;; elmo-msgdb-overview-sort-by-date OVERVIEW ;; elmo-msgdb-clear-index ;; elmo-folder-get-info @@ -517,15 +516,27 @@ content of MSGDB is changed." (elmo-msgdb-set-index msgdb index) t)) ;return value -(defun elmo-msgdb-sort-by-date (msgdb) +(defun elmo-msgdb-sort-entities (msgdb predicate &optional app-data) (message "Sorting...") (let ((overview (elmo-msgdb-get-overview msgdb))) (elmo-msgdb-set-overview msgdb - (elmo-msgdb-overview-sort-by-date overview)) + (sort overview (lambda (a b) (funcall predicate a b app-data)))) (message "Sorting...done") msgdb)) +(defun elmo-msgdb-sort-by-date (msgdb) + (elmo-msgdb-sort-entities + msgdb + (lambda (x y app-data) + (condition-case nil + (string< + (timezone-make-date-sortable + (elmo-msgdb-overview-entity-get-date x)) + (timezone-make-date-sortable + (elmo-msgdb-overview-entity-get-date y))) + (error))))) + ;;; (defsubst elmo-msgdb-append-element (list element) (if list @@ -1287,18 +1298,6 @@ Header region is supposed to be narrowed." (narrow-to-region (point-min) header-end) (elmo-msgdb-create-overview-from-buffer number size mtime)))))) -(defun elmo-msgdb-overview-sort-by-date (overview) - (sort overview - (function - (lambda (x y) - (condition-case nil - (string< - (timezone-make-date-sortable - (elmo-msgdb-overview-entity-get-date x)) - (timezone-make-date-sortable - (elmo-msgdb-overview-entity-get-date y))) - (error)))))) - (defun elmo-msgdb-clear-index (msgdb entity) (let ((ehash (elmo-msgdb-get-entity-hashtb msgdb)) (mhash (elmo-msgdb-get-mark-hashtb msgdb)) diff --git a/elmo/elmo-pop3.el b/elmo/elmo-pop3.el index 9523450..dad3830 100644 --- a/elmo/elmo-pop3.el +++ b/elmo/elmo-pop3.el @@ -702,27 +702,19 @@ If IF-EXISTS is `any-exists', get BIFF session or normal session if exists." (if (elmo-pop3-folder-use-uidl-internal folder) (elmo-pop3-folder-location-alist-internal folder))))))) -(defun elmo-pop3-sort-overview-by-original-number (overview loc-alist) - (if loc-alist - (sort overview - (lambda (ent1 ent2) - (< (elmo-pop3-uidl-to-number - (cdr (assq (elmo-msgdb-overview-entity-get-number ent1) - loc-alist))) - (elmo-pop3-uidl-to-number - (cdr (assq (elmo-msgdb-overview-entity-get-number ent2) - loc-alist)))))) - overview)) - (defun elmo-pop3-sort-msgdb-by-original-number (folder msgdb) - (message "Sorting...") - (let ((overview (elmo-msgdb-get-overview msgdb))) - (elmo-msgdb-set-overview - msgdb - (elmo-pop3-sort-overview-by-original-number - overview - (elmo-pop3-folder-location-alist-internal folder))) - (message "Sorting...done") + (let ((location-alist (elmo-pop3-folder-location-alist-internal folder))) + (when location-alist + (elmo-msgdb-sort-entities + msgdb + (lambda (ent1 ent2 loc-alist) + (< (elmo-pop3-uidl-to-number + (cdr (assq (elmo-msgdb-overview-entity-get-number ent1) + loc-alist))) + (elmo-pop3-uidl-to-number + (cdr (assq (elmo-msgdb-overview-entity-get-number ent2) + loc-alist))))) + location-alist)) msgdb)) (defun elmo-pop3-uidl-to-number (uidl) -- 1.7.10.4