doom/doctor: improve error handler for font detection

Fixes #3008
This commit is contained in:
Henrik Lissner
2020-05-15 04:59:10 -04:00
parent 805976b8bd
commit 87e279ce61

View File

@@ -132,14 +132,21 @@ in."
(`darwin "~/Library/Fonts/")) (`darwin "~/Library/Fonts/"))
(require 'all-the-icons nil t)) (require 'all-the-icons nil t))
(with-temp-buffer (with-temp-buffer
(let ((errors 0))
(cl-destructuring-bind (status . output)
(doom-call-process "fc-list" "" "file")
(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"))) (insert (cdr (doom-call-process "fc-list" "" "file")))
(dolist (font all-the-icons-font-names) (dolist (font all-the-icons-font-names)
(if (save-excursion (re-search-backward font nil t)) (if (save-excursion (re-search-backward font nil t))
(success! "Found font %s" font) (success! "Found font %s" font)
(print! (warn "Warning: couldn't find %S font") font) (print! (warn "Warning: couldn't find %S font") font)))
(explain! "You can install it by running `M-x all-the-icons-install-fonts' within Emacs.\n\n" (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"
"This could also mean you've installed them in non-standard locations, in which " "This could also mean you've installed them in non-standard locations, in which "
"case feel free to ignore this warning."))))))) "case feel free to ignore this warning.")))))))))
(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-private-dir) (when (file-directory-p doom-private-dir)