Fix issue where extract-vars-from-env-file was popping up buffers
This commit is contained in:
parent
ecf1be46fb
commit
056ff2384a
@ -519,12 +519,14 @@ Load environment variables into Emacs from a shell script:
|
|||||||
(cl-defun extract-vars-from-env-file (file &key dir)
|
(cl-defun extract-vars-from-env-file (file &key dir)
|
||||||
"Extracts an alist of variable name to value from
|
"Extracts an alist of variable name to value from
|
||||||
a bash script that exports environment variables."
|
a bash script that exports environment variables."
|
||||||
(let ((var-re "\\(.+?\\)=\\(.+\\)$")
|
(let ((file (expand-file-name file))
|
||||||
|
(var-re "\\(.+?\\)=\\(.+\\)$")
|
||||||
(env '()))
|
(env '()))
|
||||||
(with-temp-buffer
|
(with-temp-buffer
|
||||||
(cd (expand-file-name (or dir (file-name-directory file))))
|
(cd (expand-file-name (or dir (file-name-directory file))))
|
||||||
(shell-command (concat "source " file " > /dev/null && env")
|
(insert (shell-command-to-string (concat "source "
|
||||||
(current-buffer))
|
(shell-quote-argument file)
|
||||||
|
" > /dev/null && env")))
|
||||||
(goto-char (point-min))
|
(goto-char (point-min))
|
||||||
(save-match-data
|
(save-match-data
|
||||||
(while (re-search-forward var-re nil t)
|
(while (re-search-forward var-re nil t)
|
||||||
|
Loading…
Reference in New Issue
Block a user