[core] Fix append path from .spacemacs.env

This commit is contained in:
Alex 2020-08-19 11:31:53 +02:00 committed by Maximilian Wolff
parent 39df5e26b6
commit d17492e6d5
2 changed files with 6 additions and 8 deletions

View File

@ -63,7 +63,7 @@ current contents of the file will be overwritten."
"# regexps in `spacemacs-ignored-environment-variables'. If you add any\n"
"# duplicate settings for a variable, only the first setting is effective.\n"
"# PATH is a special case: all PATH settings are read, each non-duplicate\n"
"# directory entry is appended to the `exec-path' variable, and then PATH is\n"
"# directory entry is prepended to the `exec-path' variable, and then PATH is\n"
"# set to the final value of `exec-path'.\n"
"#\n"
"# You can safely edit this file to change values or add or remove entries.\n"

View File

@ -74,7 +74,6 @@
(defun load-env-vars-extract-env-vars ()
"Extract environment variable name and value from STRING."
(load-env-vars-re-seq load-env-vars-env-var-regexp))
(defun load-env-vars-set-env (env-vars)
"Set environment variables from key value lists from ENV-VARS."
(setq exec-path (cl-remove-duplicates (mapcar #'directory-file-name exec-path)
@ -87,12 +86,11 @@
(let ((key (car element)) (value (cadr element)))
(if (string-equal "PATH" key)
(let ((paths (split-string value path-separator)))
(dolist (p paths)
(add-to-list 'exec-path (directory-file-name
(subst-char-in-string ?\\ ?/ p))
'append))
(setenv "PATH" (mapconcat convert-to-os-path exec-path
path-separator)))
(setq exec-path (cl-remove-duplicates
(append (mapcar (lambda (path) (directory-file-name (subst-char-in-string ?\\ ?/ path))) paths) exec-path)
:test #'string-equal :from-end t)
)
(setenv "PATH" (mapconcat convert-to-os-path exec-path path-separator)))
(setenv key value))))))
;;;###autoload