Don't use mu4e-index-updated-hook in mu4e~start

Using mu4e-index-updated-hook in mu4e~start with a lambda is just like
adding the call to mu4e-info-handler so do it explicitely which is
much cleaner.

* mu4e/mu4e-utils.el (mu4e-info-handler): Always refresh main buffer.
(mu4e~start): Remove insertion of mu4e-index-updated-hook.
This commit is contained in:
Thierry Volpiatto 2020-02-21 08:54:16 +01:00
parent b1369b6ad9
commit b301b7663b
No known key found for this signature in database
GPG Key ID: 28D17F5359F29997
1 changed files with 7 additions and 13 deletions

View File

@ -642,7 +642,8 @@ process."
(let* ((type (plist-get info :info))
(processed (plist-get info :processed))
(updated (plist-get info :updated))
(cleaned-up (plist-get info :cleaned-up)))
(cleaned-up (plist-get info :cleaned-up))
(mainbuf (get-buffer mu4e~main-buffer-name)))
(cond
((eq type 'add) t) ;; do nothing
((eq type 'index)
@ -658,7 +659,9 @@ process."
(run-hooks 'mu4e-index-updated-hook))
(unless (and (not (string= mu4e~contacts-tstamp "0"))
(zerop (plist-get info :updated)))
(mu4e~request-contacts-maybe)))))
(mu4e~request-contacts-maybe))
(when (and (buffer-live-p mainbuf) (get-buffer-window mainbuf))
(mu4e~main-view 'refresh)))))
((plist-get info :message)
(mu4e-index-message "%s" (plist-get info :message))))))
@ -800,19 +803,10 @@ context yet, switch to the matching one, or none matches, the
first. If mu4e is already running, execute function FUNC (if
non-nil). Otherwise, check various requireme`'nts, then start mu4e.
When successful, call FUNC (if non-nil) afterwards."
;; if we're already running, simply go to the main view
(unless (mu4e-running-p) ;; already running?
;; when it's visible, re-draw the main view when there are changes.
(add-hook 'mu4e-index-updated-hook
(lambda()
(let ((mainbuf (get-buffer mu4e~main-buffer-name)))
(when (and (buffer-live-p mainbuf) (get-buffer-window mainbuf))
(mu4e~start 'mu4e~main-view))))))
(setq mu4e-pong-func (lambda (info) (mu4e~pong-handler info func)))
(mu4e~proc-ping
(mapcar ;; send it a list of queries we'd like to see read/unread info
;; for.
(mapcar
;; send it a list of queries we'd like to see read/unread info for.
(lambda(bm) (plist-get bm :query))
(seq-filter (lambda (bm) ;; exclude bookmarks that are not strings,
;; and with these flags.