fix(cli): doctor: wrong-type-argument stringp error

`doom doctor` throws a type error for enabled modules without a
doctor.el and/or packages.el file. This occurs because, in
in775ee2f04aad, `doom-module-expand-path` was changed to return nil if
the target file did not exist, and the doctor wasn't updated to handle
this. It passes `nil` to `load`, causing this type error.

Amend: 775ee2f04a
This commit is contained in:
Henrik Lissner 2023-02-21 20:17:43 -05:00
parent 8f50ead5c8
commit 9e08097119
No known key found for this signature in database
GPG key ID: B60957CA074D39A3

View file

@ -246,21 +246,23 @@ in."
(doom-module-context-with (cons group name) (doom-module-context-with (cons group name)
(let ((doctor-file (doom-module-expand-path group name "doctor.el")) (let ((doctor-file (doom-module-expand-path group name "doctor.el"))
(packages-file (doom-module-expand-path group name doom-module-packages-file))) (packages-file (doom-module-expand-path group name doom-module-packages-file)))
(cl-loop with doom-output-indent = 6 (when packages-file
for name in (doom-context-with 'packages (cl-loop with doom-output-indent = 6
(let* (doom-packages for name in (doom-context-with 'packages
doom-disabled-packages) (let* (doom-packages
(load packages-file 'noerror 'nomessage) doom-disabled-packages)
(mapcar #'car doom-packages))) (load packages-file 'noerror 'nomessage)
unless (or (doom-package-get name :disable) (mapcar #'car doom-packages)))
(eval (doom-package-get name :ignore)) unless (or (doom-package-get name :disable)
(plist-member (doom-package-get name :recipe) :local-repo) (eval (doom-package-get name :ignore))
(locate-library (symbol-name name)) (plist-member (doom-package-get name :recipe) :local-repo)
(doom-package-built-in-p name) (locate-library (symbol-name name))
(doom-package-installed-p name)) (doom-package-built-in-p name)
do (print! (error "Missing emacs package: %S") name)) (doom-package-installed-p name))
(let ((inhibit-message t)) do (print! (error "Missing emacs package: %S") name)))
(load doctor-file 'noerror 'nomessage)))) (when doctor-file
(let ((inhibit-message t))
(load doctor-file 'noerror 'nomessage)))))
(file-missing (error! "%s" (error-message-string ex))) (file-missing (error! "%s" (error-message-string ex)))
(error (error! "Syntax error: %s" ex))) (error (error! "Syntax error: %s" ex)))
(when (or doom-doctor--errors doom-doctor--warnings) (when (or doom-doctor--errors doom-doctor--warnings)