Many thanks, Joost, for this. I’ve been using more or less the same visual setup for mu4e for more than a decade, and this much improves the experience.
Here’s the modified version I’m using, with (a) some more colour customisation, (b) escaping of Gmail’s weird directory structure (most things other than INBOX are subdirectories of a `[Gmail]` directory), (c) prefixing part of the account name the the coloured label (I like redundancy in quickly identifying things):
(add-to-list 'mu4e-header-info-custom '(:short-maildir . (:name "Short maildir name" :shortname "Maildir" :help "Short, colour-coded maildir" :function jk/mu4e-short-maildir)))
(defun jk/mu4e-short-maildir (msg) "Shorten maildir for MSG." (let* ((maildir (mu4e-message-field msg :maildir)) (path (split-string maildir "/" t)) (account (car path))
;; 'escape' Gmail's superfluous subfoldering (subaccount (if (string= (cadr path) "[Gmail]") (caddr path) (cadr path))) (dir (concat ;; downcase account and abbreviate to first 8 letters unless shorter already: (downcase (substring (car path) 0 (if (< (length (car path)) 8) (length (car path)) 8))) " (" subaccount ")"))
(pad (max 0 (- 15 (length dir)))) (pad-left (make-string (/ pad 2) ?\s)) (pad-right (make-string (/ (1+ pad) 2) ?\s)) (face (pcase
account ("Professional" '(:background "midnight blue" :foreground "cyan3" :box (:line-width (3 . 1) :color "cyan3"))) ("Personal" '(:background "MediumOrchid4" :foreground "plum1" :box (:line-width (3 . 1) :color "plum1"))) ("UniofU" '(:background "#CC0000" :foreground "pink1" :box (:line-width (3 . 1) :color "pink1"))) ("OldWork" '(:background "tomato4" :foreground "RosyBrown1" :box (:line-width (3 . 1) :color "tomato3"))) ("SlopGmail" '(:background "DarkOrange3" :foreground "peach puff" :box (:line-width (3 . 1) :color "DarkOrange1"))) ("Beowulf" '(:background "gold3" :foreground "khaki1" :box (:line-width (3 . 1) :color "gold1"))) ("Offlist" '(:background "gray13" :foreground "green yellow" :box (:line-width (3 . 1) :color "green yellow"))) ("Mobile" '(:background "DeepPink3" :foreground "thistle" :box (:line-width (3 . 1) :color "DeepPink1")))
))) (propertize (concat pad-left dir pad-right) 'face face)))
(setq-default mu4e-headers-fields '((:more-human-date . 10) (:short-maildir . 18) (:flags . 6) (:mailing-list . 8) (:from-or-to . 23) (:thread-subject)))
best,
—Benjamin
–
'(Dr Benjamin Slade (he/him)
(website . https://lambda-y.net)
`(pgp_fp: ,(B20E 444C FA80 B5F8 15FA 4AD8 6FBF CD68 3B05 2B84))
“sent by mu4e 1.12.5 in Emacs 30.0.50 with org-msg on EndeavourOS Linux”)
(path (split-string maildir ““ t))
(account (car path))
(dir (if (string= account ”Trash“) ”Trash" (cadr path)))
(pad (max 0 (- 15 (length dir))))
(pad-left (make-string ( pad 2) ?\s))
(pad-right (make-string (/ (1+ pad) 2) ?\s))
(face (pcase account
(”Fastmail“ ’(:background ”LightSkyBlue1“ :box (:line-width (3 . 1) :color ”LightSkyBlue1“)))
(”Gmail“ ’(:background ”pale green“ :box (:line-width (3 . 1) :color ”pale green“)))
(”NldSchool“ ’(:background ”orange“ :box (:line-width (3 . 1) :color ”orange“)))
;; (”Trash" ’(:background nil :box nil))
)))
(propertize (concat pad-left dir pad-right) ’face face)))
```
Trash is handled separately, because it’s a maildir directly under ~/Mail/, so
it’s not linked to one specific account. And I’m adding coloured boxes because I
found that the highlight for the current message actually overrides the
background colour of the text, but it doesn’t override the box.
Finally, I added the new field to `mu4e-header-fields`:
```
(setq-default mu4e-headers-fields ’((:date . 20)
(:flags . 6)
(:short-maildir . 15)
(:from-or-to . 22)
(:thread-subject)))
```
I’m attaching a screen shot to show what it looks like.
–
Joost Kremers
Life has its moments
–
You received this message because you are subscribed to the Google Groups “mu-discuss” group.
To unsubscribe from this group and stop receiving emails from it, send an email to mu-discuss+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mu-discuss/865xul9eij.fsf%40fastmail.fm.
[2. image/png; Screenshot from 2024-06-07 11-42-26.png]…