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

@ -113,11 +113,9 @@ side of the modeline, and whose CDR is the right-hand side.")
"Build from ICON-SET the ICON with LABEL.
Using optionals attributes FACE, HELP-ECHO and VOFFSET."
(let ((icon-set-fn (pcase icon-set
('octicon #'all-the-icons-octicon)
('faicon #'all-the-icons-faicon)
('material #'all-the-icons-material)
('alltheicon #'all-the-icons-alltheicon)
('fileicon #'all-the-icons-fileicon))))
('octicon #'nerd-icons-octicon)
('faicon #'nerd-icons-faicon)
('material #'nerd-icons-mdicon))))
(propertize (concat (funcall icon-set-fn
icon
:face face
@ -290,7 +288,7 @@ Requires `anzu', also `evil-anzu' if using `evil-mode' for compatibility with
(evil-mc-frozen 'doom-modeline-highlight)
('doom-modeline-alternate-highlight))))
(concat (propertize " " 'face face)
(all-the-icons-faicon "i-cursor" :face face :v-adjust -0.0575)
(nerd-icons-faicon "nf-fa-i_cursor" :face face :v-adjust -0.0575)
(propertize " " 'face `(:inherit (variable-pitch ,face)))
(propertize (format "%d " count)
'face face)))))))
@ -332,7 +330,7 @@ Requires `anzu', also `evil-anzu' if using `evil-mode' for compatibility with
"Macro")
'face 'doom-modeline-highlight)
sep
(all-the-icons-octicon "triangle-right"
(nerd-icons-octicon "nf-oct-triangle_right"
:face 'doom-modeline-highlight
:v-adjust -0.05)
sep))))
@ -532,7 +530,7 @@ lines are selected, or the NxM dimensions of a block selection.")
mode-line-misc-info
+modeline-modes
(vc-mode (" "
,(all-the-icons-octicon "git-branch" :v-adjust 0.0)
,(nerd-icons-octicon "nf-oct-git_branch" :v-adjust 0.0)
vc-mode " "))
" "
+modeline-encoding
@ -540,8 +538,8 @@ lines are selected, or the NxM dimensions of a block selection.")
(def-modeline! 'project
`(" "
,(all-the-icons-octicon
"file-directory"
,(nerd-icons-octicon
"nf-oct-file_directory"
:face 'bold
:v-adjust -0.06
:height 1.1)

View file

@ -73,11 +73,11 @@ I rarely need to know what minor modes are active, so I removed them. ~M-x
doom/describe-active-minor-mode~ was written to substitute for it.
** Icons in my modeline look strange
1. Check whether ~all-the-icons~ are installed. Run ~M-x
all-the-icons-install-fonts~ to install the resource fonts. Note that
~all-the-icons~ only support GUI. See [[https://github.com/domtronn/all-the-icons.el][all-the-icons]] for details.
1. Check whether ~nerd-icons~ are installed. Run ~M-x
nerd-icons-install-fonts~ to install the resource fonts. Note that
~nerd-icons~ only support GUI. See [[https://github.com/domtronn/nerd-icons.el][nerd-icons]] for details.
2. ~cnfonts~ will conflict with ~all-the-icons~. You can refer the following
2. ~cnfonts~ will conflict with ~nerd-icons~. You can refer the following
workaround:
#+begin_src emacs-lisp
;; See https://github.com/seagle0128/doom-modeline/issues/278#issuecomment-569510336
@ -87,18 +87,11 @@ doom/describe-active-minor-mode~ was written to substitute for it.
(add-hook 'after-setting-font-hook #'cnfonts-set-font)
#+end_src
3. If ~all-the-icons~ fonts are installed while the icons cannot display
correctly, please install the non-free font [[https://dn-works.com/wp-content/uploads/2020/UFAS-Fonts/Symbola.zip][Symbola]]. This issue usually
occurs on Windows.
** The right side of the modeline is cut off
I believe the consensus is: this is due to oversized icons, i.e. a font issue.
Some possible solutions:
1. Tweak ~all-the-icons-scale-factor~ (1.2 by default): ~(setq
all-the-icons-scale-factor 1.1)~
2. Add some padding to the modeline definition:
1. Add some padding to the modeline definition:
#+begin_src emacs-lisp
(after! doom-modeline
(doom-modeline-def-modeline 'main
@ -106,7 +99,7 @@ Some possible solutions:
'(misc-info minor-modes checker input-method buffer-encoding major-mode process vcs " "))) ; <-- added padding here
#+end_src
3. Use another font for the mode line (or a different ~:height~) (source)
2. Use another font for the mode line (or a different ~:height~) (source)
#+begin_src emacs-lisp
(custom-set-faces!
'(mode-line :family "Noto Sans" :height 0.9)

View file

@ -37,21 +37,7 @@
(IS-WINDOWS 1)
(0)))
;; Fix modeline icons in daemon-spawned graphical frames. We have our own
;; mechanism for disabling all-the-icons, so we don't need doom-modeline to do
;; it for us. However, this may cause unwanted padding in the modeline in
;; daemon-spawned terminal frames. If it bothers you, you may prefer
;; `doom-modeline-icon' set to `nil'.
(when (daemonp)
(setq doom-modeline-icon t))
:config
;; HACK Fix #4102 due to empty all-the-icons return value (caused by
;; `doom--disable-all-the-icons-in-tty-a' advice) in tty daemon frames.
(defadvice! +modeline-disable-icon-in-daemon-a (fn &rest args)
:around #'doom-modeline-propertize-icon
(when (display-graphic-p)
(apply fn args)))
;; Fix an issue where these two variables aren't defined in TTY Emacs on MacOS
(defvar mouse-wheel-down-event nil)
(defvar mouse-wheel-up-event nil)

View file

@ -2,7 +2,7 @@
;;; ui/modeline/packages.el
(unless (modulep! +light)
(package! doom-modeline :pin "f45a5a200313568d54d73dd38bae76930c2008b5"))
(package! doom-modeline :pin "173ad0a27f2c3babe2009a3b760b92d3c8718f5a"))
(package! anzu :pin "5abb37455ea44fa401d5f4c1bdc58adb2448db67")
(when (modulep! :editor evil)
(package! evil-anzu :pin "d1e98ee6976437164627542909a25c6946497899"))