Set exec-path/shell-file-name in doom-load-env-vars

And perform file-readable-p check inside doom-load-env-vars
This commit is contained in:
Henrik Lissner 2019-06-18 11:44:50 +02:00
parent 12fa049012
commit ae365272ad
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
2 changed files with 11 additions and 16 deletions

View file

@ -56,12 +56,7 @@ Uses the same mechanism as 'bin/doom env reload'."
(sit-for 1))
(unless (file-readable-p doom-env-file)
(error "Failed to generate env file"))
(doom-load-env-vars doom-env-file)
(setq-default
exec-path (append (split-string (getenv "PATH") ":")
(list exec-directory))
shell-file-name (or (getenv "SHELL")
shell-file-name)))
(doom-load-env-vars doom-env-file))
;;;###autoload
(defun doom/reload-font ()

View file

@ -429,7 +429,8 @@ in interactive sessions, nil otherwise (but logs a warning)."
(defun doom-load-env-vars (file)
"Read and set envvars in FILE."
(let (vars)
(if (not (file-readable-p file))
(doom-log "Couldn't read %S envvar file" file)
(with-temp-buffer
(insert-file-contents file)
(re-search-forward "\n\n" nil t)
@ -442,7 +443,12 @@ in interactive sessions, nil otherwise (but logs a warning)."
(line-beginning-position))
(point-max))))))
(setenv var value)))))
vars))
(setq exec-path (append (split-string (getenv "PATH")
(if IS-WINDOWS ";" ":"))
(list exec-directory))
shell-file-name (or (getenv "SHELL")
shell-file-name))
t))
(defun doom-initialize (&optional force-p)
"Bootstrap Doom, if it hasn't already (or if FORCE-P is non-nil).
@ -510,14 +516,8 @@ to least)."
(user-error "Your package autoloads are missing! Run `bin/doom refresh' to regenerate them")))
;; Load shell environment
(when (and (not noninteractive)
(file-readable-p doom-env-file))
(doom-load-env-vars doom-env-file)
(setq exec-path (append (split-string (getenv "PATH")
(if IS-WINDOWS ";" ":"))
(list exec-directory))
shell-file-name (or (getenv "SHELL")
shell-file-name))))
(unless noninteractive
(doom-load-env-vars doom-env-file)))
(require 'core-modules)
(require 'core-os)