Fix #2046 replacing process-environment, exec-path & shell-file-name
This commit is contained in:
parent
cc793f323f
commit
a6e25209b8
2 changed files with 16 additions and 9 deletions
23
core/core.el
23
core/core.el
|
@ -417,12 +417,13 @@ in interactive sessions, nil otherwise (but logs a warning)."
|
|||
(if (not (file-readable-p file))
|
||||
(unless noerror
|
||||
(signal 'file-error (list "Couldn't read envvar file" file)))
|
||||
(let (environment)
|
||||
(let (envvars environment)
|
||||
(with-temp-buffer
|
||||
(save-excursion
|
||||
(insert "\n")
|
||||
(insert-file-contents file))
|
||||
(while (re-search-forward "\n *\\([^#= \n]*\\)=" nil t)
|
||||
(push (match-string 1) envvars)
|
||||
(push (buffer-substring
|
||||
(match-beginning 1)
|
||||
(1- (or (save-excursion
|
||||
|
@ -431,13 +432,19 @@ in interactive sessions, nil otherwise (but logs a warning)."
|
|||
(point-max))))
|
||||
environment)))
|
||||
(when environment
|
||||
(setq-default
|
||||
process-environment (nreverse environment)
|
||||
exec-path (append (parse-colon-path (getenv "PATH"))
|
||||
(list exec-directory))
|
||||
shell-file-name (or (getenv "SHELL")
|
||||
shell-file-name))
|
||||
process-environment))))
|
||||
(setq process-environment
|
||||
(append (nreverse environment) process-environment)
|
||||
exec-path
|
||||
(if (member "PATH" envvars)
|
||||
(append (parse-colon-path (getenv "PATH"))
|
||||
(list exec-directory))
|
||||
exec-path)
|
||||
shell-file-name
|
||||
(if (member "SHELL" envvars)
|
||||
(setq shell-file-name
|
||||
(or (getenv "SHELL") shell-file-name))
|
||||
shell-file-name))
|
||||
envvars))))
|
||||
|
||||
(defun doom-initialize (&optional force-p)
|
||||
"Bootstrap Doom, if it hasn't already (or if FORCE-P is non-nil).
|
||||
|
|
|
@ -117,7 +117,7 @@
|
|||
|
||||
(it "returns the new value for `process-environment'"
|
||||
(expect (doom-load-envvars-file doom-env-file)
|
||||
:to-equal '("A=1" "B=2" "C=3")))
|
||||
:to-have-same-items-as '("A" "B" "C")))
|
||||
|
||||
(it "alters environment variables"
|
||||
(dolist (key '("A" "B" "C"))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue