From 056ff2384aa6dc81f652201926b2586e485d538b Mon Sep 17 00:00:00 2001 From: Jeremy Dormitzer Date: Thu, 16 Apr 2020 11:53:52 -0400 Subject: [PATCH] Fix issue where extract-vars-from-env-file was popping up buffers --- emacs/init.org | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/emacs/init.org b/emacs/init.org index 78f98cf..0b52264 100755 --- a/emacs/init.org +++ b/emacs/init.org @@ -519,12 +519,14 @@ Load environment variables into Emacs from a shell script: (cl-defun extract-vars-from-env-file (file &key dir) "Extracts an alist of variable name to value from a bash script that exports environment variables." - (let ((var-re "\\(.+?\\)=\\(.+\\)$") + (let ((file (expand-file-name file)) + (var-re "\\(.+?\\)=\\(.+\\)$") (env '())) (with-temp-buffer (cd (expand-file-name (or dir (file-name-directory file)))) - (shell-command (concat "source " file " > /dev/null && env") - (current-buffer)) + (insert (shell-command-to-string (concat "source " + (shell-quote-argument file) + " > /dev/null && env"))) (goto-char (point-min)) (save-match-data (while (re-search-forward var-re nil t)