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:
parent
7bdf7cf7c0
commit
9787022b83
40 changed files with 293 additions and 407 deletions
|
@ -243,13 +243,13 @@ in."
|
|||
;; Check for fonts
|
||||
(if (not (executable-find "fc-list"))
|
||||
(warn! "Warning: unable to detect fonts because fontconfig isn't installed")
|
||||
;; all-the-icons fonts
|
||||
;; nerd-icons fonts
|
||||
(when (and (pcase system-type
|
||||
(`gnu/linux (concat (or (getenv "XDG_DATA_HOME")
|
||||
"~/.local/share")
|
||||
"/fonts/"))
|
||||
(`darwin "~/Library/Fonts/"))
|
||||
(require 'all-the-icons nil t))
|
||||
(require 'nerd-icons nil t))
|
||||
(with-temp-buffer
|
||||
(let ((errors 0))
|
||||
(cl-destructuring-bind (status . output)
|
||||
|
@ -257,13 +257,13 @@ in."
|
|||
(if (not (zerop status))
|
||||
(print! (error "There was an error running `fc-list'. Is fontconfig installed correctly?"))
|
||||
(insert (cdr (doom-call-process "fc-list" "" "file")))
|
||||
(dolist (font all-the-icons-font-names)
|
||||
(dolist (font nerd-icons-font-names)
|
||||
(if (save-excursion (re-search-backward font nil t))
|
||||
(success! "Found font %s" font)
|
||||
(print! (warn "Warning: couldn't find %S font") font)))
|
||||
(when (> errors 0)
|
||||
(explain! "Some all-the-icons fonts were missing.\n\n"
|
||||
"You can install them by running `M-x all-the-icons-install-fonts' within Emacs.\n"
|
||||
(explain! "Some nerd-icons fonts were missing.\n\n"
|
||||
"You can install them by running `M-x nerd-icons-install-fonts' within Emacs.\n"
|
||||
"This could also mean you've installed them in non-standard locations, in which "
|
||||
"case feel free to ignore this warning.")))))))))
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
(config? ("--config" :yes) "Create `$DOOMDIR' or dummy files therein?")
|
||||
(envfile? ("--env" :yes) "(Re)generate an envvars file? (see `$ doom help env`)")
|
||||
(install? ("--install" :yes) "Auto-install packages?")
|
||||
(fonts? ("--fonts" :yes) "Install (or prompt to install) all-the-icons fonts?")
|
||||
(fonts? ("--fonts" :yes) "Install (or prompt to install) nerd-icons fonts?")
|
||||
(hooks? ("--hooks" :yes) "Deploy Doom's git hooks to itself?")
|
||||
&context context)
|
||||
"Installs and sets up Doom Emacs for the first time.
|
||||
|
@ -32,7 +32,7 @@ This command does the following:
|
|||
3. Creates dummy files for `$DOOMDIR'/{config,packages}.el,
|
||||
4. Prompts you to generate an envvar file (same as `$ doom env`),
|
||||
5. Installs any dependencies of enabled modules (specified by `$DOOMDIR'/init.el),
|
||||
6. And prompts to install all-the-icons' fonts
|
||||
6. And prompts to install nerd-icons' fonts
|
||||
|
||||
This command is idempotent and safe to reuse.
|
||||
|
||||
|
@ -110,22 +110,6 @@ Change `$DOOMDIR' with the `--doomdir' option, e.g.
|
|||
('user-error
|
||||
(print! (warn "%s") (error-message-string e))))))
|
||||
|
||||
(cond ((eq fonts? :no))
|
||||
(IS-WINDOWS
|
||||
(print! (warn "Doom cannot install all-the-icons' fonts on Windows!\n"))
|
||||
(print-group!
|
||||
(print!
|
||||
(concat "You'll have to do so manually:\n\n"
|
||||
" 1. Launch Doom Emacs\n"
|
||||
" 2. Execute 'M-x all-the-icons-install-fonts' to download the fonts\n"
|
||||
" 3. Open the download location in windows explorer\n"
|
||||
" 4. Open each font file to install them"))))
|
||||
((or yes? (y-or-n-p "Download and install all-the-icon's fonts?"))
|
||||
(require 'all-the-icons)
|
||||
(let ((window-system (cond (IS-MAC 'ns)
|
||||
(IS-LINUX 'x))))
|
||||
(all-the-icons-install-fonts 'yes))))
|
||||
|
||||
(when (file-exists-p "~/.emacs")
|
||||
(print! (warn "A ~/.emacs file was detected. This conflicts with Doom and should be deleted!")))
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ Must be a `font-spec', a font object, an XFT font string, or an XLFD string. See
|
|||
|
||||
An omitted font size means to inherit `doom-font''s size.")
|
||||
|
||||
(defvar doom-unicode-font nil
|
||||
(defvar doom-unicode-font (font-spec :family "Symbols Nerd Font Mono")
|
||||
"Fallback font for Unicode glyphs.
|
||||
Must be a `font-spec', a font object, an XFT font string, or an XLFD string. See
|
||||
`doom-font' for examples.
|
||||
|
@ -419,41 +419,17 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original
|
|||
;;
|
||||
;;; Third party packages
|
||||
|
||||
(use-package! all-the-icons
|
||||
:commands (all-the-icons-octicon
|
||||
all-the-icons-faicon
|
||||
all-the-icons-fileicon
|
||||
all-the-icons-wicon
|
||||
all-the-icons-material
|
||||
all-the-icons-alltheicon)
|
||||
:preface
|
||||
(add-hook! 'after-setting-font-hook
|
||||
(defun doom-init-all-the-icons-fonts-h ()
|
||||
(when (fboundp 'set-fontset-font)
|
||||
(dolist (font (list "Weather Icons"
|
||||
"github-octicons"
|
||||
"FontAwesome"
|
||||
"all-the-icons"
|
||||
"file-icons"
|
||||
"Material Icons"))
|
||||
(set-fontset-font t 'unicode font nil 'append)))))
|
||||
:config
|
||||
(cond ((daemonp)
|
||||
(defadvice! doom--disable-all-the-icons-in-tty-a (fn &rest args)
|
||||
"Return a blank string in tty Emacs, which doesn't support multiple fonts."
|
||||
:around '(all-the-icons-octicon all-the-icons-material
|
||||
all-the-icons-faicon all-the-icons-fileicon
|
||||
all-the-icons-wicon all-the-icons-alltheicon)
|
||||
(if (or (not after-init-time) (display-multi-font-p))
|
||||
(apply fn args)
|
||||
"")))
|
||||
((not (display-graphic-p))
|
||||
(defadvice! doom--disable-all-the-icons-in-tty-a (&rest _)
|
||||
"Return a blank string for tty users."
|
||||
:override '(all-the-icons-octicon all-the-icons-material
|
||||
all-the-icons-faicon all-the-icons-fileicon
|
||||
all-the-icons-wicon all-the-icons-alltheicon)
|
||||
""))))
|
||||
(use-package! nerd-icons
|
||||
:commands (nerd-icons-octicon
|
||||
nerd-icons-faicon
|
||||
nerd-icons-flicon
|
||||
nerd-icons-wicon
|
||||
nerd-icons-mdicon
|
||||
nerd-icons-codicon
|
||||
nerd-icons-devicon
|
||||
nerd-icons-ipsicon
|
||||
nerd-icons-pomicon
|
||||
nerd-icons-powerline))
|
||||
|
||||
;; Hide the mode line in completion popups and MAN pages because they serve
|
||||
;; little purpose there, and is better hidden.
|
||||
|
|
|
@ -102,7 +102,7 @@
|
|||
"Create a header link according to SPEC."
|
||||
(let ((icon (and (plist-get spec :icon)
|
||||
(funcall (or (plist-get spec :icon-function)
|
||||
#'all-the-icons-material)
|
||||
#'nerd-icons-material)
|
||||
(plist-get spec :icon))))
|
||||
(label (pcase (plist-get spec :label)
|
||||
((and (pred functionp) lab)
|
||||
|
|
|
@ -52,8 +52,8 @@
|
|||
(with-memoization (get 'doom-system-distro-icon 'cached-value)
|
||||
(propertize
|
||||
(pcase (doom-system-distro)
|
||||
(`windows (all-the-icons-faicon "windows"))
|
||||
(`macos (all-the-icons-faicon "apple"))
|
||||
(`windows (nerd-icons-faicon "nf-fa-windows"))
|
||||
(`macos (nerd-icons-faicon "nf-fa-apple"))
|
||||
(`arch "\uF303")
|
||||
(`debian "\uF306")
|
||||
(`raspbian "\uF315")
|
||||
|
@ -74,7 +74,7 @@
|
|||
(`devuan "\uF307")
|
||||
(`manjaro "\uF312")
|
||||
((or `void `artix) "\uF17c")
|
||||
(_ (all-the-icons-faicon "linux")))
|
||||
(_ (nerd-icons-faicon "nf-fa-linux")))
|
||||
'face '(:height 1)
|
||||
'display '(raise 0))))
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
;; doom-ui.el
|
||||
(package! all-the-icons :pin "be9d5dcda9c892e8ca1535e288620eec075eb0be")
|
||||
(package! nerd-icons :pin "619a0382d2e159f3142c4200fe4cfc2e89247ef1")
|
||||
(package! hide-mode-line :pin "bc5d293576c5e08c29e694078b96a5ed85631942")
|
||||
(package! highlight-numbers :pin "8b4744c7f46c72b1d3d599d4fb75ef8183dee307")
|
||||
(package! rainbow-delimiters :pin "f40ece58df8b2f0fb6c8576b527755a552a5e763")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue