From 60b1a5dff71ea94b9babe2e978843f298aecef5c Mon Sep 17 00:00:00 2001 From: "Dirk-Jan C. Binnema" Date: Sun, 2 Jul 2023 10:26:09 +0300 Subject: [PATCH] mu4e/search: clarify sortable fields (threading) When threads are enabled, only sorting by date is possible; make this clearer in the UI. Fixes #2507. --- mu4e/mu4e-search.el | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/mu4e/mu4e-search.el b/mu4e/mu4e-search.el index e212dd27..eaed0c1f 100644 --- a/mu4e/mu4e-search.el +++ b/mu4e/mu4e-search.el @@ -410,16 +410,22 @@ status, STATUS." FIELD is the field to sort by; DIR is a symbol: either `ascending', `descending', t (meaning: if FIELD is the same as the current sortfield, change the sort-order) or nil (ask the -user)." +user). + +When threads are enabled (`mu4e-search-threads'), you can only sort +by the `:date' field." (interactive) - (let* ((choices '(("date" . :date) - ("from" . :from) - ("list" . :list) - ("maildir" . :maildir) - ("prio" . :prio) - ("zsize" . :size) - ("subject" . :subject) - ("to" . :to))) + (let* ((choices ;; with threads enabled, you can only sort by *date* + (if mu4e-search-threads + '(("date" . :date)) + '(("date" . :date) + ("from" . :from) + ("list" . :list) + ("maildir" . :maildir) + ("prio" . :prio) + ("zsize" . :size) + ("subject" . :subject) + ("to" . :to)))) (field (or field (mu4e-read-option "Sortfield: " choices)))