refactor(cli): set __DOOMCONTEXT at runtime

Addresses the edge case where the user sets (or unsets) __DOOMCONTEXT in
their CLI config.
This commit is contained in:
Henrik Lissner 2022-08-10 14:10:08 +02:00
parent de62c5449d
commit 61ff5a4421
No known key found for this signature in database
GPG key ID: B60957CA074D39A3

View file

@ -1144,7 +1144,6 @@ Emacs' batch library lacks an implementation of the exec system call."
(convert-buffer doom-cli-context-stderr))
(prin1 newcontext (current-buffer))))
(set-file-modes context-file #o400)
(setenv "__DOOMCONTEXT" context-file)
(make-directory (file-name-directory script-file) t)
(let ((coding-system-for-write 'utf-8-auto)
(persistent-files (combine-and-quote-strings (delq nil (list script-file context-file))))
@ -1163,6 +1162,7 @@ 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 env " \\\n")
"__DOOMCONTEXT=" (shell-quote-argument context-file) " \\\n"
(format "PATH=\"%s%s$PATH\" \\\n"
(doom-path doom-emacs-dir "bin")
path-separator)