mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 18:40:39 -08:00
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
This commit is contained in:
parent
52f9ab73a1
commit
2cd1371d9b
5 changed files with 77 additions and 37 deletions
|
|
@ -65,12 +65,17 @@ development infrastructure for the multi-tty branch.)
|
|||
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 @@ Problems:
|
|||
NEWS
|
||||
----
|
||||
|
||||
For the NEWS file:
|
||||
For the NEWS file: (Needs work)
|
||||
|
||||
** Support for multiple terminal devices has been added.
|
||||
|
||||
|
|
@ -196,9 +201,6 @@ See arch logs.
|
|||
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 @@ THINGS TO DO
|
|||
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 @@ THINGS TO DO
|
|||
|
||||
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 @@ THINGS TO DO
|
|||
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 @@ THINGS TO DO
|
|||
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 @@ DIARY OF CHANGES
|
|||
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
|
||||
|
|
|
|||
|
|
@ -872,6 +872,25 @@ Arg NEXT-BUFFER is a suggestion; if it is a live buffer, use it."
|
|||
|
||||
(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)
|
||||
|
|
|
|||
|
|
@ -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 @@ for the currently selected frame."
|
|||
;; 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
|
||||
|
|
|
|||
|
|
@ -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 @@ order until succeed.")
|
|||
(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.
|
||||
|
|
|
|||
|
|
@ -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 @@ versions of xterm."
|
|||
;; 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 @@ versions of xterm."
|
|||
(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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue