From 6f1513d187cbe8f45c4f083965fd896d5f8b6245 Mon Sep 17 00:00:00 2001 From: "Dirk-Jan C. Binnema" Date: Sat, 25 Jan 2020 21:35:15 +0200 Subject: [PATCH] mu4e: only show unread counts for stringp bookmarks We can't generally do it for non-constant bookmarks. --- mu4e/mu4e-main.el | 9 +++++---- mu4e/mu4e-utils.el | 6 ++++-- mu4e/mu4e-vars.el | 12 ++++++++---- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/mu4e/mu4e-main.el b/mu4e/mu4e-main.el index dd00763f..a8190307 100644 --- a/mu4e/mu4e-main.el +++ b/mu4e/mu4e-main.el @@ -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 diff --git a/mu4e/mu4e-utils.el b/mu4e/mu4e-utils.el index c8d3e456..0a9b8073 100644 --- a/mu4e/mu4e-utils.el +++ b/mu4e/mu4e-utils.el @@ -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 diff --git a/mu4e/mu4e-vars.el b/mu4e/mu4e-vars.el index 9f703652..acca69ef 100644 --- a/mu4e/mu4e-vars.el +++ b/mu4e/mu4e-vars.el @@ -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