From 5e13d31450ba817a54aa2c2cb170bf7c246e2761 Mon Sep 17 00:00:00 2001 From: djcb Date: Sun, 3 Jan 2016 15:53:07 +0200 Subject: [PATCH] mu4e: tweak the contact sorting Fall back to freq / tstamp when both contacts are personal. --- mu4e/mu4e-utils.el | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/mu4e/mu4e-utils.el b/mu4e/mu4e-utils.el index 1f048f75..26b9e0bf 100644 --- a/mu4e/mu4e-utils.el +++ b/mu4e/mu4e-utils.el @@ -674,14 +674,16 @@ frequency." (tstamp2 (plist-get c2 :tstamp))) ;; personal contacts come first (if (or personal1 personal2) - (if personal1 t nil) - ;; then come recently seen ones; but only if they're not in - ;; the future (as seen in spams) - (if (and (<= tstamp1 now) (<= tstamp2 now) - (or (> tstamp1 recent) (> tstamp2 recent))) - (> tstamp1 tstamp2) - ;; otherwise, use the frequency - (> freq1 freq2)))))))) + (if (not (and personal1 personal2)) + ;; if only one is personal, that one comes first + (if personal1 t nil) + ;; then come recently seen ones; but only if they're not in + ;; the future (as seen in spams) + (if (and (<= tstamp1 now) (<= tstamp2 now) + (or (> tstamp1 recent) (> tstamp2 recent))) + (> tstamp1 tstamp2) + ;; otherwise, use the frequency + (> freq1 freq2))))))))) ;; start and stopping (defun mu4e~fill-contacts (contacts)