Function: server-with-environment
server-with-environment is a macro defined in server.el.gz.
Signature
(server-with-environment ENV VARS &rest BODY)
Documentation
Evaluate BODY with environment variables VARS set to those in ENV.
The environment variables are then restored to their previous values.
VARS should be a list of strings.
ENV should be in the same format as process-environment.
Source Code
;; Defined in /usr/src/emacs/lisp/server.el.gz
(defmacro server-with-environment (env vars &rest body)
"Evaluate BODY with environment variables VARS set to those in ENV.
The environment variables are then restored to their previous values.
VARS should be a list of strings.
ENV should be in the same format as `process-environment'."
(declare (indent 2))
(let ((var (make-symbol "var"))
(value (make-symbol "value")))
`(let ((process-environment process-environment))
(dolist (,var ,vars)
(let ((,value (getenv-internal ,var ,env)))
(push (if (stringp ,value)
(concat ,var "=" ,value)
,var)
process-environment)))
(progn ,@body))))