1
0
mirror of https://github.com/djcb/mu.git synced 2024-06-26 07:29:17 +02:00

* mu4e-utils: support the new format for the contacts list

This commit is contained in:
djcb 2013-06-16 23:05:52 +03:00
parent ae61280cfe
commit 76a87ded2d

View File

@ -584,12 +584,24 @@ process."
;; start and stopping ;; start and stopping
(defun mu4e~fill-contacts (contacts) (defun mu4e~fill-contacts (contacts)
"We receive a list of contacts, which each contact of the form "We receive a list of contacts, which each contact of the form
(:name NAME :mail EMAIL) (:name NAME :mail EMAIL :tstamp TIMESTAMP :freq FREQUENCY)
and fill the list `mu4e~contacts-for-completion' with it, with and fill the list `mu4e~contacts-for-completion' with it, with
each element looking like each element looking like
name <email> name <email>
This is used by the completion function in mu4e-compose." This is used by the completion function in mu4e-compose."
(let ((lst)) (let ((lst)
;; sort by the frequency (descending), then timestamp (descending)
;; FIXME: sadly, the emacs completion subsystem re-sorts the list
;; before showing candidates, so this doesn't do anything useful yet.
(contacts (sort contacts
(lambda (c1 c2)
(let ((freq1 (plist-get c1 :freq))
(tstamp1 (plist-get c1 :tstamp))
(freq2 (plist-get c2 :freq))
(tstamp2 (plist-get c2 :tstamp)))
(if (equal freq1 freq2)
(< tstamp1 tstamp2)
(< freq1 freq2)))))))
(dolist (contact contacts) (dolist (contact contacts)
(let ((name (plist-get contact :name)) (let ((name (plist-get contact :name))
(mail (plist-get contact :mail))) (mail (plist-get contact :mail)))