mu4e: add mu4e-last-query-result[s]
This makes the most recent results from the queries (i.e. the numbers) available using the supported 'mu4e-' API. Fixes: #1845.
This commit is contained in:
@ -117,12 +117,11 @@ clicked."
|
|||||||
'mouse-face 'highlight newstr)
|
'mouse-face 'highlight newstr)
|
||||||
newstr))
|
newstr))
|
||||||
|
|
||||||
|
|
||||||
(defun mu4e~main-bookmarks ()
|
(defun mu4e~main-bookmarks ()
|
||||||
;; TODO: it's a bit uncool to hard-code the "b" shortcut...
|
;; TODO: it's a bit uncool to hard-code the "b" shortcut...
|
||||||
(cl-loop with bmks = (mu4e-bookmarks)
|
(cl-loop with bmks = (mu4e-bookmarks)
|
||||||
with longest = (mu4e~longest-of-maildirs-and-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 bm in bmks
|
||||||
for key = (string (plist-get bm :key))
|
for key = (string (plist-get bm :key))
|
||||||
for name = (plist-get bm :name)
|
for name = (plist-get bm :name)
|
||||||
|
|||||||
@ -792,6 +792,28 @@ nothing."
|
|||||||
(lambda () (mu4e-update-mail-and-index
|
(lambda () (mu4e-update-mail-and-index
|
||||||
mu4e-index-update-in-background)))))))
|
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 <total number matching count>
|
||||||
|
:unread <number of unread messages in count>)"
|
||||||
|
(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)
|
(defun mu4e~start (&optional func)
|
||||||
"If `mu4e-contexts' have been defined, but we don't have a
|
"If `mu4e-contexts' have been defined, but we don't have a
|
||||||
|
|||||||
Reference in New Issue
Block a user