From: hmurata Date: Sat, 27 Sep 2003 10:39:30 +0000 (+0000) Subject: * wl-summary.el (wl-summary-sync-update): Don't call X-Git-Tag: wl-2_11_19~39 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=5af7a23034982853e41511c4455a570206b38701;p=elisp%2Fwanderlust.git * wl-summary.el (wl-summary-sync-update): Don't call wl-summary-update-status-marks. * modb.el (elmo-msgdb-flag-count): New API. * modb-standard.el (modb-standard): Added slot flag-count. (modb-standard-countup-flags): New function. (modb-standard-load-flag): Call it. (elmo-msgdb-append): Ditto. (elmo-msgdb-clear): Clear slot flag-count. (elmo-msgdb-set-flag): Call modb-standard-countup-flags. (elmo-msgdb-unset-flag): Treat `all' flag and call modb-standard-countup-flags. (elmo-msgdb-flag-count): Define. (elmo-msgdb-append-entity): Call modb-standard-countup-flags. (elmo-msgdb-delete-messages): Ditto. * modb-legacy.el (elmo-msgdb-unset-flag): Treat `all' flag. (elmo-msgdb-flag-count): Define. * elmo.el (elmo-folder-list-messages): Undo last change. (elmo-folder-count-flags): Use elmo-msgdb-flag-count. (elmo-folder-kill-messages): Unset all flags to numbers. * elmo-sendlog.el (elmo-folder-delete-messages): Rewrite; use elmo-folder-kill-messages. * elmo-nntp.el (elmo-folder-delete-messages): Ditto. (elmo-nntp-folder-delete-messages): Abolish. --- diff --git a/elmo/ChangeLog b/elmo/ChangeLog index 2ccd3c1..55c662c 100644 --- a/elmo/ChangeLog +++ b/elmo/ChangeLog @@ -1,5 +1,32 @@ 2003-09-27 Hiroya Murata + * modb.el (elmo-msgdb-flag-count): New API. + + * modb-standard.el (modb-standard): Added slot flag-count. + (modb-standard-countup-flags): New function. + (modb-standard-load-flag): Call it. + (elmo-msgdb-append): Ditto. + (elmo-msgdb-clear): Clear slot flag-count. + (elmo-msgdb-set-flag): Call modb-standard-countup-flags. + (elmo-msgdb-unset-flag): Treat `all' flag and call + modb-standard-countup-flags. + (elmo-msgdb-flag-count): Define. + (elmo-msgdb-append-entity): Call modb-standard-countup-flags. + (elmo-msgdb-delete-messages): Ditto. + + * modb-legacy.el (elmo-msgdb-unset-flag): Treat `all' flag. + (elmo-msgdb-flag-count): Define. + + * elmo.el (elmo-folder-list-messages): Undo last change. + (elmo-folder-count-flags): Use elmo-msgdb-flag-count. + (elmo-folder-kill-messages): Unset all flags to numbers. + + * elmo-sendlog.el (elmo-folder-delete-messages): Rewrite; use + elmo-folder-kill-messages. + + * elmo-nntp.el (elmo-folder-delete-messages): Ditto. + (elmo-nntp-folder-delete-messages): Abolish. + * elmo-version.el (elmo-version): Up to 2.11.18. 2003-09-26 Hiroya Murata diff --git a/elmo/elmo-nntp.el b/elmo/elmo-nntp.el index 04db75f..cfd8f05 100644 --- a/elmo/elmo-nntp.el +++ b/elmo/elmo-nntp.el @@ -1073,14 +1073,7 @@ Don't cache if nil.") (luna-define-method elmo-folder-delete-messages ((folder elmo-nntp-folder) numbers) - (elmo-nntp-folder-delete-messages folder numbers)) - -(defun elmo-nntp-folder-delete-messages (folder numbers) - (let ((killed-list (elmo-folder-killed-list-internal folder))) - (dolist (number numbers) - (setq killed-list - (elmo-msgdb-set-as-killed killed-list number))) - (elmo-folder-set-killed-list-internal folder killed-list)) + (elmo-folder-kill-messages folder numbers) t) (luna-define-method elmo-folder-exists-p-plugged ((folder elmo-nntp-folder)) diff --git a/elmo/elmo-sendlog.el b/elmo/elmo-sendlog.el index 4498a2c..937d2a1 100644 --- a/elmo/elmo-sendlog.el +++ b/elmo/elmo-sendlog.el @@ -129,11 +129,7 @@ (luna-define-method elmo-folder-delete-messages ((folder elmo-sendlog-folder) numbers) - (let ((killed-list (elmo-folder-killed-list-internal folder))) - (dolist (number numbers) - (setq killed-list - (elmo-msgdb-set-as-killed killed-list number))) - (elmo-folder-set-killed-list-internal folder killed-list)) + (elmo-folder-kill-messages folder numbers) t) (luna-define-method elmo-message-file-p ((folder elmo-sendlog-folder) number) diff --git a/elmo/elmo.el b/elmo/elmo.el index f376681..5e327ff 100644 --- a/elmo/elmo.el +++ b/elmo/elmo.el @@ -230,8 +230,7 @@ If second optional IN-MSGDB is non-nil, only messages in the msgdb are listed.") (setq list (elmo-msgdb-list-messages (elmo-folder-msgdb folder)))) (if visible-only (elmo-living-messages list killed-list) - (elmo-uniq-list - (nconc (elmo-number-set-to-number-list killed-list) list))))) + list))) (luna-define-generic elmo-folder-list-unreads (folder) "Return a list of unread message numbers contained in FOLDER.") @@ -1133,20 +1132,11 @@ ENTITY is the message-entity to get the parent.") Return a list of numbers (`new' `unread' `answered')") (luna-define-method elmo-folder-count-flags ((folder elmo-folder)) - (let ((new 0) - (unreads 0) - (answered 0) - flags) - (dolist (number (elmo-folder-list-messages folder 'visible 'in-msgdb)) - (setq flags (elmo-message-flags folder number)) - (cond - ((memq 'new flags) - (incf new)) - ((memq 'unread flags) - (incf unreads)) - ((memq 'answered flags) - (incf answered)))) - (list new unreads answered))) + (let* ((flag-count (elmo-msgdb-flag-count (elmo-folder-msgdb folder))) + (new (or (cdr (assq 'new flag-count)) 0)) + (unread (or (cdr (assq 'unread flag-count)) 0)) + (answered(or (cdr (assq 'answered flag-count)) 0))) + (list new (- unread new) answered))) (defun elmo-message-set-flag (folder number flag &optional is-local) "Set message flag. @@ -1401,10 +1391,12 @@ FIELD is a symbol of the field.") (defun elmo-folder-kill-messages (folder numbers) "Kill(hide) messages in the FOLDER with NUMBERS." - (elmo-folder-set-killed-list-internal - folder - (elmo-number-set-append-list (elmo-folder-killed-list-internal - folder) numbers))) + (let ((msgdb (elmo-folder-msgdb folder)) + (killed (elmo-folder-killed-list-internal folder))) + (dolist (number numbers) + (elmo-number-set-append killed number) + (elmo-msgdb-unset-flag msgdb number 'all)) + (elmo-folder-set-killed-list-internal folder killed))) (luna-define-method elmo-folder-clear ((folder elmo-folder) diff --git a/elmo/modb-legacy.el b/elmo/modb-legacy.el index 5aa69a0..d8e255d 100644 --- a/elmo/modb-legacy.el +++ b/elmo/modb-legacy.el @@ -390,6 +390,8 @@ Return a list of message numbers which have duplicated message-ids." (elmo-msgdb-set-flag msgdb number 'unread)) (uncached (elmo-msgdb-set-flag msgdb number 'cached)) + (all + (elmo-msgdb-set-mark msgdb number nil)) (t (let* ((cur-mark (elmo-msgdb-get-mark msgdb number)) (flags (modb-legacy-mark-to-flags cur-mark)) @@ -405,6 +407,23 @@ Return a list of message numbers which have duplicated message-ids." (unless (string= new-mark cur-mark) (elmo-msgdb-set-mark msgdb number new-mark)))))) +(luna-define-method elmo-msgdb-flag-count ((msgdb modb-legacy)) + (let ((new 0) + (unread 0) + (answered 0)) + (dolist (elem (elmo-msgdb-get-mark-alist msgdb)) + (cond + ((string= (cadr elem) modb-legacy-new-mark) + (incf new) + (incf unread)) + ((member (cadr elem) (modb-legacy-unread-marks)) + (incf unread)) + ((member (cadr elem) (modb-legacy-answered-marks)) + (incf answered)))) + (list (cons 'new new) + (cons 'unread unread) + (cons 'answered answered)))) + (luna-define-method elmo-msgdb-list-messages ((msgdb modb-legacy)) (mapcar 'elmo-msgdb-overview-entity-get-number-internal (elmo-msgdb-get-overview msgdb))) diff --git a/elmo/modb-standard.el b/elmo/modb-standard.el index e996b2d..7ef477a 100644 --- a/elmo/modb-standard.el +++ b/elmo/modb-standard.el @@ -55,6 +55,7 @@ (number-list ; sorted list of message numbers. entity-map ; number, msg-id -> entity mapping. flag-map ; number -> flag-list mapping + flag-count ; list of (FLAG . COUNT) )) (luna-define-internal-accessors 'modb-standard)) @@ -104,6 +105,15 @@ (throw 'done t)) (setq check-flags (cdr check-flags))))) +(defsubst modb-standard-countup-flags (modb flags &optional delta) + (let ((flag-count (modb-standard-flag-count-internal modb)) + (delta (or delta 1)) + elem) + (dolist (flag flags) + (if (setq elem (assq flag flag-count)) + (setcdr elem (+ (cdr elem) delta)) + (setq flag-count (cons (cons flag delta) flag-count)))) + (modb-standard-set-flag-count-internal modb flag-count))) ;; save and load functions (defun modb-standard-load-msgid (modb path) @@ -136,6 +146,7 @@ (elmo-make-hash (elmo-msgdb-length modb))))) (dolist (info (elmo-object-load (expand-file-name modb-standard-flag-filename path))) + (modb-standard-countup-flags modb (cdr info)) (elmo-set-hash-val (modb-standard-key (car info)) info table)) (modb-standard-set-flag-map-internal modb table))) @@ -254,6 +265,9 @@ (symbol-value atom) table)) (modb-standard-flag-map msgdb-append))) + ;; flag-count + (dolist (pair (modb-standard-flag-count-internal msgdb-append)) + (modb-standard-countup-flags msgdb (list (car pair)) (cdr pair))) ;; modification flags (dolist (number (modb-standard-number-list-internal msgdb-append)) (modb-standard-set-message-modified msgdb number) @@ -264,7 +278,8 @@ (luna-define-method elmo-msgdb-clear :after ((msgdb modb-standard)) (modb-standard-set-number-list-internal msgdb nil) (modb-standard-set-entity-map-internal msgdb nil) - (modb-standard-set-flag-map-internal msgdb nil)) + (modb-standard-set-flag-map-internal msgdb nil) + (modb-standard-set-flag-count-internal msgdb nil)) (luna-define-method elmo-msgdb-length ((msgdb modb-standard)) (length (modb-standard-number-list-internal msgdb))) @@ -281,7 +296,8 @@ (elmo-msgdb-unset-flag msgdb number 'cached)) (t (let* ((cur-flags (modb-standard-message-flags msgdb number)) - (new-flags (copy-sequence cur-flags))) + (new-flags (copy-sequence cur-flags)) + diff) (and (memq 'new new-flags) (setq new-flags (delq 'new new-flags))) (or (memq flag new-flags) @@ -290,6 +306,9 @@ (memq 'answered new-flags)) (setq new-flags (delq 'answered new-flags))) (unless (equal new-flags cur-flags) + (setq diff (elmo-list-diff new-flags cur-flags)) + (modb-standard-countup-flags msgdb (car diff)) + (modb-standard-countup-flags msgdb (cadr diff) -1) (elmo-set-hash-val (modb-standard-key number) (cons number new-flags) (modb-standard-flag-map msgdb)) @@ -302,9 +321,16 @@ (elmo-msgdb-set-flag msgdb number 'unread)) (uncached (elmo-msgdb-set-flag msgdb number 'cached)) + (all + (modb-standard-countup-flags msgdb + (modb-standard-message-flags msgdb number) + -1) + (elmo-clear-hash-val (modb-standard-key number) + (modb-standard-flag-map msgdb))) (t (let* ((cur-flags (modb-standard-message-flags msgdb number)) - (new-flags (copy-sequence cur-flags))) + (new-flags (copy-sequence cur-flags)) + diff) (and (memq 'new new-flags) (setq new-flags (delq 'new new-flags))) (and (memq flag new-flags) @@ -313,11 +339,17 @@ (memq 'answered new-flags)) (setq new-flags (delq 'answered new-flags))) (unless (equal new-flags cur-flags) + (setq diff (elmo-list-diff new-flags cur-flags)) + (modb-standard-countup-flags msgdb (car diff)) + (modb-standard-countup-flags msgdb (cadr diff) -1) (elmo-set-hash-val (modb-standard-key number) (cons number new-flags) (modb-standard-flag-map msgdb)) (modb-standard-set-flag-modified msgdb number)))))) +(luna-define-method elmo-msgdb-flag-count ((msgdb modb-standard)) + (modb-standard-flag-count-internal msgdb)) + (luna-define-method elmo-msgdb-list-messages ((msgdb modb-standard)) (copy-sequence (modb-standard-number-list-internal msgdb))) @@ -414,6 +446,7 @@ (modb-standard-key number) (cons number flags) (modb-standard-flag-map msgdb)) + (modb-standard-countup-flags msgdb flags) (modb-standard-set-flag-modified msgdb number)) duplicate)) @@ -431,6 +464,11 @@ ;; entity-map (elmo-clear-hash-val key entity-map) (elmo-clear-hash-val (modb-standard-entity-id entity) entity-map) + ;; flag-count (must be BEFORE flag-map) + (modb-standard-countup-flags + msgdb + (modb-standard-message-flags msgdb number) + -1) ;; flag-map (elmo-clear-hash-val key flag-map) (modb-standard-set-message-modified msgdb number) diff --git a/elmo/modb.el b/elmo/modb.el index 4011c41..a78f1ee 100644 --- a/elmo/modb.el +++ b/elmo/modb.el @@ -92,6 +92,10 @@ FLAG is a symbol which is one of the following: `answered' ... Message which is answered. `cached' ... Message which is cached.") +(luna-define-generic elmo-msgdb-flag-count (msgdb) + "Return a list of cons cell as (flag . count). +The count is number of message which is set flag in the MSGDB.") + (luna-define-generic elmo-msgdb-list-messages (msgdb) "Return a list of message numbers in the MSGDB.") diff --git a/wl/ChangeLog b/wl/ChangeLog index fa67f82..5d43e1d 100644 --- a/wl/ChangeLog +++ b/wl/ChangeLog @@ -1,5 +1,8 @@ 2003-09-27 Hiroya Murata + * wl-summary.el (wl-summary-sync-update): Don't call + wl-summary-update-status-marks. + * Version number is increased to 2.11.18. 2003-09-26 Yuuichi Teranishi diff --git a/wl/wl-summary.el b/wl/wl-summary.el index 23ac455..e5873eb 100644 --- a/wl/wl-summary.el +++ b/wl/wl-summary.el @@ -1763,7 +1763,6 @@ If ARG is non-nil, checking is omitted." (when delete-list (wl-summary-delete-messages-on-buffer delete-list)) - (wl-summary-update-status-marks) (setq num (length append-list)) (setq i 0) (setq wl-summary-delayed-update nil)