Ensure user-emacs-directory in doctor

Also allow it to be customized with EMACSDIR envvar
This commit is contained in:
Henrik Lissner 2019-04-15 03:47:24 -04:00
parent 7885cbb4f7
commit 54d180b376
No known key found for this signature in database
GPG Key ID: 5F6C0EA160557395

View File

@ -13,8 +13,11 @@
;; are limited to very basic standard library calls (e.g. avoid cl, subr-x, and
;; any Doom dependencies).
;; In really old versions of Emacs `user-emacs-directory' isn't defined
(defvar user-emacs-directory (expand-file-name "../" (file-name-directory load-file-name)))
;; Ensure Doom doctor always runs out of the current Emacs directory (optionally
;; specified by the EMACSDIR envvar)
(setq user-emacs-directory
(or (getenv "EMACSDIR")
(expand-file-name "../" (file-name-directory load-file-name))))
(unless (file-directory-p user-emacs-directory)
(error "Couldn't find a Doom config!"))