changeset 84753:eceecc897cab

(normal-top-level): Remove DISPLAY from process-environment to let it be computed dynamically in callproc.c
author Stefan Monnier <monnier@iro.umontreal.ca>
date Fri, 21 Sep 2007 07:24:01 +0000
parents b81c5052c6af
children fbb57a203ead
files lisp/ChangeLog lisp/startup.el
diffstat 2 files changed, 18 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Fri Sep 21 07:23:04 2007 +0000
+++ b/lisp/ChangeLog	Fri Sep 21 07:24:01 2007 +0000
@@ -1,5 +1,8 @@
 2007-09-21  Stefan Monnier  <monnier@iro.umontreal.ca>
 
+	* startup.el (normal-top-level): Remove DISPLAY from
+	process-environment to let it be computed dynamically in callproc.c
+
 	* frame.el (frame-initialize, make-frame):
 	* faces.el (tty-set-up-initial-frame-faces):
 	* env.el (setenv): Don't set display-environment-variable.
--- a/lisp/startup.el	Fri Sep 21 07:23:04 2007 +0000
+++ b/lisp/startup.el	Fri Sep 21 07:24:01 2007 +0000
@@ -498,7 +498,21 @@
     ;; unless told otherwise they should only assume a dumb terminal.
     ;; We are careful to do it late (after term-setup-hook), although the
     ;; new multi-tty code does not use $TERM any more there anyway.
-    (setenv "TERM" "dumb")))
+    (setenv "TERM" "dumb")
+    ;; Remove DISPLAY from the process-environment as well.  This allows
+    ;; `callproc.c' to give it a useful adaptive default which is either
+    ;; the value of the `display' frame-parameter or the DISPLAY value
+    ;; from initial-environment.
+    (let ((display (frame-parameter nil 'display)))
+      ;; Be careful which DISPLAY to remove from process-environment: follow
+      ;; the logic of `callproc.c'.
+      (if (stringp display) (setq display (concat "DISPLAY=" display))
+        (dolist (varval initial-environment)
+          (if (string-match "\\`DISPLAY=" varval)
+              (setq display varval))))
+      (when display
+        (message "Removing %s from process-environment" display)
+        (delete display process-environment)))))
 
 ;; Precompute the keyboard equivalents in the menu bar items.
 (defun precompute-menubar-bindings ()