From 9f1e626ef7b2cbf6a4d54ba358bd8922a63d75bb Mon Sep 17 00:00:00 2001 From: "Dirk-Jan C. Binnema" Date: Tue, 3 Jan 2023 23:08:17 +0200 Subject: [PATCH] mu4e: move some more variables from headers->search We were incomplete. --- mu4e/mu4e-headers.el | 27 +++++---------------------- mu4e/mu4e-obsolete.el | 6 ++++++ mu4e/mu4e-search.el | 24 +++++++++++++++++++++--- 3 files changed, 32 insertions(+), 25 deletions(-) diff --git a/mu4e/mu4e-headers.el b/mu4e/mu4e-headers.el index 03a20072..ec9765a4 100644 --- a/mu4e/mu4e-headers.el +++ b/mu4e/mu4e-headers.el @@ -129,23 +129,6 @@ next mail after marking a message in header view." :group 'mu4e-headers) -(defvar mu4e-headers-hide-predicate nil - "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: - - (setq mu4e-headers-hide-predicate - (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) @@ -665,8 +648,8 @@ space propertized with a `display' text property which expands to (defsubst mu4e~message-header-line (msg) "Return a propertized description of message MSG suitable for displaying in the header view." - (if (and mu4e-headers-hide-enabled mu4e-headers-hide-predicate - (funcall mu4e-headers-hide-predicate msg)) + (if (and mu4e-search-hide-enabled mu4e-search-hide-predicate + (funcall mu4e-search-hide-predicate msg)) (progn (cl-incf mu4e~headers-hidden) nil) @@ -1269,12 +1252,12 @@ message plist, or nil if not found." (if (car flag-cell) (if mu4e-use-fancy-chars (cddr flag-cell) (cadr flag-cell) ) "")) - `((,mu4e-search-full . ,mu4e-headers-full-label) + `((,mu4e-search-full . ,mu4e-headers-full-label) (,mu4e-search-include-related . ,mu4e-headers-related-label) - (,mu4e-search-threads . ,mu4e-headers-threaded-label) + (,mu4e-search-threads . ,mu4e-headers-threaded-label) (,mu4e-search-skip-duplicates . ,mu4e-headers-skip-duplicates-label) - (,mu4e-headers-hide-enabled . ,mu4e-headers-hide-label)) + (,mu4e-search-hide-enabled . ,mu4e-headers-hide-label)) "")) (name "mu4e-headers")) diff --git a/mu4e/mu4e-obsolete.el b/mu4e/mu4e-obsolete.el index 40df184e..0dcd0763 100644 --- a/mu4e/mu4e-obsolete.el +++ b/mu4e/mu4e-obsolete.el @@ -178,6 +178,12 @@ (make-obsolete-variable 'mu4e-headers-sort-direction 'mu4e-search-sort-direction "1.9.11") +(make-obsolete-variable 'mu4e-headers-hide-predicate + 'mu4e-search-hide-predicate "1.9.11") +(make-obsolete-variable 'mu4e-headers-hide-enabled + 'mu4e-search-hide-enabled "1.9.11") + + ;; mu4e-main (define-obsolete-variable-alias diff --git a/mu4e/mu4e-search.el b/mu4e/mu4e-search.el index d345dbf7..53a3443d 100644 --- a/mu4e/mu4e-search.el +++ b/mu4e/mu4e-search.el @@ -78,6 +78,24 @@ and offlineimap." :type 'boolean :group 'mu4e-search) +(defvar mu4e-search-hide-predicate nil + "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-search-hide-enabled'. + +Example that hides all trashed messages: + + (setq mu4e-search-hide-predicate + (lambda (msg) + (member \='trashed (mu4e-message-field msg :flags)))).") + +(defvar mu4e-search-hide-enabled t + "Whether `mu4e-search-hide-predicate' should be active. +This can be used to toggle use of the predicate through + `mu4e-search-toggle-property'.") + + (defcustom mu4e-search-sort-field :date "Field to sort the headers by. A symbol: one of: `:date', `:subject', `:size', `:prio', `:from', `:to.', @@ -123,7 +141,7 @@ anything about the query, it just does text replacement." This function receives the query as its parameter, before any rewriting as per `mu4e-query-rewrite-function' has taken place. -The reason to use this instead of `mu4e-headers-search-hook' is +The reason to use this instead of `mu4e-search-hook' is if you only want to execute a hook when a search is entered via a bookmark, e.g. if you'd like to treat the bookmarks as a custom folder and change the options for the search." @@ -424,8 +442,8 @@ If KEY is provided, use it instead of asking user." (let* ((toggles '(("fFull-search" . mu4e-search-full) ("rInclude-related" . mu4e-headers-include-related) ("tShow threads" . mu4e-search-threads) - ("uSkip duplicates" . mu4e-headers-skip-duplicates) - ("pHide-predicate" . mu4e-headers-hide-enabled))) + ("uSkip duplicates" . mu4e-search-skip-duplicates) + ("pHide-predicate" . mu4e-search-hide-enabled))) (toggles (seq-map (lambda (cell) (cons