mu4e: make mu4e refresh itself

update using the 'ping' function, so read/unread counts get updated.

add a 'g' binding for the main-view.
This commit is contained in:
Dirk-Jan C. Binnema
2020-01-31 00:17:19 +02:00
parent 9ba28bc4c5
commit ad5f7d8dad
2 changed files with 19 additions and 22 deletions

View File

@ -59,6 +59,7 @@
(define-key map "A" 'mu4e-about) (define-key map "A" 'mu4e-about)
(define-key map "N" 'mu4e-news) (define-key map "N" 'mu4e-news)
(define-key map "H" 'mu4e-display-manual) (define-key map "H" 'mu4e-display-manual)
(define-key map "g" 'mu4e)
map) map)
"Keymap for the *mu4e-main* buffer.") "Keymap for the *mu4e-main* buffer.")

View File

@ -806,16 +806,12 @@ first. If mu4e is already running, execute function FUNC (if
non-nil). Otherwise, check various requireme`'nts, then start mu4e. non-nil). Otherwise, check various requireme`'nts, then start mu4e.
When successful, call FUNC (if non-nil) afterwards." When successful, call FUNC (if non-nil) afterwards."
;; if we're already running, simply go to the main view ;; if we're already running, simply go to the main view
(if (mu4e-running-p) ;; already running? (unless (mu4e-running-p) ;; already running?
(when func (funcall func)) ;; yes! run func if defined
(progn
;; no! try to set a context, do some checks, set up pong handler and ping ;; no! try to set a context, do some checks, set up pong handler and ping
;; the server maybe switch the context ;; the server maybe switch the context
(mu4e~context-autoswitch nil mu4e-context-policy) (mu4e~context-autoswitch nil mu4e-context-policy)
(mu4e~check-requirements) (mu4e~check-requirements))
;; set up the 'pong' handler func
(setq mu4e-pong-func (lambda (props) (mu4e~pong-handler props func))) (setq mu4e-pong-func (lambda (props) (mu4e~pong-handler props func)))
;; wake up server
(mu4e~proc-ping (mu4e~proc-ping
(mapcar ;; send it a list of queries we'd like to see read/unread info (mapcar ;; send it a list of queries we'd like to see read/unread info
;; for. ;; for.
@ -825,9 +821,9 @@ When successful, call FUNC (if non-nil) afterwards."
(and (stringp (plist-get bm :query)) (and (stringp (plist-get bm :query))
(not (or (plist-get bm :hide) (plist-get bm :hide-unread))))) (not (or (plist-get bm :hide) (plist-get bm :hide-unread)))))
(mu4e-bookmarks)))) (mu4e-bookmarks))))
;; maybe request the list of contacts, automatically refresh after ;; maybe request the list of contacts, automatically refreshed after
;; reindexing ;; reindexing
(mu4e~request-contacts-maybe)))) (unless mu4e~contacts (mu4e~request-contacts-maybe)))
(defun mu4e-clear-caches () (defun mu4e-clear-caches ()
"Clear any cached resources." "Clear any cached resources."