mu4e: only show unread counts for stringp bookmarks

We can't generally do it for non-constant bookmarks.
This commit is contained in:
Dirk-Jan C. Binnema 2020-01-25 21:35:15 +02:00
parent ba370f748c
commit 6f1513d187
3 changed files with 17 additions and 10 deletions

View File

@ -114,10 +114,11 @@ clicked."
(let* ((key (plist-get bm :key))
(name (plist-get bm :name))
(query (plist-get bm :query))
(qcounts
(seq-filter (lambda (q)
(string= (plist-get q :query) query))
(plist-get mu4e~server-props :queries))))
(qcounts (and (stringp query)
(seq-filter
(lambda (q)
(string= (plist-get q :query) query))
(plist-get mu4e~server-props :queries)))))
(concat
;; menu entry
(mu4e~main-action-str

View File

@ -821,8 +821,10 @@ When successful, call FUNC (if non-nil) afterwards."
(mapcar ;; send it a list of queries we'd like to see read/unread info
;; for.
(lambda(bm) (plist-get bm :query))
(seq-filter (lambda (bm) ;; exclude bookmarks with these flags.
(not (or (plist-get bm :hide) (plist-get bm :hide-unread))))
(seq-filter (lambda (bm) ;; exclude bookmarks that are not strings,
;; and with these flags.
(and (stringp (plist-get bm :query))
(not (or (plist-get bm :hide) (plist-get bm :hide-unread)))))
(mu4e-bookmarks))))
;; maybe request the list of contacts, automatically refresh after
;; reindexing

View File

@ -229,15 +229,19 @@ are plists" "1.3.7")
"List of pre-defined queries that are shown on the main screen.
Each of the list elements is a plist with at least:
:name - the name of the queryt
:query - the query expression
:name - the name of the query
:query - the query expression or function
:key - the shortcut key.
Note that the :query parameter can be a function/lambda.
Optionally, you can add the following:
:hide - if t, bookmark is hdden from the main-view and speedbar.
:hide-unread - do not show the counts of unread/total number
of matches for the query. This can be useful if a bookmark uses
a very slow query. :hide-unread is implied from :hide.
of matches for the query in the main-view. This can be useful
if a bookmark uses a very slow query. :hide-unread
is implied from :hide. Furthermore, it is implied from the query
not being a string.
Note that the queries used to determine the unread/all counts do
current not apply `mu4e-query-rewrite-function', so if your