summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2021-09-26 12:11:56 +0300
committerEli Zaretskii <eliz@gnu.org>2021-09-26 12:11:56 +0300
commitcd0817a0f7ea17ad7d1771224b5036b13b9f3815 (patch)
treea9f840cfc48697fe6f3bcc87a625763be8db97f2
parent27d8726ae29a1441dba776d7d3d0685ef85a3fdf (diff)
downloademacs-cd0817a0f7ea17ad7d1771224b5036b13b9f3815.tar.gz
; 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'.
-rw-r--r--doc/lispref/os.texi7
-rw-r--r--lisp/env.el6
2 files changed, 8 insertions, 5 deletions
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)))