fix(cli): ensure doom envvars are set for post-script sessions

Particularly DOOMPROFILE, without which the --profile switch wasn't
actually doing anything, and profile sessions would (silently) use the
default user-emacs-directory and doom-user-dir.
This commit is contained in:
Henrik Lissner 2022-09-17 20:50:12 +02:00
parent 6dffa09c71
commit 21f2ad58b5
No known key found for this signature in database
GPG key ID: B60957CA074D39A3

View file

@ -1205,7 +1205,14 @@ Emacs' batch library lacks an implementation of the exec system call."
"_doomcleanup() {\n rm -f " ,persistent-files "\n}\n"
"_doomrun() {\n " ,command "\n}\n"
,(string-join persisted-env " \\\n")
"__DOOMCONTEXT=" ,(shell-quote-argument context-file) " \\\n"
,(cl-loop for (envvar . val)
in `(("DOOMPROFILE" . ,(doom-profile->id (or doom-profile doom-profile-default)))
("EMACSDIR" . ,doom-emacs-dir)
("DOOMDIR" . ,doom-user-dir)
("DEBUG" . ,(if init-file-debug "1"))
("__DOOMCONTEXT" . ,context-file))
if val
concat (format "%s=%s \\\n" envvar (shell-quote-argument val)))
,(format "PATH=\"%s%s$PATH\" \\\n"
(doom-path doom-emacs-dir "bin")
path-separator)