From: teranisi Date: Sun, 27 Feb 2005 11:22:59 +0000 (+0000) Subject: * elmo.el (elmo-folder-synchronize): Sort the return value of X-Git-Tag: wl-2_14-root~12 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7560262837bd2356825b05ee51e4b6c4f698f517;p=elisp%2Fwanderlust.git * elmo.el (elmo-folder-synchronize): Sort the return value of `elmo-list-diff'. * elmo-util.el (elmo-list-diff): Don't care the order of the returned list. * test-elmo-util.el (test-elmo-same-list-p): New function. (test-elmo-same-diff-p): Ditto. (test-elmo-list-diff): Use it. * wl-summary.el (wl-summary-sync-update): Sort the return value of `elmo-list-diff'. --- diff --git a/elmo/ChangeLog b/elmo/ChangeLog index 05bc91b..40cf7ac 100644 --- a/elmo/ChangeLog +++ b/elmo/ChangeLog @@ -1,3 +1,12 @@ +2005-02-27 Yuuichi Teranishi + + * elmo.el (elmo-folder-synchronize): Sort the return value of + `elmo-list-diff'. + + * elmo-util.el (elmo-list-diff): Don't care the order of the returned + list. + + 2005-02-27 Hiroya Murata * elmo-util.el (elmo-with-enable-multibyte): Don't bind diff --git a/elmo/elmo-util.el b/elmo/elmo-util.el index af42a75..6147ca6 100644 --- a/elmo/elmo-util.el +++ b/elmo/elmo-util.el @@ -762,7 +762,7 @@ the directory becomes empty after deletion." ((= (car clist1) (car clist2)) (setq clist1 (cdr clist1) clist2 (cdr clist2))))) - (list (nreverse list1-only) (nreverse list2-only)))) + (list list1-only list2-only))) (defun elmo-list-diff-nonsortable (list1 list2) (let ((clist1 (copy-sequence list1)) diff --git a/elmo/elmo.el b/elmo/elmo.el index 13b4e17..fdad8da 100644 --- a/elmo/elmo.el +++ b/elmo/elmo.el @@ -1539,6 +1539,7 @@ If update process is interrupted, return nil.") (elmo-list-diff (elmo-folder-list-messages folder) (elmo-folder-list-messages folder nil 'in-msgdb))) (when diff-new + (setq diff-new (sort diff-new #'<)) (unless disable-killed (setq diff-new (elmo-living-messages diff-new killed-list))) (when mask @@ -1549,7 +1550,7 @@ If update process is interrupted, return nil.") (when (not (eq (length diff-new) (length new-list))) (let* ((diff (elmo-list-diff diff-new new-list)) - (disappeared (car diff))) + (disappeared (sort (car diff) #'<))) (when disappeared (elmo-folder-kill-messages-range folder (car disappeared) diff --git a/tests/ChangeLog b/tests/ChangeLog index 96ba0f7..99e150c 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,9 @@ +2005-02-27 Yuuichi Teranishi + + * test-elmo-util.el (test-elmo-same-list-p): New function. + (test-elmo-same-diff-p): Ditto. + (test-elmo-list-diff): Use it. + 2005-02-27 Tetsurou Okazaki * test-elmo-util.el (test-elmo-list-diff): New testcase. diff --git a/tests/test-elmo-util.el b/tests/test-elmo-util.el index fabb65d..2d5a5e1 100644 --- a/tests/test-elmo-util.el +++ b/tests/test-elmo-util.el @@ -94,6 +94,23 @@ ;;; (equal '(1 2 "3" 5 4) ;;; (elmo-list-insert '(1 2 "3" 5) 4 "3")) +(defun test-elmo-same-list-p (list1 list2) + (let ((clist1 (copy-sequence list1)) + (clist2 (copy-sequence list2))) + (while list2 + (setq clist1 (delq (car list2) clist1)) + (setq list2 (cdr list2))) + (while list1 + (setq clist2 (delq (car list1) clist2)) + (setq list1 (cdr list1))) + (equal (list clist1 clist2) '(nil nil)))) + +(defun test-elmo-same-diff-p (diff1 diff2) + (and (test-elmo-same-list-p (car diff1) + (car diff2)) + (test-elmo-same-list-p (nth 1 diff1) + (nth 1 diff2)))) + (luna-define-method test-elmo-list-diff ((case test-elmo-util)) (let ((list1 '(1 2 3)) (list2 '(1 2 3 4)) @@ -101,32 +118,32 @@ (list4 '(4 5 6)) (list5 '(3 4 5 6))) (lunit-assert - (equal '(nil nil) - (elmo-list-diff nil nil))) + (test-elmo-same-diff-p '(nil nil) + (elmo-list-diff nil nil))) (lunit-assert - (equal '(nil (1 2 3)) - (elmo-list-diff nil list1))) + (test-elmo-same-diff-p '(nil (1 2 3)) + (elmo-list-diff nil list1))) (lunit-assert - (equal '((1 2 3) nil) - (elmo-list-diff list1 nil))) + (test-elmo-same-diff-p '((1 2 3) nil) + (elmo-list-diff list1 nil))) (lunit-assert - (equal '(nil nil) - (elmo-list-diff list1 list1))) + (test-elmo-same-diff-p '(nil nil) + (elmo-list-diff list1 list1))) (lunit-assert - (equal '(nil (4)) - (elmo-list-diff list1 list2))) + (test-elmo-same-diff-p '(nil (4)) + (elmo-list-diff list1 list2))) (lunit-assert - (equal '((3) (4)) - (elmo-list-diff list1 list3))) + (test-elmo-same-diff-p '((3) (4)) + (elmo-list-diff list1 list3))) (lunit-assert - (equal '((1 2 3) (4 5 6)) - (elmo-list-diff list1 list4))) + (test-elmo-same-diff-p '((1 2 3) (4 5 6)) + (elmo-list-diff list1 list4))) (lunit-assert - (equal '((1 2) (5 6)) - (elmo-list-diff list3 list4))) + (test-elmo-same-diff-p '((1 2) (5 6)) + (elmo-list-diff list3 list4))) (lunit-assert - (equal '((1 2) (3 5 6)) - (elmo-list-diff list3 list5))))) + (test-elmo-same-diff-p '((1 2) (3 5 6)) + (elmo-list-diff list3 list5))))) (luna-define-method test-elmo-delete-char-1 ((case test-elmo-util)) (lunit-assert diff --git a/wl/ChangeLog b/wl/ChangeLog index 4e9afcf..1ed32dc 100644 --- a/wl/ChangeLog +++ b/wl/ChangeLog @@ -1,3 +1,8 @@ +2005-02-27 Yuuichi Teranishi + + * wl-summary.el (wl-summary-sync-update): Sort the return value of + `elmo-list-diff'. + 2005-02-27 Hiroya Murata * wl-summary.el diff --git a/wl/wl-summary.el b/wl/wl-summary.el index 9275cef..8e23cce 100644 --- a/wl/wl-summary.el +++ b/wl/wl-summary.el @@ -1932,7 +1932,7 @@ This function is defined for `window-scroll-functions'" (not disable-killed) 'in-msgdb) wl-summary-buffer-number-list)) - (setq append-list (car diff)) + (setq append-list (sort (car diff) #'<)) (setq delete-list (cadr diff)) (when delete-list