+2005-02-26 Yuuichi Teranishi <teranisi@gohome.org>
+
+ * 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 <okazaki@be.to>
* elmo-util.el (elmo-multibyte-buffer-name): Renamed from
(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
(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)
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
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)
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)