diff lisp/env.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 21e8c3e3274f
children 2aee92eacdab
line wrap: on
line diff
--- a/lisp/env.el	Wed May 16 02:51:49 2007 +0000
+++ b/lisp/env.el	Wed May 16 07:12:33 2007 +0000
@@ -212,20 +212,24 @@
   (let ((value (getenv-internal (if (multibyte-string-p variable)
 				    (encode-coding-string
 				     variable locale-coding-system)
-				  variable))))
+				  variable)
+				frame)))
     (if (and enable-multibyte-characters value)
 	(setq value (decode-coding-string value locale-coding-system)))
     (when (interactive-p)
       (message "%s" (if value value "Not set")))
     value))
 
-(defun environment ()
+(defun environment (&optional frame)
   "Return a list of environment variables with their values.
 Each entry in the list is a string of the form NAME=VALUE.
 
 The returned list can not be used to change environment
 variables, only read them.  See `setenv' to do that.
 
+If optional parameter FRAME is non-nil, then it should be a
+frame.  The function returns the environment of that frame.
+
 The list is constructed by concatenating the elements of
 `process-environment' and the 'environment parameter of the
 selected frame, and removing duplicated and empty values.
@@ -234,7 +238,7 @@
 `locale-coding-system', i.e. the elements must normally be decoded for use.
 See `setenv' and `getenv'."
   (let* ((env (append process-environment
-		      (frame-parameter (frame-with-environment)
+		      (frame-parameter (frame-with-environment frame)
 				       'environment)
 		      nil))
 	 (scan env)