Refactor doom doctor
And move font check into core/doctor.el
This commit is contained in:
parent
fd1b31667e
commit
798e10c4f2
2 changed files with 29 additions and 32 deletions
|
@ -38,10 +38,10 @@
|
||||||
|
|
||||||
;;; Helpers
|
;;; Helpers
|
||||||
|
|
||||||
(defun sh (cmd)
|
(defun sh (cmd &rest args)
|
||||||
(ignore-errors
|
(ignore-errors
|
||||||
(string-trim-right
|
(string-trim-right
|
||||||
(shell-command-to-string cmd))))
|
(shell-command-to-string (format cmd args)))))
|
||||||
|
|
||||||
(defun elc-check-dir (dir)
|
(defun elc-check-dir (dir)
|
||||||
(dolist (file (directory-files-recursively dir "\\.elc$"))
|
(dolist (file (directory-files-recursively dir "\\.elc$"))
|
||||||
|
@ -184,29 +184,6 @@
|
||||||
(warn! "Warning: Windows detected")
|
(warn! "Warning: Windows detected")
|
||||||
(explain! "DOOM was designed for MacOS and Linux. Expect a bumpy ride!"))
|
(explain! "DOOM was designed for MacOS and Linux. Expect a bumpy ride!"))
|
||||||
|
|
||||||
;; are all default fonts present?
|
|
||||||
(section! "Checking your fonts...")
|
|
||||||
(if (not (fboundp 'find-font))
|
|
||||||
(progn
|
|
||||||
(warn! "Warning: unable to detect font")
|
|
||||||
(explain! "The `find-font' function is missing. This could indicate the incorrect "
|
|
||||||
"version of Emacs is being used!"))
|
|
||||||
;; all-the-icons fonts
|
|
||||||
(let ((font-dest (pcase system-type
|
|
||||||
(`gnu/linux (concat (or (getenv "XDG_DATA_HOME")
|
|
||||||
"~/.local/share")
|
|
||||||
"/fonts/"))
|
|
||||||
(`darwin "~/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 feel free to ignore this warning."))))))
|
|
||||||
|
|
||||||
;; gnutls-cli & openssl
|
;; gnutls-cli & openssl
|
||||||
(section! "Checking gnutls/openssl...")
|
(section! "Checking gnutls/openssl...")
|
||||||
(cond ((executable-find "gnutls-cli"))
|
(cond ((executable-find "gnutls-cli"))
|
||||||
|
@ -231,7 +208,7 @@
|
||||||
(t
|
(t
|
||||||
(error! "Important: couldn't find either gnutls-cli nor openssl")
|
(error! "Important: couldn't find either gnutls-cli nor openssl")
|
||||||
(explain!
|
(explain!
|
||||||
"You won't be able to install/update packages because Emacs won't be able to "
|
"You may not be able to install/update packages because Emacs won't be able to "
|
||||||
"verify HTTPS ELPA sources. Install gnutls-cli or openssl v1.0.0+. If for some "
|
"verify HTTPS ELPA sources. Install gnutls-cli or openssl v1.0.0+. If for some "
|
||||||
"reason you can't, you can bypass this verification with the INSECURE flag:\n\n"
|
"reason you can't, you can bypass this verification with the INSECURE flag:\n\n"
|
||||||
|
|
||||||
|
@ -288,16 +265,14 @@
|
||||||
(`empty (error! "Couldn't reach %s" url))
|
(`empty (error! "Couldn't reach %s" url))
|
||||||
(`timeout (error! "Timed out trying to contact %s" ex))
|
(`timeout (error! "Timed out trying to contact %s" ex))
|
||||||
(_
|
(_
|
||||||
(error! "Validated %s (this shouldn't happen!)" url))))))
|
(error! "Validated %s (this shouldn't happen!)" url)))))))
|
||||||
|
|
||||||
((error! "Nope!")))
|
|
||||||
|
|
||||||
;; which variant of tar is on your system? bsd or gnu tar?
|
;; which variant of tar is on your system? bsd or gnu tar?
|
||||||
(section! "Checking for GNU/BSD tar...")
|
(section! "Checking for GNU/BSD tar...")
|
||||||
(let ((tar-bin (or (executable-find "gtar")
|
(let ((tar-bin (or (executable-find "gtar")
|
||||||
(executable-find "tar"))))
|
(executable-find "tar"))))
|
||||||
(if tar-bin
|
(if tar-bin
|
||||||
(unless (string-match-p "(GNU tar)" (sh (format "%s --version" tar-bin)))
|
(unless (string-match-p "(GNU tar)" (sh "%s --version" tar-bin))
|
||||||
(warn! "Warning: BSD tar detected")
|
(warn! "Warning: BSD tar detected")
|
||||||
(explain!
|
(explain!
|
||||||
"QUELPA (through package-build) uses the system tar to build plugins, but it "
|
"QUELPA (through package-build) uses the system tar to build plugins, but it "
|
||||||
|
|
|
@ -33,5 +33,27 @@
|
||||||
(file-directory-p "~/.doom.d"))
|
(file-directory-p "~/.doom.d"))
|
||||||
(warn! "Both %S and '~/.doom.d' exist on your system"
|
(warn! "Both %S and '~/.doom.d' exist on your system"
|
||||||
(abbreviate-file-name doom-private-dir))
|
(abbreviate-file-name doom-private-dir))
|
||||||
(explain! "Doom will only load one of these (~/.config/doom takes precedence). Since\n"
|
(explain! "Doom will only load one of these (~/.config/doom takes precedence). Possessing\n"
|
||||||
"it is rarely intentional that you have both, ~/.doom.d should be removed."))
|
"both is rarely intentional; you should one or the other."))
|
||||||
|
|
||||||
|
;; Check for fonts
|
||||||
|
(if (not (fboundp 'find-font))
|
||||||
|
(progn
|
||||||
|
(warn! "Warning: unable to detect font")
|
||||||
|
(explain! "The `find-font' function is missing. This could indicate the incorrect "
|
||||||
|
"version of Emacs is being used!"))
|
||||||
|
;; all-the-icons fonts
|
||||||
|
(let ((font-dest (pcase system-type
|
||||||
|
(`gnu/linux (concat (or (getenv "XDG_DATA_HOME")
|
||||||
|
"~/.local/share")
|
||||||
|
"/fonts/"))
|
||||||
|
(`darwin "~/Library/Fonts/"))))
|
||||||
|
(when (and font-dest (require 'all-the-icons nil t))
|
||||||
|
(dolist (font all-the-icons-font-families)
|
||||||
|
(if (sh "fc-list | grep %s" font)
|
||||||
|
(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 feel free to ignore this warning."))))))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue