From: teranisi Date: Sat, 26 Feb 2005 07:17:13 +0000 (+0000) Subject: * modb-standard.el (elmo-msgdb-set-flag): Use X-Git-Tag: wl-2_14-root~21 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=0ca341e266ce3baf389b01f9d4c1ed4568ee6b0d;p=elisp%2Fwanderlust.git * modb-standard.el (elmo-msgdb-set-flag): Use `elmo-list-diff-nonsortable' instead of `elmo-list-diff'. (elmo-msgdb-unset-flag): Ditto. * elmo.el (elmo-strict-folder-diff): Don't use third argument of `elmo-list-diff'. * elmo-util.el (elmo-list-diff): Rewrite. (elmo-list-diff-nonsortable): New function. --- diff --git a/elmo/ChangeLog b/elmo/ChangeLog index e342940..a63ac67 100644 --- a/elmo/ChangeLog +++ b/elmo/ChangeLog @@ -1,3 +1,15 @@ +2005-02-26 Yuuichi Teranishi + + * modb-standard.el (elmo-msgdb-set-flag): Use + `elmo-list-diff-nonsortable' instead of `elmo-list-diff'. + (elmo-msgdb-unset-flag): Ditto. + + * elmo.el (elmo-strict-folder-diff): Don't use third argument of + `elmo-list-diff'. + + * elmo-util.el (elmo-list-diff): Rewrite. + (elmo-list-diff-nonsortable): New function. + 2005-02-26 Tetsurou Okazaki * elmo-util.el (elmo-multibyte-buffer-name): Renamed from diff --git a/elmo/elmo-util.el b/elmo/elmo-util.el index f7a3ed1..dc06f2d 100644 --- a/elmo/elmo-util.el +++ b/elmo/elmo-util.el @@ -738,9 +738,38 @@ the directory becomes empty after deletion." (setq list (cdr list))) ret-val)) -(defun elmo-list-diff (list1 list2 &optional mes) - (if mes - (message "%s" mes)) +(defun elmo-list-diff (list1 list2) + (let ((clist1 (sort (copy-sequence list1) #'<)) + (clist2 (sort (copy-sequence list2) #'<)) + list1-only list2-only) + (while (or clist1 clist2) + (cond + ((null clist1) + (while clist2 + (setq list2-only (cons (car clist2) list2-only)) + (setq clist2 (cdr clist2)))) + ((null clist2) + (while clist1 + (setq list1-only (cons (car clist1) list1-only)) + (setq clist1 (cdr clist1)))) + ((< (car clist1) (car clist2)) + (while (not (eq (car clist1) (car clist2))) + (setq list1-only (cons (car clist1) list1-only)) + (setq clist1 (cdr clist1))) + (setq clist1 (cdr clist1) + clist2 (cdr clist2))) + ((< (car clist2) (car clist1)) + (while (not (eq (car clist1) (car clist2))) + (setq list2-only (cons (car clist2) list2-only)) + (setq clist2 (cdr clist2))) + (setq clist1 (cdr clist1) + clist2 (cdr clist2))) + ((= (car clist1) (car clist2)) + (setq clist1 (cdr clist1) + clist2 (cdr clist2))))) + (list list1-only list2-only))) + +(defun elmo-list-diff-nonsortable (list1 list2) (let ((clist1 (copy-sequence list1)) (clist2 (copy-sequence list2))) (while list2 @@ -749,8 +778,6 @@ the directory becomes empty after deletion." (while list1 (setq clist2 (delq (car list1) clist2)) (setq list1 (cdr list1))) - (if mes - (message "%sdone" mes)) (list clist1 clist2))) (defun elmo-list-bigger-diff (list1 list2 &optional mes) diff --git a/elmo/elmo.el b/elmo/elmo.el index f077837..13b4e17 100644 --- a/elmo/elmo.el +++ b/elmo/elmo.el @@ -973,7 +973,7 @@ If optional argument IF-EXISTS is nil, load on demand. append-list delete-list diff) (cons (if (equal in-folder in-db) 0 - (setq diff (elmo-list-diff in-folder in-db nil)) + (setq diff (elmo-list-diff in-folder in-db)) (setq append-list (car diff)) (setq delete-list (cadr diff)) (if append-list diff --git a/elmo/modb-standard.el b/elmo/modb-standard.el index 73d883f..7abb55a 100644 --- a/elmo/modb-standard.el +++ b/elmo/modb-standard.el @@ -327,7 +327,7 @@ When non-nil, redundunt message-id string are not saved." new-flags diff) (unless (memq flag cur-flags) (setq new-flags (cons flag cur-flags)) - (setq diff (elmo-list-diff new-flags cur-flags)) + (setq diff (elmo-list-diff-nonsortable 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) @@ -354,7 +354,7 @@ When non-nil, redundunt message-id string are not saved." new-flags diff) (when (memq flag cur-flags) (setq new-flags (delq flag (copy-sequence cur-flags))) - (setq diff (elmo-list-diff new-flags cur-flags)) + (setq diff (elmo-list-diff-nonsortable 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)