feat: make bin/doom profile aware
- Fixes Doom's former inability to (trivially) juggle multiple profiles based on the same EMACSDIR (see #6593). - Adds '--profile NAME' switch to bin/doom (also recognized $DOOMPROFILE). - Adds new doom-profile* variables. These will eventually replace doom-{local,etc,cache}-dir and doom-{autoloads,env}-file. This is intentionally messy to ensure backwards compatibility for a little while longer. This will be fixed over the next couple weeks. Ref: #6593
This commit is contained in:
parent
1ecb5c7b9b
commit
5af38fb08e
5 changed files with 154 additions and 67 deletions
|
@ -39,6 +39,20 @@
|
|||
;; Ensure errors are sufficiently detailed from this point on.
|
||||
(setq debug-on-error t)
|
||||
|
||||
;;; Initialize profile
|
||||
(let ((profile (getenv "DOOMPROFILE")))
|
||||
(when profile
|
||||
(with-temp-buffer
|
||||
(let ((coding-system-for-read 'utf-8-auto))
|
||||
(insert-file-contents (expand-file-name "profiles.el" user-emacs-directory)))
|
||||
(condition-case e
|
||||
(dolist (var (or (cdr (assq (intern profile) (read (current-buffer))))
|
||||
(user-error "No %S profile found" profile)))
|
||||
(if (eq var 'env)
|
||||
(dolist (env var) (setenv (car env) (cdr env)))
|
||||
(set (car var) (cdr var))))
|
||||
(error (error "Failed to parse profiles.el: %s" (error-message-string e)))))))
|
||||
|
||||
;; HACK Load `cl' and site files manually to prevent polluting logs and stdout
|
||||
;; with deprecation and/or file load messages.
|
||||
(let ((inhibit-message (not (or (getenv "DEBUG") init-file-debug))))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue