diff --git a/mu4e/mu4e-main.el b/mu4e/mu4e-main.el index 80563dc8..90dfd0af 100644 --- a/mu4e/mu4e-main.el +++ b/mu4e/mu4e-main.el @@ -117,12 +117,11 @@ clicked." 'mouse-face 'highlight newstr) newstr)) - (defun mu4e~main-bookmarks () ;; TODO: it's a bit uncool to hard-code the "b" shortcut... (cl-loop with bmks = (mu4e-bookmarks) with longest = (mu4e~longest-of-maildirs-and-bookmarks) - with queries = (plist-get mu4e~server-props :queries) + with queries = (mu4e-last-query-results) for bm in bmks for key = (string (plist-get bm :key)) for name = (plist-get bm :name) @@ -233,7 +232,7 @@ When REFRESH is non nil refresh infos from server." (propertize "mu4e" 'face 'mu4e-header-key-face) (propertize " - mu for emacs version " 'face 'mu4e-title-face) (propertize mu4e-mu-version 'face 'mu4e-header-key-face) - "\n\n" + "\n\n" (propertize " Basics\n\n" 'face 'mu4e-title-face) (mu4e~main-action-str "\t* [j]ump to some maildir\n" 'mu4e-jump-to-maildir) diff --git a/mu4e/mu4e-utils.el b/mu4e/mu4e-utils.el index 4bb9268f..d1151f93 100644 --- a/mu4e/mu4e-utils.el +++ b/mu4e/mu4e-utils.el @@ -792,6 +792,28 @@ nothing." (lambda () (mu4e-update-mail-and-index mu4e-index-update-in-background))))))) +(defun mu4e-last-query-results () + "Get the results (counts) of the last cached queries. + +The cached queries are the bookmark / maildir queries that are +used to populated the read/unread counts in the main view. They +are refreshed when calling `(mu4e)', i.e., when going to the main +view. + +The results are a list of elements of the form + (:query \"query string\" + :count + :unread )" + (plist-get mu4e~server-props :queries)) + + +(defun mu4e-last-query-result (query) + "Get the last result for some cached query, as per + `mu4e-bookmark-query-results' or nil if not found." + (cl-find-if + (lambda (elm) (string= (plist-get elm :query) query)) + (mu4e-last-query-results))) + (defun mu4e~start (&optional func) "If `mu4e-contexts' have been defined, but we don't have a