Browse files

mu4e: try a little harder to get contacts

Some people reported problems with completing contacts. It's unclear
what's going on there. Maybe this helps.
1 parent bbdee4e commit 34d5c61930f5bead43b231132487938dcb8f26ff @djcb committed May 6, 2017
Showing with 9 additions and 8 deletions.
  1. +9 −8 mu4e/mu4e-utils.el
@@ -659,7 +659,8 @@ process."
"Indexing completed; processed %d, updated %d, cleaned-up %d"
(plist-get info :processed) (plist-get info :updated)
(plist-get info :cleaned-up))
- (unless (zerop (plist-get info :updated))
+ (unless (or (zerop (plist-get info :updated)) (not mu4e~contacts))
+ (mu4e~request-contacts)
(run-hooks 'mu4e-index-updated-hook)))))
((plist-get info :message)
(mu4e-index-message "%s" (plist-get info :message))))))
@@ -765,9 +766,9 @@ on the ranking in `mu4e~contacts.'"
;; start and stopping
(defun mu4e~fill-contacts (contact-data)
"We receive a list of contacts, which each contact of the form
- (:me NAME :mail EMAIL :tstamp TIMESTAMP :freq FREQUENCY)
-and fill the hash `mu4e~contacts-for-completion' with it, with
-each contact mapped to an integer for their ranking.
+ (:me NAME :mail EMAIL :tstamp TIMESTAMP :freq FREQUENCY) and
+fill the hash `mu4e~contacts' with it, with each contact mapped
+to an integer for their ranking.
This is used by the completion function in mu4e-compose."
(let ((contacts) (rank 0))
@@ -842,8 +843,9 @@ Checks whether the server process is live."
"Regexp to match a password query in the `mu4e-get-mail-command' output.")
(defun mu4e~request-contacts ()
- "If `mu4e-compose-complete-addresses' is non-nil, get/update the
-list of contacts we use for autocompletion; otherwise, do nothing."
+ "If `mu4e-compose-complete-addresses' is non-nil, get/update
+the list of contacts we use for autocompletion; otherwise, do
(when mu4e-compose-complete-addresses
(setq mu4e-contacts-func 'mu4e~fill-contacts)
@@ -889,8 +891,7 @@ successful, call FUNC (if non-nil) afterwards."
;; maybe request the list of contacts, automatically refresh after
;; reindexing
- (mu4e~request-contacts)
- (add-hook 'mu4e-index-updated-hook 'mu4e~request-contacts))))
+ (mu4e~request-contacts))))
(defun mu4e-clear-caches ()
"Clear any cached resources."

0 comments on commit 34d5c61

Please sign in to comment.