changeset 101725:9e2e923d8eb3

(rmail-sort-messages): Use car-less-than-car if possible.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Sun, 01 Feb 2009 03:28:33 +0000
parents b87c9a6e8490
children 72dd6e84d495
files lisp/ChangeLog lisp/mail/rmailsort.el
diffstat 2 files changed, 9 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Sun Feb 01 03:26:17 2009 +0000
+++ b/lisp/ChangeLog	Sun Feb 01 03:28:33 2009 +0000
@@ -1,5 +1,8 @@
 2009-02-01  Stefan Monnier  <monnier@iro.umontreal.ca>
 
+	* 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.
 
--- a/lisp/mail/rmailsort.el	Sun Feb 01 03:26:17 2009 +0000
+++ b/lisp/mail/rmailsort.el	Sun Feb 01 03:28:33 2009 +0000
@@ -162,7 +162,6 @@
     (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 @@
 	      (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...")