Created
April 18, 2022 17:34
-
-
Save twopoint718/bdf8dbcf13b0d15235e42a41582ef4cb to your computer and use it in GitHub Desktop.
A bunch of Emacs Lisp utilities.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun cjw-load-env-from-file (filename) | |
"Open a file of environment variable definitions like: | |
export FOO=bar | |
export BAZ=quux | |
and load them into the current environment using `setenv`" | |
(with-temp-buffer | |
(insert-file-contents filename) | |
(goto-char (point-min)) | |
(while (re-search-forward "^export \\(.*\\)=\\(.*\\)$") | |
(apply 'setenv (list (match-string 1) (match-string 2)))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment