Mercurial > emacs
changeset 83118:7652900ea029
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
author | Karoly Lorentey <lorentey@elte.hu> |
---|---|
date | Sat, 08 May 2004 16:20:28 +0000 |
parents | 46882e012e30 |
children | 6c46628776bc |
files | README.multi-tty lisp/server.el lisp/term/rxvt.el lisp/term/x-win.el lisp/term/xterm.el |
diffstat | 5 files changed, 77 insertions(+), 37 deletions(-) [+] |
line wrap: on
line diff
--- a/README.multi-tty Fri May 07 14:20:00 2004 +0000 +++ b/README.multi-tty Sat May 08 16:20:28 2004 +0000 @@ -65,12 +65,17 @@ STATUS ------ -The branch is now very stable and almost full-featured. I hope the -major problems were fixed. (It still needs testing on other -architectures, though.) Both multiple tty device support and -simultaneous X and tty frame support works fine. Emacsclient has been -extended to support opening new tty and X frames. It has been changed -open new Emacs frames by default. +The branch is now very stable and almost full-featured. All of the +major problems have been fixed, only a few minor issues remain. (It +still needs to be ported to Windows/Mac/DOS, though.) Both multiple +tty device support and simultaneous X and tty frame support works +fine. Emacsclient has been extended to support opening new tty and X +frames. It has been changed open new Emacs frames by default. + +The multi-tty branch has been scheduled for inclusion in the next +major release of Emacs (version 22). I expect the merge into the +development trunk to occur sometime during next year (2005), after the +merge of the Unicode branch. Please let me know if you find any bugs in this branch. @@ -132,7 +137,7 @@ NEWS ---- -For the NEWS file: +For the NEWS file: (Needs work) ** Support for multiple terminal devices has been added. @@ -196,9 +201,6 @@ THINGS TO DO ------------ -** frame-creation-function was removed, which might be a bad idea. - Think up a compatible solution. - ** make-frame does not correctly handle extra parameters in its argument: @@ -223,12 +225,6 @@ Nicolaescu.) (Update: selecting a region with the mouse enables single_kboard under X. This is very confusing.) -** Change Lisp code not to (getenv "TERM"); use the `tty-type' frame - parameter or the frame-tty-type function instead. (M-x tags-search - "TERM" helps with this.) Update: Actually, all getenv invocations - should be checked for multi-tty compatibility, and an interface - must be implemented to get the remote client's environment. - ** The terminal customization files in term/*.el tend to change global parameters, which may confuse Emacs with multiple displays. Change them to tweak only frame-local settings, if possible. @@ -273,6 +269,9 @@ See next issue why this is necessary. + (Update: The consensus on emacs-devel seems to be to do this via + integer identifiers. That's fine by me.) + ** The following needs to be supported: $ emacsclient -t @@ -286,10 +285,6 @@ device names, this is not possible until struct display becomes accessible as a Lisp-level object. -** Add an elaborate mechanism for display-local variables. (There are - already a few of these; search for `terminal-local' in the Elisp - manual.) - ** Very strange bug: visible-bell does not work on secondary terminals in xterm and konsole. The screen does flicker a bit, but it's so quick it isn't noticable. @@ -303,20 +298,20 @@ an initial frame. (The user would connect to it and open frames later, with emacsclient.) -** Fix Mac support (I can't do this myself). Note that the current - state of Mac-specific source files in the multi-tty tree are not - useful; before starting work on Mac support, revert to pristine, - pre-multi-tty versions. +** Fix Mac support (I can't do this entirely myself). Note that the + current state of Mac-specific source files in the multi-tty tree + are not useful; before starting work on Mac support, revert to + pristine, pre-multi-tty versions. -** Fix W32 support (I can't do this myself). Note that the current - state of W32-specific source files in the multi-tty tree are not - useful; before starting work on W32 support, revert to pristine, - pre-multi-tty versions. +** Fix W32 support (I can't do this entirely myself). Note that the + current state of W32-specific source files in the multi-tty tree + are not useful; before starting work on W32 support, revert to + pristine, pre-multi-tty versions. -** Fix DOS support (I can't do this myself). Note that the current - state of DOS-specific source files in the multi-tty tree are not - useful; before starting work on DOS support, revert to pristine, - pre-multi-tty versions. +** Fix DOS support (I can't do this entirely myself). Note that the + current state of DOS-specific source files in the multi-tty tree + are not useful; before starting work on DOS support, revert to + pristine, pre-multi-tty versions. ** Do a grep on XXX and ?? for more issues. @@ -776,6 +771,26 @@ but delays caused by single_kboard --> perhaps MULTI_KBOARD should be removed.) +-- frame-creation-function was removed, which might be a bad idea. + Think up a compatible solution. + + (It was an internal interface that may be changed when necessary.) + +-- Change Lisp code not to (getenv "TERM"); use the `tty-type' frame + parameter or the frame-tty-type function instead. (M-x tags-search + "TERM" helps with this.) Update: Actually, all getenv invocations + should be checked for multi-tty compatibility, and an interface + must be implemented to get the remote client's environment. + + (Done. Only getenv calls in lisp/term/*.el were changed; other + calls should be mostly left as they are.) + +-- Add an elaborate mechanism for display-local variables. (There are + already a few of these; search for `terminal-local' in the Elisp + manual.) + + (Not needed. Display-local variables could be emulated by + frame-local variables.) ;;; arch-tag: 8da1619e-2e79-41a8-9ac9-a0485daad17d
--- a/lisp/server.el Fri May 07 14:20:00 2004 +0000 +++ b/lisp/server.el Sat May 08 16:20:28 2004 +0000 @@ -872,6 +872,25 @@ (global-set-key "\C-x#" 'server-edit) +(defsubst server-getenv (variable &optional frame) + "Get the value of VARIABLE in the client environment of frame FRAME. +VARIABLE should be a string. Value is nil if VARIABLE is undefined in +the environment. Otherwise, value is a string. + +If FRAME is an emacsclient frame, then the variable is looked up +in the environment of the emacsclient process; otherwise the +function consults the environment of the Emacs process. + +If FRAME is nil or missing, then the selected frame is used." + (when (not frame) (setq frame (selected-frame))) + (let ((clients (server-clients-with 'frame frame)) env) + (if (null clients) + (getenv variable) + (setq env (server-client-get (car clients) 'environment)) + (if (null env) + (getenv variable) + (assq variable env))))) + (defun server-unload-hook () (server-start t) (remove-hook 'delete-tty-after-functions 'server-handle-delete-tty)
--- a/lisp/term/rxvt.el Fri May 07 14:20:00 2004 +0000 +++ b/lisp/term/rxvt.el Sat May 08 16:20:28 2004 +0000 @@ -26,6 +26,8 @@ ;;; Code: +(eval-when-compile (require 'server)) + ;; Set up function-key-map entries that termcap and terminfo don't know. (let ((map (make-sparse-keymap))) (define-key map "\e[A" [up]) @@ -148,7 +150,7 @@ ;; intelligent way than the default guesswork in startup.el. (defun rxvt-set-background-mode () "Set background mode as appropriate for the default rxvt colors." - (let ((fgbg (getenv "COLORFGBG")) + (let ((fgbg (server-getenv "COLORFGBG")) bg rgb) (setq frame-background-mode 'light) ; default (when (and fgbg
--- a/lisp/term/x-win.el Fri May 07 14:20:00 2004 +0000 +++ b/lisp/term/x-win.el Sat May 08 16:20:28 2004 +0000 @@ -84,6 +84,8 @@ (require 'fontset) (require 'x-dnd) +(eval-when-compile (require 'server)) + (defvar x-invocation-args) (defvar x-command-line-resources nil) @@ -2365,7 +2367,7 @@ (aset x-resource-name i ?-)))) (x-open-connection (or x-display-name - (setq x-display-name (getenv "DISPLAY"))) + (setq x-display-name (server-getenv "DISPLAY"))) x-command-line-resources ;; Exit Emacs with fatal error if this fails and we ;; are the initial display.
--- a/lisp/term/xterm.el Fri May 07 14:20:00 2004 +0000 +++ b/lisp/term/xterm.el Sat May 08 16:20:28 2004 +0000 @@ -26,6 +26,8 @@ ;;; Code: +(eval-when-compile (require 'server)) + (let ((map (make-sparse-keymap))) (define-key map "\e[A" [up]) (define-key map "\e[B" [down]) @@ -208,7 +210,7 @@ ;; intelligent way than the default guesswork in startup.el. (defun xterm-rxvt-set-background-mode () "Set background mode as appropriate for the default rxvt colors." - (let ((fgbg (getenv "COLORFGBG")) + (let ((fgbg (server-getenv "COLORFGBG")) bg rgb) (setq frame-background-mode 'light) ; default (when (and fgbg @@ -230,8 +232,8 @@ (xterm-register-default-colors) ;; If this xterm is actually a disguised rxvt, be more intelligent about ;; determining the background mode. -(and (getenv "COLORTERM") - (string-match "\\`rxvt" (getenv "COLORTERM")) +(and (server-getenv "COLORTERM") + (string-match "\\`rxvt" (server-getenv "COLORTERM")) (xterm-rxvt-set-background-mode)) ;; This recomputes all the default faces given the colors we've just set up. (tty-set-up-initial-frame-faces)