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,28 +806,24 @@ 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 ;; no! try to set a context, do some checks, set up pong handler and ping
(progn ;; the server maybe switch the context
;; no! try to set a context, do some checks, set up pong handler and ping (mu4e~context-autoswitch nil mu4e-context-policy)
;; the server maybe switch the context (mu4e~check-requirements))
(mu4e~context-autoswitch nil mu4e-context-policy) (setq mu4e-pong-func (lambda (props) (mu4e~pong-handler props func)))
(mu4e~check-requirements) (mu4e~proc-ping
;; set up the 'pong' handler func (mapcar ;; send it a list of queries we'd like to see read/unread info
(setq mu4e-pong-func (lambda (props) (mu4e~pong-handler props func))) ;; for.
;; wake up server (lambda(bm) (plist-get bm :query))
(mu4e~proc-ping (seq-filter (lambda (bm) ;; exclude bookmarks that are not strings,
(mapcar ;; send it a list of queries we'd like to see read/unread info ;; and with these flags.
;; for. (and (stringp (plist-get bm :query))
(lambda(bm) (plist-get bm :query)) (not (or (plist-get bm :hide) (plist-get bm :hide-unread)))))
(seq-filter (lambda (bm) ;; exclude bookmarks that are not strings, (mu4e-bookmarks))))
;; and with these flags. ;; maybe request the list of contacts, automatically refreshed after
(and (stringp (plist-get bm :query)) ;; reindexing
(not (or (plist-get bm :hide) (plist-get bm :hide-unread))))) (unless mu4e~contacts (mu4e~request-contacts-maybe)))
(mu4e-bookmarks))))
;; maybe request the list of contacts, automatically refresh after
;; reindexing
(mu4e~request-contacts-maybe))))
(defun mu4e-clear-caches () (defun mu4e-clear-caches ()
"Clear any cached resources." "Clear any cached resources."