Add letenv! macro for lexical envvars

This commit is contained in:
Henrik Lissner 2019-12-08 16:11:29 -05:00
parent f251eb5ba9
commit 4bcc9e1a94
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -164,6 +164,13 @@ If FETCHER is a function, ELT is used as the key in LIST (an alist)."
elt)
,list)))
(defmacro letenv! (envvars &rest body)
"Lexically bind ENVVARS in BODY, like `let' but for `process-environment'."
`(let ((process-environment (copy-sequence process-environment)))
(dolist (var ',envvars)
(setenv (car var) (cadr var)))
,@body))
(defmacro add-load-path! (&rest dirs)
"Add DIRS to `load-path', relative to the current file.
The current file is the file from which `add-to-load-path!' is used."