Improve font detection (+ all-the-icons fonts) #167
make doctor will now complain if it can't find any of the fonts that Doom uses, and offer help on how to install them.
This commit is contained in:
parent
7233d6f19a
commit
b65718691f
1 changed files with 33 additions and 8 deletions
|
@ -130,14 +130,39 @@
|
||||||
|
|
||||||
;; --- is the environment set up properly? --------------------
|
;; --- is the environment set up properly? --------------------
|
||||||
|
|
||||||
(when (boundp 'doom-font)
|
;; are all default fonts present
|
||||||
(cond ((fboundp 'find-font)
|
(log! "test-fonts")
|
||||||
(unless (find-font doom-font)
|
(if (not (fboundp 'find-font))
|
||||||
(warn! "Warning: couldn't find %s font" (font-get doom-font :family))
|
(progn
|
||||||
(explain! "If you use a different font, you may ignore this warning.")))
|
(warn! "Warning: unable to detect font")
|
||||||
(t
|
(explain! "The `find-font' function is missing. This could indicate the incorrect "
|
||||||
(warn! "Couldn't detect font!")
|
"version of Emacs is being used!"))
|
||||||
(explain! "This could indicate the incorrect version of Emacs is being used!"))))
|
(defun -find-font (family)
|
||||||
|
(when (fontp family)
|
||||||
|
(setq family (symbol-name (font-get doom-font :family))))
|
||||||
|
(let ((inhibit-message t))
|
||||||
|
(shell-command (format "fc-list | grep %s" (shell-quote-argument family)))))
|
||||||
|
|
||||||
|
(when (boundp 'doom-font)
|
||||||
|
(if (-find-font doom-font)
|
||||||
|
(success! "Found font %s" (font-get doom-font :family))
|
||||||
|
(warn! "Warning: couldn't find %s font (default) (%s)"
|
||||||
|
(font-get doom-font :family))))
|
||||||
|
;; all-the-icons fonts
|
||||||
|
(let ((font-dest (pcase system-type
|
||||||
|
('gnu/linux (concat (or (getenv "XDG_DATA_HOME")
|
||||||
|
(concat (getenv "HOME") "/.local/share"))
|
||||||
|
"/fonts/"))
|
||||||
|
('darwin (concat (getenv "HOME") "/Library/Fonts/")))))
|
||||||
|
(when (and font-dest (require 'all-the-icons nil t))
|
||||||
|
(dolist (font all-the-icons-font-names)
|
||||||
|
(if (file-exists-p (expand-file-name font font-dest))
|
||||||
|
(success! "Found font %s" font)
|
||||||
|
(warn! "Warning: couldn't find %s font in %s"
|
||||||
|
font font-dest)
|
||||||
|
(explain! "You can install it by running `M-x all-the-icons-install-fonts' within Emacs.\n\n"
|
||||||
|
"This could also mean you've installed them in non-standard locations, in which "
|
||||||
|
"case, ignore this warning."))))))
|
||||||
|
|
||||||
;; gnutls-cli & openssl
|
;; gnutls-cli & openssl
|
||||||
(cond ((executable-find "gnutls-cli"))
|
(cond ((executable-find "gnutls-cli"))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue