* mu4e: improve display of the flags-field in the message view

This commit is contained in:
djcb 2012-07-16 15:56:26 +03:00
parent d4abc249c2
commit 9df78fe49f
2 changed files with 19 additions and 5 deletions

View File

@ -268,6 +268,11 @@ flag set)."
view." view."
:group 'mu4e-faces) :group 'mu4e-faces)
(defface mu4e-view-special-header-value-face
'((t :inherit font-lock-variable-name-face))
"Face for special header values in the message view."
:group 'mu4e-faces)
(defface mu4e-view-link-face (defface mu4e-view-link-face
'((t :inherit font-lock-type-face :underline t)) '((t :inherit font-lock-type-face :underline t))
"Face for showing URLs and attachments in the message view." "Face for showing URLs and attachments in the message view."
@ -403,7 +408,7 @@ headers)."
( :name "To" ( :name "To"
:shortname "T" :shortname "T"
:help "Recipient of the message" :help "Recipient of the message"
:sortable t))) :sortable t)))
"An alist of all possible header fields and information about "An alist of all possible header fields and information about
them.; this is used in the UI (the column headers in the header them.; this is used in the UI (the column headers in the header
list, and the fields the message view). Most fields should be list, and the fields the message view). Most fields should be

View File

@ -165,8 +165,7 @@ plist."
(:subject (mu4e~view-construct-header field fieldval)) (:subject (mu4e~view-construct-header field fieldval))
(:path (mu4e~view-construct-header field fieldval)) (:path (mu4e~view-construct-header field fieldval))
(:maildir (mu4e~view-construct-header field fieldval)) (:maildir (mu4e~view-construct-header field fieldval))
(:flags (mu4e~view-construct-header field (:flags (mu4e~view-construct-flags-header fieldval))
(if fieldval (format "%S" fieldval) "")))
;; contact fields ;; contact fields
(:to (mu4e~view-construct-contacts-header msg field)) (:to (mu4e~view-construct-contacts-header msg field))
(:from (mu4e~view-construct-contacts-header msg field)) (:from (mu4e~view-construct-contacts-header msg field))
@ -238,7 +237,7 @@ marking if it still had that."
;; no use in trying to set flags again ;; no use in trying to set flags again
(mu4e~view-mark-as-read-maybe)))))) (mu4e~view-mark-as-read-maybe))))))
(defun mu4e~view-construct-header (field val &optional dont-propertize-val) (defun mu4e~view-construct-header (field val &optional dont-propertize-val)
"Return header field FIELD (as in `mu4e-header-info') with value "Return header field FIELD (as in `mu4e-header-info') with value
VAL if VAL is non-nil. If DONT-PROPERTIZE-VAL is non-nil, do not VAL if VAL is non-nil. If DONT-PROPERTIZE-VAL is non-nil, do not
@ -297,7 +296,7 @@ at POINT, or if nil, at (point)."
(mapconcat (mapconcat
(lambda(c) (lambda(c)
(let* ((name (car c)) (let* ((name (car c))
(email (cdr c)) (email (cdr c))
(short (or name email)) ;; name may be nil (short (or name email)) ;; name may be nil
(long (if name (format "%s <%s>" name email) email)) (long (if name (format "%s <%s>" name email) email))
(map (make-sparse-keymap))) (map (make-sparse-keymap)))
@ -322,6 +321,16 @@ at POINT, or if nil, at (point)."
(plist-get msg field) ", ") t)) (plist-get msg field) ", ") t))
(defun mu4e~view-construct-flags-header (flags)
"Construct a Flags: header."
(mu4e~view-construct-header
:flags
(mapconcat
(lambda (flag)
(propertize (symbol-name flag) 'face 'mu4e-view-special-header-value-face))
flags
(propertize ", " 'face 'mu4e-view-header-value-face)) t))
(defun mu4e~view-open-save-attach-func (msg attachnum is-open) (defun mu4e~view-open-save-attach-func (msg attachnum is-open)
"Return a function that offers to save attachment NUM. If IS-OPEN "Return a function that offers to save attachment NUM. If IS-OPEN
is nil, and otherwise open it." is nil, and otherwise open it."