From: Eli Zaretskii Date: Sun, 26 Sep 2021 09:11:56 +0000 (+0300) Subject: ; Improve documentation of 'with-environment-variables' X-Git-Tag: emacs-28.0.90~615 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=cd0817a0f7ea17ad7d1771224b5036b13b9f3815;p=emacs.git ; Improve documentation of 'with-environment-variables' * lisp/env.el (with-environment-variables): * doc/lispref/os.texi (System Environment): Improve the documentation of 'with-environment-variables'. --- diff --git a/doc/lispref/os.texi b/doc/lispref/os.texi index a34c01c81aa..e3297b1be7c 100644 --- a/doc/lispref/os.texi +++ b/doc/lispref/os.texi @@ -1043,9 +1043,12 @@ if it removed @var{variable} from the environment. @end deffn @defmac with-environment-variables variables body@dots{} -This macro sets the environment variables in @var{variables} +This macro sets the environment variables according to @var{variables} temporarily when executing @var{body}. The previous values are -restored when the form finishes. +restored when the form finishes. The argument @var{variables} should +be a list of pairs of strings of the form +@w{@code{(@var{var} @var{value})}}, where @var{var} is the name of the +environment variable and @var{value} is that variable's value. @lisp (with-environment-variables (("LANG" "C") diff --git a/lisp/env.el b/lisp/env.el index 31a728c0e56..2f7cd9d3dbb 100644 --- a/lisp/env.el +++ b/lisp/env.el @@ -221,9 +221,9 @@ in the environment list of the selected frame." ;;;###autoload (defmacro with-environment-variables (variables &rest body) "Set VARIABLES in the environent and execute BODY. -VARIABLES is a list of variable settings where first element -should be the name of the variable and the second element should -be the value. +VARIABLES is a list of variable settings of the form (VAR VALUE), +where VAR is the name of the variable (a string) and VALUE +is its value (also a string). The previous values will be be restored upon exit." (declare (indent 1) (debug (sexp body)))