From 87dae4320b0ff31d22e9de9166ed77284323f6b2 Mon Sep 17 00:00:00 2001 From: hmurata Date: Fri, 16 Apr 2004 18:48:41 +0000 Subject: [PATCH] 2004-04-16 YAMASHITA Junji * elmo.el (elmo-folder-list-messages): Use elmo-uniq-sorted-list. * elmo-nntp.el (elmo-nntp-make-msglist): Use elmo-make-number-list. * elmo-util.el (elmo-uniq-sorted-list): New function. (elmo-make-number-list): Ditto. (elmo-number-set-to-number-list): Use elmo-make-number-list and don't use nreverse. --- elmo/ChangeLog | 11 +++++++++++ elmo/elmo-util.el | 30 +++++++++++++++++++++++------- elmo/elmo.el | 6 +++--- 3 files changed, 37 insertions(+), 10 deletions(-) diff --git a/elmo/ChangeLog b/elmo/ChangeLog index d4b6ab0..4d363bf 100644 --- a/elmo/ChangeLog +++ b/elmo/ChangeLog @@ -1,3 +1,14 @@ +2004-04-16 YAMASHITA Junji + + * elmo.el (elmo-folder-list-messages): Use elmo-uniq-sorted-list. + + * elmo-nntp.el (elmo-nntp-make-msglist): Use elmo-make-number-list. + + * elmo-util.el (elmo-uniq-sorted-list): New function. + (elmo-make-number-list): Ditto. + (elmo-number-set-to-number-list): Use elmo-make-number-list + and don't use nreverse. + 2004-04-16 Hiroya Murata * elmo-version.el (elmo-version): Up to 2.11.25. diff --git a/elmo/elmo-util.el b/elmo/elmo-util.el index f76e85a..dd0a681 100644 --- a/elmo/elmo-util.el +++ b/elmo/elmo-util.el @@ -349,6 +349,16 @@ Return value is a cons cell of (STRUCTURE . REST)" (cdr tmp))))))) lst) +(defun elmo-uniq-sorted-list (list &optional equal-function) + "Distractively uniqfy elements of sorted LIST." + (setq equal-function (or equal-function #'equal)) + (let ((list list)) + (while list + (while (funcall equal-function (car list) (cadr list)) + (setcdr list (cddr list))) + (setq list (cdr list)))) + list) + (defun elmo-list-insert (list element after) (let* ((match (memq after list)) (rest (and match (cdr (memq after list))))) @@ -1538,21 +1548,27 @@ NUMBER-SET is altered." (setq number-set-1 (nconc number-set-1 (list number)))) number-set-1)) +(defun elmo-make-number-list (beg end) + (let (number-list i) + (setq i end) + (while (>= i beg) + (setq number-list (cons i number-list)) + (setq i (1- i))) + number-list)) + (defun elmo-number-set-to-number-list (number-set) "Return a number list which corresponds to NUMBER-SET." - (let (number-list elem i) + (let ((number-list (list 'dummy)) + elem) (while number-set (setq elem (car number-set)) (cond ((consp elem) - (setq i (car elem)) - (while (<= i (cdr elem)) - (setq number-list (cons i number-list)) - (incf i))) + (nconc number-list (elmo-make-number-list (car elem) (cdr elem)))) ((integerp elem) - (setq number-list (cons elem number-list)))) + (nconc number-list (list elem)))) (setq number-set (cdr number-set))) - (nreverse number-list))) + (cdr number-list))) (defcustom elmo-list-subdirectories-ignore-regexp "^\\(\\.\\.?\\|[0-9]+\\)$" "*Regexp to filter subfolders." diff --git a/elmo/elmo.el b/elmo/elmo.el index 0dcfae0..59c6b86 100644 --- a/elmo/elmo.el +++ b/elmo/elmo.el @@ -233,9 +233,9 @@ If second optional IN-MSGDB is non-nil, only messages in the msgdb are listed.") (if visible-only (elmo-living-messages list killed-list) (if in-msgdb - (elmo-uniq-list - (nconc (elmo-number-set-to-number-list killed-list) list) - #'delq) + (elmo-uniq-sorted-list + (sort (nconc (elmo-number-set-to-number-list killed-list) list) #'<) + #'eq) list)))) (luna-define-generic elmo-folder-list-messages-internal (folder &optional -- 1.7.10.4