mu4e: move some more variables from headers->search

We were incomplete.
This commit is contained in:
Dirk-Jan C. Binnema 2023-01-03 23:08:17 +02:00
parent b9841942d8
commit 9f1e626ef7
3 changed files with 32 additions and 25 deletions

View File

@ -129,23 +129,6 @@ next mail after marking a message in header view."
:group 'mu4e-headers) :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 (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)
@ -665,8 +648,8 @@ space propertized with a `display' text property which expands to
(defsubst mu4e~message-header-line (msg) (defsubst mu4e~message-header-line (msg)
"Return a propertized description of message MSG suitable for "Return a propertized description of message MSG suitable for
displaying in the header view." displaying in the header view."
(if (and mu4e-headers-hide-enabled mu4e-headers-hide-predicate (if (and mu4e-search-hide-enabled mu4e-search-hide-predicate
(funcall mu4e-headers-hide-predicate msg)) (funcall mu4e-search-hide-predicate msg))
(progn (progn
(cl-incf mu4e~headers-hidden) (cl-incf mu4e~headers-hidden)
nil) nil)
@ -1269,12 +1252,12 @@ message plist, or nil if not found."
(if (car flag-cell) (if (car flag-cell)
(if mu4e-use-fancy-chars (if mu4e-use-fancy-chars
(cddr flag-cell) (cadr flag-cell) ) "")) (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-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-search-skip-duplicates
. ,mu4e-headers-skip-duplicates-label) . ,mu4e-headers-skip-duplicates-label)
(,mu4e-headers-hide-enabled . ,mu4e-headers-hide-label)) (,mu4e-search-hide-enabled . ,mu4e-headers-hide-label))
"")) ""))
(name "mu4e-headers")) (name "mu4e-headers"))

View File

@ -178,6 +178,12 @@
(make-obsolete-variable 'mu4e-headers-sort-direction (make-obsolete-variable 'mu4e-headers-sort-direction
'mu4e-search-sort-direction "1.9.11") '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 ;; mu4e-main
(define-obsolete-variable-alias (define-obsolete-variable-alias

View File

@ -78,6 +78,24 @@ and offlineimap."
:type 'boolean :type 'boolean
:group 'mu4e-search) :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 (defcustom mu4e-search-sort-field :date
"Field to sort the headers by. A symbol: "Field to sort the headers by. A symbol:
one of: `:date', `:subject', `:size', `:prio', `:from', `:to.', 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 This function receives the query as its parameter, before any
rewriting as per `mu4e-query-rewrite-function' has taken place. 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 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 bookmark, e.g. if you'd like to treat the bookmarks as a custom
folder and change the options for the search." 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) (let* ((toggles '(("fFull-search" . mu4e-search-full)
("rInclude-related" . mu4e-headers-include-related) ("rInclude-related" . mu4e-headers-include-related)
("tShow threads" . mu4e-search-threads) ("tShow threads" . mu4e-search-threads)
("uSkip duplicates" . mu4e-headers-skip-duplicates) ("uSkip duplicates" . mu4e-search-skip-duplicates)
("pHide-predicate" . mu4e-headers-hide-enabled))) ("pHide-predicate" . mu4e-search-hide-enabled)))
(toggles (seq-map (toggles (seq-map
(lambda (cell) (lambda (cell)
(cons (cons