Commit 73d7bcb9 authored by Stefan Monnier's avatar Stefan Monnier
Browse files

(rmail-sort-messages): Use car-less-than-car if possible.

parent befa8175
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.
 
......
......@@ -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...")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment