mu4e-headers: make hide-predicate togglable

Like the other search properties.
This commit is contained in:
Dirk-Jan C. Binnema
2022-12-11 14:05:34 +02:00
parent 5a3d7e9c56
commit f4923c6f2a

View File

@ -130,11 +130,10 @@ next mail after marking a message in header view."
(defvar mu4e-headers-hide-predicate nil (defvar mu4e-headers-hide-predicate nil
"Predicate function to hide matching heasders. "Predicate function to hide matching headers.
If the function evaluates to non-nil when applied a a message Either nil or a function taking one message plist parameter and
plist, do not show the corresponding header. The function takes which which return non-nil for messages that should be hidden from
one parameter MSG, which is the message plist for the message to the search results. Also see `mu4e-headers-hide-enabled'.
be hidden or not.
Example that hides all trashed messages: Example that hides all trashed messages:
@ -142,6 +141,11 @@ Example that hides all trashed messages:
(lambda (msg) (lambda (msg)
(member \='trashed (mu4e-message-field msg :flags)))).") (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 (defcustom mu4e-headers-visible-flags
'(draft flagged new passed replied trashed attach encrypted signed '(draft flagged new passed replied trashed attach encrypted signed
list personal) 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.") "Non-fancy and fancy labels to indicate related search in the mode-line.")
(defvar mu4e-headers-skip-duplicates-label '("U" . "") ;; 'U' for 'unique' (defvar mu4e-headers-skip-duplicates-label '("U" . "") ;; 'U' for 'unique'
"Non-fancy and fancy labels for include-related search in the mode-line.") "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 ;;;; Various
@ -678,9 +685,10 @@ space propertized with a `display' text property which expands to
fieldval)) fieldval))
(defsubst mu4e~message-header-line (msg) (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." 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)) (funcall mu4e-headers-hide-predicate msg))
(mu4e~headers-apply-flags (mu4e~headers-apply-flags
msg msg