docs: more robust nerd-icon doctor check

Fix: #7431
This commit is contained in:
Henrik Lissner
2024-10-02 16:42:57 -04:00
parent c75e1b915b
commit 896204c8f7

View File

@ -259,22 +259,23 @@ in."
(`darwin "~/Library/Fonts/")) (`darwin "~/Library/Fonts/"))
(require 'nerd-icons nil t)) (require 'nerd-icons nil t))
(with-temp-buffer (with-temp-buffer
(let ((errors 0)) (cl-destructuring-bind (status . output)
(cl-destructuring-bind (status . output) (doom-call-process "fc-list" "" "family")
(doom-call-process "fc-list" "" "file") (if (not (zerop status))
(if (not (zerop status)) (print! (error "There was an error running `fc-list'. Is fontconfig installed correctly?"))
(print! (error "There was an error running `fc-list'. Is fontconfig installed correctly?")) (insert output)
(insert (cdr (doom-call-process "fc-list" "" "file"))) (if (re-search-backward nerd-icons-font-family nil t)
(dolist (font nerd-icons-font-names) (success! "Found %s" nerd-icons-font-family)
(if (save-excursion (re-search-backward font nil t)) (print! (warn "Failed to locate '%s' font on your system") nerd-icons-font-family)
(success! "Found font %s" font) (explain! "This font is required for icons in Doom Emacs. To download and install "
(print! (warn "%S font is not installed on your system") font) "them, do one of the following:\n\n"
(cl-incf errors))) " - Execute `M-x nerd-icons-install-fonts' from within Doom Emacs (NOTE: "
(when (> errors 0) " on Windows this command will only download them; the fonts must then "
(explain! "Some needed fonts are not properly installed on your system. To download and " " be installed manually afterwards).\n"
"install them, run `M-x nerd-icons-install-fonts' from within Doom Emacs. " " - Download and install 'Symbols Nerd Font' from https://nerdfonts.com "
"However, on Windows this command will only download them; the fonts must " " or via your OS package manager. (You'll need to change the "
"be installed manually afterwards."))))))))) " `nerd-icons-font-names' and/or `nerd-icons-font-family' variables to "
" reflect a non-standard file or font family name).\n"))))))))
(print! (start "Checking for stale elc files in your DOOMDIR...")) (print! (start "Checking for stale elc files in your DOOMDIR..."))
(when (file-directory-p doom-user-dir) (when (file-directory-p doom-user-dir)