fix(profiles): no bootstrap file for non-bootloaders

If Doom doesn't live in ~/.emacs.d or ~/.config/emacs, then it cannot
play the role of bootloader, so opt out of generating the profile
bootstrappper in this case.

That said, don't disable the profile system entirely; it can still be
useful for internal, noninteractive, and sandbox use.
This commit is contained in:
Henrik Lissner 2022-09-17 14:50:23 +02:00
parent 753b479ea6
commit 36a9637e79
No known key found for this signature in database
GPG key ID: B60957CA074D39A3
3 changed files with 12 additions and 6 deletions

View file

@ -74,6 +74,12 @@ run.")
;;
;;; Helpers
(defun doom-profiles-bootloadable-p ()
"Return non-nil if `doom-emacs-dir' can be a bootloader."
(with-memoization (get 'doom 'bootloader)
(or (file-equal-p doom-emacs-dir "~/.config/emacs")
(file-equal-p doom-emacs-dir "~/.emacs.d"))))
(defun doom-profiles-read (&rest paths)
"TODO"
(let (profiles)
@ -218,8 +224,7 @@ is non-nil, refresh the cache."
(--defer-vars--))))))))
(lambda ()
(if (or noninteractive
(file-equal-p user-emacs-directory "~/.config/emacs")
(file-equal-p user-emacs-directory "~/.emacs.d"))
(,(symbol-function #'doom-profiles-bootloadable-p)))
(user-error "Failed to find profile: %s" (getenv "DOOMPROFILE"))
(user-error "To be a bootloader, Doom must be installed in ~/.config/emacs or ~/.emacs.d"))))))
:mode #o600