mu4e/headers: refresh some of the message flag marks

This commit is contained in:
Dirk-Jan C. Binnema 2022-05-07 09:26:37 +03:00
parent ca08443f05
commit 36165520ac
1 changed files with 18 additions and 27 deletions

View File

@ -1,4 +1,4 @@
;;; mu4e-headers.el -- part of mu4e -*- lexical-binding: t -*- ;;; mu4e-headers.el -- part of mu4e -*- lexical-binding: t; coding:utf-8 -*-
;; Copyright (C) 2011-2022 Dirk-Jan C. Binnema ;; Copyright (C) 2011-2022 Dirk-Jan C. Binnema
@ -151,10 +151,12 @@ Example that hides all 'trashed' messages:
Note that this is merely a display filter.") Note that this is merely a display filter.")
(defcustom mu4e-headers-visible-flags (defcustom mu4e-headers-visible-flags
'(draft flagged new passed replied seen trashed attach encrypted signed unread) '(draft flagged new passed replied trashed attach encrypted signed list personal)
"An ordered list of flags to show in the headers buffer. Each "An ordered list of flags to show in the headers buffer.
element is a symbol in the list (DRAFT FLAGGED NEW PASSED Each element is a symbol in the list.
REPLIED SEEN TRASHED ATTACH ENCRYPTED SIGNED UNREAD)."
By default, we leave out `unread' and `seen', since those are
mostly covered by `new', and the display gets cluttered otherwise."
:type '(set :type '(set
(const :tag "Draft" draft) (const :tag "Draft" draft)
(const :tag "Flagged" flagged) (const :tag "Flagged" flagged)
@ -166,7 +168,8 @@ REPLIED SEEN TRASHED ATTACH ENCRYPTED SIGNED UNREAD)."
(const :tag "Attach" attach) (const :tag "Attach" attach)
(const :tag "Encrypted" encrypted) (const :tag "Encrypted" encrypted)
(const :tag "Signed" signed) (const :tag "Signed" signed)
(const :tag "Unread" unread)) (const :tag "List" list)
(const :tag "Personal" personal))
:group 'mu4e-headers) :group 'mu4e-headers)
(defcustom mu4e-headers-found-hook nil (defcustom mu4e-headers-found-hook nil
@ -473,31 +476,19 @@ with DOCID which must be present in the headers buffer."
(mu4e~headers-thread-prefix-map 'duplicate) ""))))) (mu4e~headers-thread-prefix-map 'duplicate) "")))))
(defun mu4e~headers-flags-str (flags) (defun mu4e~headers-flags-str (flags)
"Get a display string for the flags. "Get a display string for FLAGS.
Note that `mu4e-flags-to-string' is for internal use only; this Note that `mu4e-flags-to-string' is for internal use only; this
function is for display. (This difference is significant, since function is for display. (This difference is significant, since
internally, the Maildir spec determines what the flags look like, internally, the Maildir spec determines what the flags look like,
while our display may be different)." while our display may be different)."
(let ((str "") (or (mapconcat
(get-prefix (lambda (flag)
(lambda (cell) (if mu4e-use-fancy-chars (cdr cell) (car cell))))) (when (member flag mu4e-headers-visible-flags)
(dolist (flag mu4e-headers-visible-flags) (if-let* ((mark (intern-soft
(when (member flag flags) (format "mu4e-headers-%s-mark" (symbol-name flag))))
(setq str (cell (symbol-value mark)))
(concat str (if mu4e-use-fancy-chars (cdr cell) (car cell))
(cl-case flag ""))) flags) ""))
('draft (funcall get-prefix mu4e-headers-draft-mark))
('flagged (funcall get-prefix mu4e-headers-flagged-mark))
('new (funcall get-prefix mu4e-headers-new-mark))
('passed (funcall get-prefix mu4e-headers-passed-mark))
('replied (funcall get-prefix mu4e-headers-replied-mark))
('seen (funcall get-prefix mu4e-headers-seen-mark))
('trashed (funcall get-prefix mu4e-headers-trashed-mark))
('attach (funcall get-prefix mu4e-headers-attach-mark))
('encrypted (funcall get-prefix mu4e-headers-encrypted-mark))
('signed (funcall get-prefix mu4e-headers-signed-mark))
('unread (funcall get-prefix mu4e-headers-unread-mark)))))))
str))
;;; Special headers ;;; Special headers