mu4e: allow for clearing some cached values

This helpful for various 'change account' actions
This commit is contained in:
djcb 2015-12-04 23:20:27 +02:00
parent 706c9e0ea9
commit 2262e185af
1 changed files with 10 additions and 6 deletions

View File

@ -297,7 +297,8 @@ Function will return the cdr of the list element."
(concat mdir (car dentry) "/")))))))
dirs))
(defvar mu4e~maildir-list nil "Cached list of maildirs.")
(defvar mu4e~maildir-list nil
"Cached list of maildirs.")
(defun mu4e-get-maildirs ()
"Get maildirs under `mu4e-maildir', recursively, as a list of
@ -353,7 +354,6 @@ and offer to create it if it does not exist yet."
(mu4e~proc-mkdir fullpath)))
mdir))
(defun mu4e-ask-bookmark (prompt &optional kar)
"Ask the user for a bookmark (using PROMPT) as defined in
`mu4e-bookmarks', then return the corresponding query."
@ -755,14 +755,18 @@ successful, call FUNC (if non-nil) afterwards."
(mu4e~request-contacts)
(add-hook 'mu4e-index-updated-hook 'mu4e~request-contacts))))
(defun mu4e-clear-caches ()
"Clear any cached resources."
(setq
mu4e~maildir-list nil
mu4e~contacts-for-completion nil))
(defun mu4e~stop ()
"Stop the mu4e session."
(when mu4e~update-timer
(cancel-timer mu4e~update-timer)
(setq
mu4e~update-timer nil
mu4e~maildir-list nil
mu4e~contacts-for-completion nil))
(setq mu4e~update-timer nil))
(mu4e-clear-caches)
(mu4e~proc-kill)
;; kill all main/view/headers buffer
(mapcar