Mercurial > emacs
comparison lisp/server.el @ 83594:2716535391b7
Rudimentary fix for environment variable handling.
* lisp/env.el (getenv): Restore David Kastrup's fix.
(environment): Add optional frame parameter.
* lisp/mule-cmds.el (set-locale-environment): Fix getenv call.
* lisp/term/rxvt.el (rxvt-set-background-mode): Ditto.
* lisp/x-win.el (x-initialize-window-system, terminal-init-xterm): Ditto.
* lisp/server.el (server-with-environment): Restore the original environment.
Revision: emacs@sv.gnu.org/emacs--multi-tty--0--patch-6
Creator: Karoly Lorentey <karoly@lorentey.hu>
author | Miles Bader <miles@gnu.org> |
---|---|
date | Wed, 16 May 2007 07:12:33 +0000 |
parents | 738ce3540ffb |
children | 337111eac6a6 |
comparison
equal
deleted
inserted
replaced
83593:6597e68ad5dc | 83594:2716535391b7 |
---|---|
266 The environment variables are then restored to their previous values. | 266 The environment variables are then restored to their previous values. |
267 | 267 |
268 VARS should be a list of strings. | 268 VARS should be a list of strings. |
269 ENV should be in the same format as `process-environment'." | 269 ENV should be in the same format as `process-environment'." |
270 (declare (indent 2)) | 270 (declare (indent 2)) |
271 (let ((oldvalues (make-symbol "oldvalues")) | 271 (let ((old-env (make-symbol "old-env")) |
272 (var (make-symbol "var")) | 272 (var (make-symbol "var")) |
273 (value (make-symbol "value")) | 273 (value (make-symbol "value")) |
274 (pair (make-symbol "pair"))) | 274 (pair (make-symbol "pair"))) |
275 `(let (,oldvalues) | 275 `(let ((,old-env process-environment)) |
276 (dolist (,var ,vars) | 276 (dolist (,var ,vars) |
277 (let ((,value (server-getenv-from ,env ,var))) | 277 (let ((,value (server-getenv-from ,env ,var))) |
278 (setq ,oldvalues (cons (cons ,var (getenv ,var)) ,oldvalues)) | 278 (setq process-environment |
279 (setenv ,var ,value))) | 279 (cons (if (null ,value) |
280 ,var | |
281 (concat ,var "=" ,value)) | |
282 process-environment)))) | |
280 (unwind-protect | 283 (unwind-protect |
281 (progn ,@body) | 284 (progn ,@body) |
282 (dolist (,pair ,oldvalues) | 285 (setq process-environment ,old-env))))) |
283 (setenv (car ,pair) (cdr ,pair))))))) | |
284 | 286 |
285 (defun server-delete-client (client &optional noframe) | 287 (defun server-delete-client (client &optional noframe) |
286 "Delete CLIENT, including its buffers, terminals and frames. | 288 "Delete CLIENT, including its buffers, terminals and frames. |
287 If NOFRAME is non-nil, let the frames live. (To be used from | 289 If NOFRAME is non-nil, let the frames live. (To be used from |
288 `delete-frame-functions'.)" | 290 `delete-frame-functions'.)" |