refactor!: replace all-the-icons with nerd-icons

BREAKING CHANGE: This commit replaces all-the-icons with nerd-fonts. Any
all-the-icons-* function calls or variable references in your private
config will break and should be replaced with their nerd-icons-*
equivalent. That said, Doom will continue to install all-the-icons for
a while, so feel free to load it if you don't want to fully commit to
the change yet.

This change is happening because nerd-icon has wider support for GUI and
TUI Emacs; has a larger, more consistent selection of symbols; plus unicode
coverage.

Fix: #7368
Close: #6675
Close: #7364
This commit is contained in:
Ellis Kenyő 2023-09-14 00:03:55 +01:00 committed by GitHub
parent 7bdf7cf7c0
commit 9787022b83
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
40 changed files with 293 additions and 407 deletions

View file

@ -6,7 +6,7 @@
* Description :unfold:
This module makes Emacs an email client, using [[https://www.djcbsoftware.nl/code/mu/mu4e.html][mu4e]].
- Tidied mu4e headers view, with flags from [[doom-package:all-the-icons]].
- Tidied mu4e headers view, with flags from [[doom-package:nerd-icons]].
- Consistent coloring of reply depths (across compose and gnus modes).
- Prettified =mu4e:main= view.
- Cooperative locking of the =mu= process. Another Emacs instance may request
@ -64,12 +64,12 @@ This module requires:
(recommended, default) or [[http://www.offlineimap.org/][offlineimap]] but you can sync mail in other ways too.
#+name: Install Matrix
| Platform | Install command | Base packages |
|---------------+----------------------------+-------------------------|
| MacOS | ~$ brew install <pkgs>~ | =mu= |
| Platform | Install command | Base packages |
|---------------+--------------------------+---------------------|
| MacOS | ~$ brew install <pkgs>~ | =mu= |
| Arch | ~$ pacman -S <pkgs>~ | (AUR, ~$ yay -S~) =mu= |
| openSUSE | ~$ zypper install <pkgs>~ | =maildir-utils=, =mu4e= |
| Fedora | ~$ dnf install <pkgs>~ | =maildir-utils= |
| Fedora | ~$ dnf install <pkgs>~ | =maildir-utils= |
| Debian/Ubuntu | ~$ apt-get install <pkgs>~ | =maildir-utils=, =mu4e= |
Then install either the =isync= (=mbsync=) or =offlineimap= package.

View file

@ -115,11 +115,11 @@ will also be the width of all other printable characters."
(cl-defun +mu4e-normalised-icon (name &key set color height v-adjust)
"Convert :icon declaration to icon"
(let* ((icon-set (intern (concat "all-the-icons-" (or set "faicon"))))
(let* ((icon-set (intern (concat "nerd-icons-" (or set "faicon"))))
(v-adjust (or v-adjust 0.02))
(height (or height 0.8))
(icon (if color
(apply icon-set `(,name :face ,(intern (concat "all-the-icons-" color)) :height ,height :v-adjust ,v-adjust))
(apply icon-set `(,name :face ,(intern (concat "nerd-icons-" color)) :height ,height :v-adjust ,v-adjust))
(apply icon-set `(,name :height ,height :v-adjust ,v-adjust))))
(icon-width (+mu4e--get-string-width icon))
(space-width (+mu4e--get-string-width " "))
@ -130,20 +130,20 @@ will also be the width of all other printable characters."
;;;###autoload
(defun +mu4e-initialise-icons ()
(setq mu4e-use-fancy-chars t
mu4e-headers-draft-mark (cons "D" (+mu4e-normalised-icon "pencil"))
mu4e-headers-flagged-mark (cons "F" (+mu4e-normalised-icon "flag"))
mu4e-headers-new-mark (cons "N" (+mu4e-normalised-icon "sync" :set "material" :height 0.8 :v-adjust -0.10))
mu4e-headers-passed-mark (cons "P" (+mu4e-normalised-icon "arrow-right"))
mu4e-headers-replied-mark (cons "R" (+mu4e-normalised-icon "reply"))
mu4e-headers-draft-mark (cons "D" (+mu4e-normalised-icon "nf-fa-pencil"))
mu4e-headers-flagged-mark (cons "F" (+mu4e-normalised-icon "nf-fa-flag"))
mu4e-headers-new-mark (cons "N" (+mu4e-normalised-icon "nf-md-sync" :set "material" :height 0.8 :v-adjust -0.10))
mu4e-headers-passed-mark (cons "P" (+mu4e-normalised-icon "nf-fa-arrow_right"))
mu4e-headers-replied-mark (cons "R" (+mu4e-normalised-icon "nf-fa-reply"))
mu4e-headers-seen-mark (cons "S" "") ;(+mu4e-normalised-icon "eye" :height 0.6 :v-adjust 0.07 :color "dsilver"))
mu4e-headers-trashed-mark (cons "T" (+mu4e-normalised-icon "trash"))
mu4e-headers-attach-mark (cons "a" (+mu4e-normalised-icon "file-text-o" :color "silver"))
mu4e-headers-encrypted-mark (cons "x" (+mu4e-normalised-icon "lock"))
mu4e-headers-signed-mark (cons "s" (+mu4e-normalised-icon "certificate" :height 0.7 :color "dpurple"))
mu4e-headers-unread-mark (cons "u" (+mu4e-normalised-icon "eye-slash" :v-adjust 0.05))
mu4e-headers-list-mark (cons "l" (+mu4e-normalised-icon "sitemap" :set "faicon"))
mu4e-headers-personal-mark (cons "p" (+mu4e-normalised-icon "user"))
mu4e-headers-calendar-mark (cons "c" (+mu4e-normalised-icon "calendar"))))
mu4e-headers-trashed-mark (cons "T" (+mu4e-normalised-icon "nf-fa-trash"))
mu4e-headers-attach-mark (cons "a" (+mu4e-normalised-icon "nf-fa-file_text_o" :color "silver"))
mu4e-headers-encrypted-mark (cons "x" (+mu4e-normalised-icon "nf-fa-lock"))
mu4e-headers-signed-mark (cons "s" (+mu4e-normalised-icon "nf-fa-certificate" :height 0.7 :color "dpurple"))
mu4e-headers-unread-mark (cons "u" (+mu4e-normalised-icon "nf-fa-eye_slash" :v-adjust 0.05))
mu4e-headers-list-mark (cons "l" (+mu4e-normalised-icon "nf-fa-sitemap" :set "faicon"))
mu4e-headers-personal-mark (cons "p" (+mu4e-normalised-icon "nf-fa-user"))
mu4e-headers-calendar-mark (cons "c" (+mu4e-normalised-icon "nf-fa-calendar"))))
(defun +mu4e-colorize-str (str &optional unique herring)
"Apply a face from `+mu4e-header-colorized-faces' to STR.

View file

@ -127,13 +127,13 @@ is non-nil."
(cons (make-help-button text1 help-echo)
(make-help-button text2 help-echo))))
(setq mu4e-headers-threaded-label
(make-help-button-cons "T" (concat " " (all-the-icons-octicon "git-branch" :v-adjust 0.05))
(make-help-button-cons "T" (concat " " (nerd-icons-octicon "nf-oct-git_branch" :v-adjust 0.05))
"Thread view")
mu4e-headers-related-label
(make-help-button-cons "R" (concat " " (all-the-icons-material "link" :v-adjust -0.1))
(make-help-button-cons "R" (concat " " (nerd-icons-mdicon "nf-md-link" :v-adjust -0.1))
"Showing related emails")
mu4e-headers-full-label
(make-help-button-cons "F" (concat " " (all-the-icons-material "disc_full"))
(make-help-button-cons "F" (concat " " (nerd-icons-mdicon "nf-md-disc"))
"Search is full!")))
;; set mail user agent
@ -156,14 +156,14 @@ is non-nil."
(add-to-list 'mu4e-bookmarks
'("flag:flagged" "Flagged messages" ?f) t)
;; TODO avoid assuming that all-the-icons is present
;; TODO avoid assuming that nerd-icons is present
(defvar +mu4e-header-colorized-faces
'(all-the-icons-green
all-the-icons-lblue
all-the-icons-purple-alt
all-the-icons-blue-alt
all-the-icons-purple
all-the-icons-yellow)
'(nerd-icons-green
nerd-icons-lblue
nerd-icons-purple-alt
nerd-icons-blue-alt
nerd-icons-purple
nerd-icons-yellow)
"Faces to use when coloring folders and account stripes.")
(defvar +mu4e-min-header-frame-width 120
@ -321,8 +321,8 @@ Acts like a singular `mu4e-view-save-attachments', without the saving."
sizefmt (format "%%-%ds " maxsizelen))
(dolist (pinfo partinfo)
(push (cons (concat (propertize (format "%-2s " (plist-get pinfo :index)) 'face '(bold font-lock-type-face))
(when (featurep 'all-the-icons)
(all-the-icons-icon-for-file (or (plist-get pinfo :filename) "")))
(when (featurep 'nerd-icons)
(nerd-icons-icon-for-file (or (plist-get pinfo :filename) "")))
(format fnamefmt (or (plist-get pinfo :filename)
(propertize (plist-get pinfo :type) 'face '(italic font-lock-doc-face))))
(format sizefmt (propertize (plist-get pinfo :size) 'face 'font-lock-builtin-face))