From f4923c6f2a3378de3a284ddea66dcbd05ac02b2b Mon Sep 17 00:00:00 2001 From: "Dirk-Jan C. Binnema" Date: Sun, 11 Dec 2022 14:05:34 +0200 Subject: [PATCH] mu4e-headers: make hide-predicate togglable Like the other search properties. --- mu4e/mu4e-headers.el | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/mu4e/mu4e-headers.el b/mu4e/mu4e-headers.el index fe0545d6..21dad885 100644 --- a/mu4e/mu4e-headers.el +++ b/mu4e/mu4e-headers.el @@ -130,11 +130,10 @@ next mail after marking a message in header view." (defvar mu4e-headers-hide-predicate nil - "Predicate function to hide matching heasders. -If the function evaluates to non-nil when applied a a message -plist, do not show the corresponding header. The function takes -one parameter MSG, which is the message plist for the message to -be hidden or not. + "Predicate function to hide matching headers. +Either nil or a function taking one message plist parameter and +which which return non-nil for messages that should be hidden from +the search results. Also see `mu4e-headers-hide-enabled'. Example that hides all trashed messages: @@ -142,6 +141,11 @@ Example that hides all trashed messages: (lambda (msg) (member \='trashed (mu4e-message-field msg :flags)))).") +(defvar mu4e-headers-hide-enabled t + "Whether `mu4e-headers-hide-predicate' should be active. +This can be used to toggle use of the predicate through + `mu4e-headers-toggle-property'.") + (defcustom mu4e-headers-visible-flags '(draft flagged new passed replied trashed attach encrypted signed list personal) @@ -271,6 +275,9 @@ Must have the same length as `mu4e-headers-thread-connection-prefix'.") "Non-fancy and fancy labels to indicate related search in the mode-line.") (defvar mu4e-headers-skip-duplicates-label '("U" . "Ⓤ") ;; 'U' for 'unique' "Non-fancy and fancy labels for include-related search in the mode-line.") +(defvar mu4e-headers-hide-label '("H" . "Ⓗ") + "Non-fancy and fancy labels to indicate header-hiding is active in +the mode-line.") ;;;; Various @@ -678,9 +685,10 @@ space propertized with a `display' text property which expands to fieldval)) (defsubst mu4e~message-header-line (msg) - "Return a propertized description of MSG suitable for + "Return a propertized description of message MSG suitable for displaying in the header view." - (unless (and mu4e-headers-hide-predicate + ;; should we hide it? + (unless (and mu4e-headers-hide-enabled mu4e-headers-hide-predicate (funcall mu4e-headers-hide-predicate msg)) (mu4e~headers-apply-flags msg