aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaroly Lorentey2004-05-08 16:20:28 +0000
committerKaroly Lorentey2004-05-08 16:20:28 +0000
commit2cd1371d9b0a3217db747b3c7485dd7f3cd6dda5 (patch)
treea8afcaf1b4c727c9a8c928cf2f654819bc2a8a86
parent52f9ab73a16c71ffe7f8a1c25f9432bbe32f10cf (diff)
downloademacs-2cd1371d9b0a3217db747b3c7485dd7f3cd6dda5.tar.gz
emacs-2cd1371d9b0a3217db747b3c7485dd7f3cd6dda5.zip
Fixed environment variable handling during terminal initialization.
lisp/server.el (server-getenv): New inline function. lisp/term/rxvt.el (rxvt-set-background-mode): Use server-getenv instead of getenv. lisp/term/x-win.el (x-initialize-window-system): Ditto. lisp/term/xterm.el (xterm-rxvt-set-background-mode): Ditto. git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-158
-rw-r--r--README.multi-tty79
-rw-r--r--lisp/server.el19
-rw-r--r--lisp/term/rxvt.el4
-rw-r--r--lisp/term/x-win.el4
-rw-r--r--lisp/term/xterm.el8
5 files changed, 77 insertions, 37 deletions
diff --git a/README.multi-tty b/README.multi-tty
index 739fce180d6..87faeb32e4d 100644
--- a/README.multi-tty
+++ b/README.multi-tty
@@ -65,12 +65,17 @@ development infrastructure for the multi-tty branch.)
65STATUS 65STATUS
66------ 66------
67 67
68The branch is now very stable and almost full-featured. I hope the 68The branch is now very stable and almost full-featured. All of the
69major problems were fixed. (It still needs testing on other 69major problems have been fixed, only a few minor issues remain. (It
70architectures, though.) Both multiple tty device support and 70still needs to be ported to Windows/Mac/DOS, though.) Both multiple
71simultaneous X and tty frame support works fine. Emacsclient has been 71tty device support and simultaneous X and tty frame support works
72extended to support opening new tty and X frames. It has been changed 72fine. Emacsclient has been extended to support opening new tty and X
73open new Emacs frames by default. 73frames. It has been changed open new Emacs frames by default.
74
75The multi-tty branch has been scheduled for inclusion in the next
76major release of Emacs (version 22). I expect the merge into the
77development trunk to occur sometime during next year (2005), after the
78merge of the Unicode branch.
74 79
75Please let me know if you find any bugs in this branch. 80Please let me know if you find any bugs in this branch.
76 81
@@ -132,7 +137,7 @@ Problems:
132NEWS 137NEWS
133---- 138----
134 139
135For the NEWS file: 140For the NEWS file: (Needs work)
136 141
137** Support for multiple terminal devices has been added. 142** Support for multiple terminal devices has been added.
138 143
@@ -196,9 +201,6 @@ See arch logs.
196THINGS TO DO 201THINGS TO DO
197------------ 202------------
198 203
199** frame-creation-function was removed, which might be a bad idea.
200 Think up a compatible solution.
201
202** make-frame does not correctly handle extra parameters in its 204** make-frame does not correctly handle extra parameters in its
203 argument: 205 argument:
204 206
@@ -223,12 +225,6 @@ THINGS TO DO
223 Nicolaescu.) (Update: selecting a region with the mouse enables 225 Nicolaescu.) (Update: selecting a region with the mouse enables
224 single_kboard under X. This is very confusing.) 226 single_kboard under X. This is very confusing.)
225 227
226** Change Lisp code not to (getenv "TERM"); use the `tty-type' frame
227 parameter or the frame-tty-type function instead. (M-x tags-search
228 "TERM" helps with this.) Update: Actually, all getenv invocations
229 should be checked for multi-tty compatibility, and an interface
230 must be implemented to get the remote client's environment.
231
232** The terminal customization files in term/*.el tend to change global 228** The terminal customization files in term/*.el tend to change global
233 parameters, which may confuse Emacs with multiple displays. Change 229 parameters, which may confuse Emacs with multiple displays. Change
234 them to tweak only frame-local settings, if possible. 230 them to tweak only frame-local settings, if possible.
@@ -273,6 +269,9 @@ THINGS TO DO
273 269
274 See next issue why this is necessary. 270 See next issue why this is necessary.
275 271
272 (Update: The consensus on emacs-devel seems to be to do this via
273 integer identifiers. That's fine by me.)
274
276** The following needs to be supported: 275** The following needs to be supported:
277 276
278 $ emacsclient -t 277 $ emacsclient -t
@@ -286,10 +285,6 @@ THINGS TO DO
286 device names, this is not possible until struct display becomes 285 device names, this is not possible until struct display becomes
287 accessible as a Lisp-level object. 286 accessible as a Lisp-level object.
288 287
289** Add an elaborate mechanism for display-local variables. (There are
290 already a few of these; search for `terminal-local' in the Elisp
291 manual.)
292
293** Very strange bug: visible-bell does not work on secondary 288** Very strange bug: visible-bell does not work on secondary
294 terminals in xterm and konsole. The screen does flicker a bit, 289 terminals in xterm and konsole. The screen does flicker a bit,
295 but it's so quick it isn't noticable. 290 but it's so quick it isn't noticable.
@@ -303,20 +298,20 @@ THINGS TO DO
303 an initial frame. (The user would connect to it and open frames 298 an initial frame. (The user would connect to it and open frames
304 later, with emacsclient.) 299 later, with emacsclient.)
305 300
306** Fix Mac support (I can't do this myself). Note that the current 301** Fix Mac support (I can't do this entirely myself). Note that the
307 state of Mac-specific source files in the multi-tty tree are not 302 current state of Mac-specific source files in the multi-tty tree
308 useful; before starting work on Mac support, revert to pristine, 303 are not useful; before starting work on Mac support, revert to
309 pre-multi-tty versions. 304 pristine, pre-multi-tty versions.
310 305
311** Fix W32 support (I can't do this myself). Note that the current 306** Fix W32 support (I can't do this entirely myself). Note that the
312 state of W32-specific source files in the multi-tty tree are not 307 current state of W32-specific source files in the multi-tty tree
313 useful; before starting work on W32 support, revert to pristine, 308 are not useful; before starting work on W32 support, revert to
314 pre-multi-tty versions. 309 pristine, pre-multi-tty versions.
315 310
316** Fix DOS support (I can't do this myself). Note that the current 311** Fix DOS support (I can't do this entirely myself). Note that the
317 state of DOS-specific source files in the multi-tty tree are not 312 current state of DOS-specific source files in the multi-tty tree
318 useful; before starting work on DOS support, revert to pristine, 313 are not useful; before starting work on DOS support, revert to
319 pre-multi-tty versions. 314 pristine, pre-multi-tty versions.
320 315
321** Do a grep on XXX and ?? for more issues. 316** Do a grep on XXX and ?? for more issues.
322 317
@@ -776,6 +771,26 @@ DIARY OF CHANGES
776 but delays caused by single_kboard --> perhaps MULTI_KBOARD should 771 but delays caused by single_kboard --> perhaps MULTI_KBOARD should
777 be removed.) 772 be removed.)
778 773
774-- frame-creation-function was removed, which might be a bad idea.
775 Think up a compatible solution.
776
777 (It was an internal interface that may be changed when necessary.)
778
779-- Change Lisp code not to (getenv "TERM"); use the `tty-type' frame
780 parameter or the frame-tty-type function instead. (M-x tags-search
781 "TERM" helps with this.) Update: Actually, all getenv invocations
782 should be checked for multi-tty compatibility, and an interface
783 must be implemented to get the remote client's environment.
784
785 (Done. Only getenv calls in lisp/term/*.el were changed; other
786 calls should be mostly left as they are.)
787
788-- Add an elaborate mechanism for display-local variables. (There are
789 already a few of these; search for `terminal-local' in the Elisp
790 manual.)
791
792 (Not needed. Display-local variables could be emulated by
793 frame-local variables.)
779 794
780 795
781;;; arch-tag: 8da1619e-2e79-41a8-9ac9-a0485daad17d 796;;; arch-tag: 8da1619e-2e79-41a8-9ac9-a0485daad17d
diff --git a/lisp/server.el b/lisp/server.el
index 7d90beb02cf..57d4b7600b8 100644
--- a/lisp/server.el
+++ b/lisp/server.el
@@ -872,6 +872,25 @@ Arg NEXT-BUFFER is a suggestion; if it is a live buffer, use it."
872 872
873(global-set-key "\C-x#" 'server-edit) 873(global-set-key "\C-x#" 'server-edit)
874 874
875(defsubst server-getenv (variable &optional frame)
876 "Get the value of VARIABLE in the client environment of frame FRAME.
877VARIABLE should be a string. Value is nil if VARIABLE is undefined in
878the environment. Otherwise, value is a string.
879
880If FRAME is an emacsclient frame, then the variable is looked up
881in the environment of the emacsclient process; otherwise the
882function consults the environment of the Emacs process.
883
884If FRAME is nil or missing, then the selected frame is used."
885 (when (not frame) (setq frame (selected-frame)))
886 (let ((clients (server-clients-with 'frame frame)) env)
887 (if (null clients)
888 (getenv variable)
889 (setq env (server-client-get (car clients) 'environment))
890 (if (null env)
891 (getenv variable)
892 (assq variable env)))))
893
875(defun server-unload-hook () 894(defun server-unload-hook ()
876 (server-start t) 895 (server-start t)
877 (remove-hook 'delete-tty-after-functions 'server-handle-delete-tty) 896 (remove-hook 'delete-tty-after-functions 'server-handle-delete-tty)
diff --git a/lisp/term/rxvt.el b/lisp/term/rxvt.el
index 7839ebba95d..3dbea1d46b2 100644
--- a/lisp/term/rxvt.el
+++ b/lisp/term/rxvt.el
@@ -26,6 +26,8 @@
26 26
27;;; Code: 27;;; Code:
28 28
29(eval-when-compile (require 'server))
30
29;; Set up function-key-map entries that termcap and terminfo don't know. 31;; Set up function-key-map entries that termcap and terminfo don't know.
30(let ((map (make-sparse-keymap))) 32(let ((map (make-sparse-keymap)))
31 (define-key map "\e[A" [up]) 33 (define-key map "\e[A" [up])
@@ -148,7 +150,7 @@ for the currently selected frame."
148;; intelligent way than the default guesswork in startup.el. 150;; intelligent way than the default guesswork in startup.el.
149(defun rxvt-set-background-mode () 151(defun rxvt-set-background-mode ()
150 "Set background mode as appropriate for the default rxvt colors." 152 "Set background mode as appropriate for the default rxvt colors."
151 (let ((fgbg (getenv "COLORFGBG")) 153 (let ((fgbg (server-getenv "COLORFGBG"))
152 bg rgb) 154 bg rgb)
153 (setq frame-background-mode 'light) ; default 155 (setq frame-background-mode 'light) ; default
154 (when (and fgbg 156 (when (and fgbg
diff --git a/lisp/term/x-win.el b/lisp/term/x-win.el
index 381ee606300..55ad3800e0b 100644
--- a/lisp/term/x-win.el
+++ b/lisp/term/x-win.el
@@ -84,6 +84,8 @@
84(require 'fontset) 84(require 'fontset)
85(require 'x-dnd) 85(require 'x-dnd)
86 86
87(eval-when-compile (require 'server))
88
87(defvar x-invocation-args) 89(defvar x-invocation-args)
88 90
89(defvar x-command-line-resources nil) 91(defvar x-command-line-resources nil)
@@ -2365,7 +2367,7 @@ order until succeed.")
2365 (aset x-resource-name i ?-)))) 2367 (aset x-resource-name i ?-))))
2366 2368
2367 (x-open-connection (or x-display-name 2369 (x-open-connection (or x-display-name
2368 (setq x-display-name (getenv "DISPLAY"))) 2370 (setq x-display-name (server-getenv "DISPLAY")))
2369 x-command-line-resources 2371 x-command-line-resources
2370 ;; Exit Emacs with fatal error if this fails and we 2372 ;; Exit Emacs with fatal error if this fails and we
2371 ;; are the initial display. 2373 ;; are the initial display.
diff --git a/lisp/term/xterm.el b/lisp/term/xterm.el
index 5c387cb4148..e05b2f27324 100644
--- a/lisp/term/xterm.el
+++ b/lisp/term/xterm.el
@@ -26,6 +26,8 @@
26 26
27;;; Code: 27;;; Code:
28 28
29(eval-when-compile (require 'server))
30
29(let ((map (make-sparse-keymap))) 31(let ((map (make-sparse-keymap)))
30 (define-key map "\e[A" [up]) 32 (define-key map "\e[A" [up])
31 (define-key map "\e[B" [down]) 33 (define-key map "\e[B" [down])
@@ -208,7 +210,7 @@ versions of xterm."
208;; intelligent way than the default guesswork in startup.el. 210;; intelligent way than the default guesswork in startup.el.
209(defun xterm-rxvt-set-background-mode () 211(defun xterm-rxvt-set-background-mode ()
210 "Set background mode as appropriate for the default rxvt colors." 212 "Set background mode as appropriate for the default rxvt colors."
211 (let ((fgbg (getenv "COLORFGBG")) 213 (let ((fgbg (server-getenv "COLORFGBG"))
212 bg rgb) 214 bg rgb)
213 (setq frame-background-mode 'light) ; default 215 (setq frame-background-mode 'light) ; default
214 (when (and fgbg 216 (when (and fgbg
@@ -230,8 +232,8 @@ versions of xterm."
230(xterm-register-default-colors) 232(xterm-register-default-colors)
231;; If this xterm is actually a disguised rxvt, be more intelligent about 233;; If this xterm is actually a disguised rxvt, be more intelligent about
232;; determining the background mode. 234;; determining the background mode.
233(and (getenv "COLORTERM") 235(and (server-getenv "COLORTERM")
234 (string-match "\\`rxvt" (getenv "COLORTERM")) 236 (string-match "\\`rxvt" (server-getenv "COLORTERM"))
235 (xterm-rxvt-set-background-mode)) 237 (xterm-rxvt-set-background-mode))
236;; This recomputes all the default faces given the colors we've just set up. 238;; This recomputes all the default faces given the colors we've just set up.
237(tty-set-up-initial-frame-faces) 239(tty-set-up-initial-frame-faces)