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)) (let* ((key (plist-get bm :key))
(name (plist-get bm :name)) (name (plist-get bm :name))
(query (plist-get bm :query)) (query (plist-get bm :query))
(qcounts (qcounts (and (stringp query)
(seq-filter (lambda (q) (seq-filter
(string= (plist-get q :query) query)) (lambda (q)
(plist-get mu4e~server-props :queries)))) (string= (plist-get q :query) query))
(plist-get mu4e~server-props :queries)))))
(concat (concat
;; menu entry ;; menu entry
(mu4e~main-action-str (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 (mapcar ;; send it a list of queries we'd like to see read/unread info
;; for. ;; for.
(lambda(bm) (plist-get bm :query)) (lambda(bm) (plist-get bm :query))
(seq-filter (lambda (bm) ;; exclude bookmarks with these flags. (seq-filter (lambda (bm) ;; exclude bookmarks that are not strings,
(not (or (plist-get bm :hide) (plist-get bm :hide-unread)))) ;; and with these flags.
(and (stringp (plist-get bm :query))
(not (or (plist-get bm :hide) (plist-get bm :hide-unread)))))
(mu4e-bookmarks)))) (mu4e-bookmarks))))
;; maybe request the list of contacts, automatically refresh after ;; maybe request the list of contacts, automatically refresh after
;; reindexing ;; reindexing

View File

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