mu4e: contacts: use mu4e--contacts-set

We use to have mu4e--contacts-hash, with name mapping to rank; that was
needlessly complicated since most completion engine sort alphabetically, making
the rank totally irrelevant (in practice, it doesn't matter much from the
end-user pov).

Anyway, simplify that part, maintain a set of contacts without any rank (which
what the server delivers now).

Also update the _default_ mu4e-contact-process-function to filter out anything
with 'reply' since it's not very useful for autocompletion.
This commit is contained in:
Dirk-Jan C. Binnema
2022-05-09 21:22:17 +03:00
parent 81689f0af3
commit db86e7b5ee
4 changed files with 35 additions and 51 deletions

View File

@ -224,9 +224,9 @@ Message-ID."
"Complete address STR with predication PRED for ACTION."
(cond
((eq action nil)
(try-completion str mu4e--contacts-hash pred))
(try-completion str mu4e--contacts-set pred))
((eq action t)
(all-completions str mu4e--contacts-hash pred))
(all-completions str mu4e--contacts-set pred))
((eq action 'metadata)
;; our contacts are already sorted - just need to tell the
;; completion machinery not to try to undo that...
@ -357,7 +357,7 @@ buffers; lets remap its faces so it uses the ones for mu4e."
(mu4e~compose-register-message-save-hooks)
;; offer completion for e-mail addresses
(when mu4e-compose-complete-addresses
(unless mu4e--contacts-hash
(unless mu4e--contacts-set
;; work-around for https://github.com/djcb/mu/issues/1016
(mu4e--request-contacts-maybe))
(mu4e~compose-setup-completion))