doom-doctor: minor refactor
This commit is contained in:
parent
b0e6ba769e
commit
c550851500
1 changed files with 32 additions and 30 deletions
|
@ -8,6 +8,7 @@
|
||||||
;; In case it isn't defined (in really old versions of Emacs, like the one that
|
;; In case it isn't defined (in really old versions of Emacs, like the one that
|
||||||
;; ships with MacOS).
|
;; ships with MacOS).
|
||||||
(defvar user-emacs-directory (expand-file-name "~/.emacs.d/"))
|
(defvar user-emacs-directory (expand-file-name "~/.emacs.d/"))
|
||||||
|
(defvar doom-debug-mode (getenv "DEBUG"))
|
||||||
|
|
||||||
(unless (equal (expand-file-name user-emacs-directory)
|
(unless (equal (expand-file-name user-emacs-directory)
|
||||||
(expand-file-name "~/.emacs.d/"))
|
(expand-file-name "~/.emacs.d/"))
|
||||||
|
@ -70,11 +71,11 @@
|
||||||
(format "\e[%dm%s\e[%dm" code (apply #'format msg args) 0))
|
(format "\e[%dm%s\e[%dm" code (apply #'format msg args) 0))
|
||||||
|
|
||||||
(defalias 'msg! #'message)
|
(defalias 'msg! #'message)
|
||||||
(defmacro error! (&rest args) `(message (color 1 (color 31 ,@args))))
|
(defmacro error! (&rest args) `(msg! (color 1 (color 31 ,@args))))
|
||||||
(defmacro warn! (&rest args) `(message (color 1 (color 33 ,@args))))
|
(defmacro warn! (&rest args) `(msg! (color 1 (color 33 ,@args))))
|
||||||
(defmacro success! (&rest args) `(message (color 1 (color 32 ,@args))))
|
(defmacro success! (&rest args) `(msg! (color 1 (color 32 ,@args))))
|
||||||
(defmacro section! (&rest args) `(message (color 34 ,@args)))
|
(defmacro section! (&rest args) `(msg! (color 34 ,@args)))
|
||||||
(defmacro explain! (&rest args) `(message (indented 2 (autofill ,@args))))
|
(defmacro explain! (&rest args) `(msg! (indented 2 (autofill ,@args))))
|
||||||
|
|
||||||
;;; Polyfills
|
;;; Polyfills
|
||||||
;; early versions of emacs won't have this
|
;; early versions of emacs won't have this
|
||||||
|
@ -233,7 +234,7 @@
|
||||||
(`timeout (error! "Timed out trying to contact %s" ex))
|
(`timeout (error! "Timed out trying to contact %s" ex))
|
||||||
(_
|
(_
|
||||||
(error! "Failed to validate %s" url)
|
(error! "Failed to validate %s" url)
|
||||||
(when (getenv "DEBUG")
|
(when doom-debug-mode
|
||||||
(explain! (pp-to-string it)))))))
|
(explain! (pp-to-string it)))))))
|
||||||
(dolist (url '("https://self-signed.badssl.com"
|
(dolist (url '("https://self-signed.badssl.com"
|
||||||
"https://wrong.host.badssl.com/"))
|
"https://wrong.host.badssl.com/"))
|
||||||
|
@ -275,7 +276,7 @@
|
||||||
|
|
||||||
;; --- report! ------------------------------------------------
|
;; --- report! ------------------------------------------------
|
||||||
|
|
||||||
(when (getenv "DEBUG")
|
(when doom-debug-mode
|
||||||
(msg! "\n====\nHave some debug information:\n")
|
(msg! "\n====\nHave some debug information:\n")
|
||||||
|
|
||||||
(when (bound-and-true-p doom-modules)
|
(when (bound-and-true-p doom-modules)
|
||||||
|
@ -290,11 +291,12 @@
|
||||||
(msg! " + enabled packages:\n%s"
|
(msg! " + enabled packages:\n%s"
|
||||||
(indented 4
|
(indented 4
|
||||||
(columns 2 35
|
(columns 2 35
|
||||||
|
(delq nil
|
||||||
(mapcar (lambda (pkg)
|
(mapcar (lambda (pkg)
|
||||||
(let ((desc (cadr (assq pkg package-alist))))
|
(let ((desc (cadr (assq pkg package-alist))))
|
||||||
(when desc
|
(when desc
|
||||||
(package-desc-full-name desc))))
|
(package-desc-full-name desc))))
|
||||||
(sort (mapcar #'car doom-packages) #'string-lessp))))))
|
(sort (mapcar #'car doom-packages) #'string-lessp)))))))
|
||||||
|
|
||||||
(msg! " + byte-compiled files:\n%s"
|
(msg! " + byte-compiled files:\n%s"
|
||||||
(indented 4
|
(indented 4
|
||||||
|
@ -318,7 +320,7 @@
|
||||||
(success! "Everything seems fine, happy Emacs'ing!")
|
(success! "Everything seems fine, happy Emacs'ing!")
|
||||||
(message "\n----")
|
(message "\n----")
|
||||||
(warn! "There were issues!")
|
(warn! "There were issues!")
|
||||||
(unless (getenv "DEBUG")
|
(unless doom-debug-mode
|
||||||
(msg! "\nHopefully these can help you find problems. If not, run this doctor again with DEBUG=1:")
|
(msg! "\nHopefully these can help you find problems. If not, run this doctor again with DEBUG=1:")
|
||||||
(msg! "\n DEBUG=1 make doctor\n")
|
(msg! "\n DEBUG=1 make doctor\n")
|
||||||
(msg! "And file a bug report with its output at https://github.com/hlissner/.emacs.d/issues")))
|
(msg! "And file a bug report with its output at https://github.com/hlissner/.emacs.d/issues")))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue