;; This cannot be byte-compiled due to a bug in db-functionp (defun elip-order-sort (a b) (setq elip-anew (= (aref a 7) 0)) (setq elip-bnew (= (aref b 7) 0)) (setq elip-adate (date->absolute-days (aref a 2))) (setq elip-bdate (date->absolute-days (aref b 2))) (setq elip-aseq (aref a 17)) (setq elip-bseq (aref b 17)) ;; a new, b old return t (if (and elip-anew (not elip-bnew)) (= 0 0) ;; a old, b new return nil (if (and (not elip-anew) elip-bnew) (= 0 1) ;; both old - sort by date and sequence (if (and (not elip-anew) (not elip-bnew)) (if (= elip-adate elip-bdate) (< elip-aseq elip-bseq) (< elip-adate elip-bdate)) ;; fall through to both new, sort by sequence only (< elip-aseq elip-bseq)))) ) (defun elip-shuffle-sort (a b) (< (aref a 17) (aref b 17)) )