From: Stefan Monnier Date: Sun, 1 Feb 2009 03:28:33 +0000 (+0000) Subject: (rmail-sort-messages): Use car-less-than-car if possible. X-Git-Tag: emacs-pretest-23.0.90~15 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=73d7bcb9186581589b8ab10b2b4f9f98f734d7fc;p=emacs.git (rmail-sort-messages): Use car-less-than-car if possible. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index bd6da5daa15..9188230e6f7 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,8 @@ 2009-02-01 Stefan Monnier + * mail/rmailsort.el (rmail-sort-messages): Use car-less-than-car + if possible. + * mail/rmailedit.el (rmail-edit-map): Move init into declaration. (rmail-edit-mode, rmail-cease-edit): Use with-current-buffer. diff --git a/lisp/mail/rmailsort.el b/lisp/mail/rmailsort.el index 5b58a5c7a45..e5b9da3ea6d 100644 --- a/lisp/mail/rmailsort.el +++ b/lisp/mail/rmailsort.el @@ -162,7 +162,6 @@ If 1st argument REVERSE is non-nil, sort them in reverse order. (let ((return-to-point (if (rmail-buffers-swapped-p) (point))) - (predicate nil) ;< or string-lessp (sort-lists nil)) (rmail-swap-buffers-maybe) (message "Finding sort keys...") @@ -179,15 +178,14 @@ If 1st argument REVERSE is non-nil, sort them in reverse order. (message "Finding sort keys...%d" msgnum)) (setq msgnum (1+ msgnum)))) (or reverse (setq sort-lists (nreverse sort-lists))) - ;; Decide predicate: < or string-lessp - (if (numberp (car (car sort-lists))) ;Is a key numeric? - (setq predicate (function <)) - (setq predicate (function string-lessp))) (setq sort-lists (sort sort-lists - (function - (lambda (a b) - (funcall predicate (car a) (car b)))))) + ;; Decide predicate: < or string-lessp + (if (numberp (car (car sort-lists))) ;Is a key numeric? + 'car-less-than-car + (function + (lambda (a b) + (string-lessp (car a) (car b))))))) (if reverse (setq sort-lists (nreverse sort-lists))) ;; Now we enter critical region. So, keyboard quit is disabled. (message "Reordering messages...")