aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorKaroly Lorentey2004-01-11 21:59:40 +0000
committerKaroly Lorentey2004-01-11 21:59:40 +0000
commit2246281fb0e2ab610d14efa7166a9ceb02597643 (patch)
tree09416af10eec00f4d43af0dd569cc90cda408ce6 /lisp
parentc0707982ab8a080139a45b35fc7906415ba2f1bc (diff)
downloademacs-2246281fb0e2ab610d14efa7166a9ceb02597643.tar.gz
emacs-2246281fb0e2ab610d14efa7166a9ceb02597643.zip
Support for opening X frames from a tty session.
lisp/cus-face.el (custom-declare-face): Handle multiple concurrent display methods correctly. lisp/faces.el (x-create-frame-with-faces): Set the window-system frame parameter instead of frame-creation-function. (tty-create-frame-with-faces): Ditto. lisp/frame.el (frame-creation-function): Removed. (frame-creation-function-alist): New variable. (frame-initialize): Use initial-window-system instead of window-system. Add window-system parameter to initial-frame-alist. Removed tty initialization, it was moved to frame-creation-function-alist. (frame-notice-user-settings): Use initial-window-system instead of window-system. (make-frame-on-display): Make sure term/x-win is loaded. Added window-system parameter for make-frame. (make-frame-on-tty): Removed unnecessary autoload declaration. Added window-system parameter for make-frame. (make-frame): Use frame-creation-function-alist to determine the function to use depending on the specified window system. (select-frame-by-name): Use the window-system function instead of the variable. lisp/startup.el (window-system): New variable (previously built-in, now frame-local). (normal-top-level, command-line): Use initial-window-system instead of window-system. lisp/loadup.el: Load startup.el before faces.el, for the window-system variable. lisp/term/x-win.el: Check for the x-create-frame function instead of window-system to see if X is available. Don't exit Emacs if the display can not be opened when X is not the initial display method. Set up frame-creation-function-alist instead of frame-creation-function. Provide the x-win feature. src/dispnew.c (Vwindow_system): Renamed to Vinitial_window_system. (init_display, syms_of_display): Updated to use Vinitial_window_system instead of Vwindow_system. src/emacs.c (shut_down_emacs): Updated to use Vinitial_window_system instead of Vwindow_system. src/keyboard.c (Fset_input_mode): Call reset_all_sys_modes, not reset_sys_modes. Ditto for init_all_sys_modes. Process the quit parameter correctly. src/sysdep.c (init_sys_modes, reset_sys_modes): Unconditionally set up the terminal. We don't get called if there is nothing to do anymore. (sys_select): Use Vinitial_window_system, not Vwindow_system. src/window.h (Vwindow_system): Renamed to Vinitial_window_system. src/xfns.c (Fx_create_frame): Don't check_x. We initialize it anyway. (x_display_info_for_name, Fx_open_connection): Don't look at Vinitial_window_system. git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-54
Diffstat (limited to 'lisp')
-rw-r--r--lisp/cus-face.el11
-rw-r--r--lisp/faces.el6
-rw-r--r--lisp/frame.el77
-rw-r--r--lisp/loadup.el3
-rw-r--r--lisp/startup.el33
-rw-r--r--lisp/term/x-win.el13
6 files changed, 79 insertions, 64 deletions
diff --git a/lisp/cus-face.el b/lisp/cus-face.el
index 1ff07c4c361..b5716da161a 100644
--- a/lisp/cus-face.el
+++ b/lisp/cus-face.el
@@ -41,6 +41,7 @@
41 ;; If the user has already created the face, respect that. 41 ;; If the user has already created the face, respect that.
42 (let ((value (or (get face 'saved-face) spec)) 42 (let ((value (or (get face 'saved-face) spec))
43 (frames (frame-list)) 43 (frames (frame-list))
44 (have-window-system (memq initial-window-system '(x w32)))
44 frame) 45 frame)
45 ;; Create global face. 46 ;; Create global face.
46 (make-empty-face face) 47 (make-empty-face face)
@@ -48,10 +49,12 @@
48 (while frames 49 (while frames
49 (setq frame (car frames) 50 (setq frame (car frames)
50 frames (cdr frames)) 51 frames (cdr frames))
51 (face-spec-set face value frame))) 52 (face-spec-set face value frame)
52 ;; When making a face after frames already exist 53 (when (memq (window-system frame) '(x w32))
53 (if (memq window-system '(x w32)) 54 (setq have-window-system t)))
54 (make-face-x-resource-internal face)))) 55 ;; When making a face after frames already exist
56 (if have-window-system
57 (make-face-x-resource-internal face)))))
55 ;; Don't record SPEC until we see it causes no errors. 58 ;; Don't record SPEC until we see it causes no errors.
56 (put face 'face-defface-spec spec) 59 (put face 'face-defface-spec spec)
57 (when (and doc (null (face-documentation face))) 60 (when (and doc (null (face-documentation face)))
diff --git a/lisp/faces.el b/lisp/faces.el
index 42abb1e7ac4..4877fd246e0 100644
--- a/lisp/faces.el
+++ b/lisp/faces.el
@@ -1658,8 +1658,7 @@ Value is the new frame created."
1658 (setq parameters (x-handle-named-frame-geometry parameters)) 1658 (setq parameters (x-handle-named-frame-geometry parameters))
1659 (let ((visibility-spec (assq 'visibility parameters)) 1659 (let ((visibility-spec (assq 'visibility parameters))
1660 (frame-list (frame-list)) 1660 (frame-list (frame-list))
1661 (frame (x-create-frame `((frame-creation-function . x-create-frame-with-faces) 1661 (frame (x-create-frame `((window-system . x) (visibility . nil) . ,parameters)))
1662 (visibility . nil) . ,parameters)))
1663 success) 1662 success)
1664 (unwind-protect 1663 (unwind-protect
1665 (progn 1664 (progn
@@ -1745,8 +1744,7 @@ Parameters not specified by PARAMETERS are taken from
1745`default-frame-alist'. If either PARAMETERS or `default-frame-alist' 1744`default-frame-alist'. If either PARAMETERS or `default-frame-alist'
1746contains a `reverse' parameter, handle that. Value is the new frame 1745contains a `reverse' parameter, handle that. Value is the new frame
1747created." 1746created."
1748 (let ((frame (make-terminal-frame `((frame-creation-function . tty-create-frame-with-faces) . 1747 (let ((frame (make-terminal-frame `((window-system . nil) . ,parameters)))
1749 ,parameters)))
1750 success) 1748 success)
1751 (unwind-protect 1749 (unwind-protect
1752 (progn 1750 (progn
diff --git a/lisp/frame.el b/lisp/frame.el
index f5c1e645ff3..2175bdd8615 100644
--- a/lisp/frame.el
+++ b/lisp/frame.el
@@ -27,12 +27,17 @@
27 27
28;;; Code: 28;;; Code:
29 29
30(defvar frame-creation-function nil 30(defvar frame-creation-function-alist
31 "Window-system dependent function to call to create a new frame. 31 (list (cons nil
32The window system startup file should set this to its frame creation 32 (if (fboundp 'tty-create-frame-with-faces)
33function, which should take an alist of parameters as its argument.") 33 'tty-create-frame-with-faces
34 34 (function
35(make-variable-frame-local 'frame-creation-function) 35 (lambda (parameters)
36 (error "Can't create multiple frames without a window system"))))))
37 "Alist of window-system dependent functions to call to create a new frame.
38The window system startup file should add its frame creation
39function to this list, which should take an alist of parameters
40as its argument.")
36 41
37;; The initial value given here used to ask for a minibuffer. 42;; The initial value given here used to ask for a minibuffer.
38;; But that's not necessary, because the default is to have one. 43;; But that's not necessary, because the default is to have one.
@@ -188,7 +193,9 @@ Pass it BUFFER as first arg, and (cdr ARGS) gives the rest of the args."
188(defun frame-initialize () 193(defun frame-initialize ()
189 "Create an initial frame if necessary." 194 "Create an initial frame if necessary."
190 ;; Are we actually running under a window system at all? 195 ;; Are we actually running under a window system at all?
191 (if (and window-system (not noninteractive) (not (eq window-system 'pc))) 196 (if (and initial-window-system
197 (not noninteractive)
198 (not (eq initial-window-system 'pc)))
192 (progn 199 (progn
193 ;; Turn on special-display processing only if there's a window system. 200 ;; Turn on special-display processing only if there's a window system.
194 (setq special-display-function 'special-display-popup-frame) 201 (setq special-display-function 'special-display-popup-frame)
@@ -205,6 +212,9 @@ Pass it BUFFER as first arg, and (cdr ARGS) gives the rest of the args."
205 (setq frame-initial-frame-alist 212 (setq frame-initial-frame-alist
206 (cons '(horizontal-scroll-bars . t) 213 (cons '(horizontal-scroll-bars . t)
207 frame-initial-frame-alist))) 214 frame-initial-frame-alist)))
215 (setq frame-initial-frame-alist
216 (cons (cons 'window-system initial-window-system)
217 frame-initial-frame-alist))
208 (setq default-minibuffer-frame 218 (setq default-minibuffer-frame
209 (setq frame-initial-frame 219 (setq frame-initial-frame
210 (make-frame frame-initial-frame-alist))) 220 (make-frame frame-initial-frame-alist)))
@@ -217,18 +227,7 @@ Pass it BUFFER as first arg, and (cdr ARGS) gives the rest of the args."
217 ;; At this point, we know that we have a frame open, so we 227 ;; At this point, we know that we have a frame open, so we
218 ;; can delete the terminal frame. 228 ;; can delete the terminal frame.
219 (delete-frame terminal-frame) 229 (delete-frame terminal-frame)
220 (setq terminal-frame nil)) 230 (setq terminal-frame nil))))
221
222 ;; No, we're not running a window system. Use make-terminal-frame if
223 ;; we support that feature, otherwise arrange to cause errors.
224 (or (eq window-system 'pc)
225 (setq frame-creation-function
226 (if (fboundp 'tty-create-frame-with-faces)
227 'tty-create-frame-with-faces
228 (function
229 (lambda (parameters)
230 (error
231 "Can't create multiple frames without a window system"))))))))
232 231
233(defvar frame-notice-user-settings t 232(defvar frame-notice-user-settings t
234 "Non-nil means function `frame-notice-user-settings' wasn't run yet.") 233 "Non-nil means function `frame-notice-user-settings' wasn't run yet.")
@@ -278,7 +277,7 @@ React to settings of `default-frame-alist', `initial-frame-alist' there."
278 ;; Can't modify the minibuffer parameter, so don't try. 277 ;; Can't modify the minibuffer parameter, so don't try.
279 (setq parms (delq (assq 'minibuffer parms) parms)) 278 (setq parms (delq (assq 'minibuffer parms) parms))
280 (modify-frame-parameters nil 279 (modify-frame-parameters nil
281 (if (null window-system) 280 (if (null initial-window-system)
282 (append initial-frame-alist 281 (append initial-frame-alist
283 default-frame-alist 282 default-frame-alist
284 parms 283 parms
@@ -287,7 +286,7 @@ React to settings of `default-frame-alist', `initial-frame-alist' there."
287 ;; default-frame-alist were already 286 ;; default-frame-alist were already
288 ;; applied in pc-win.el. 287 ;; applied in pc-win.el.
289 parms)) 288 parms))
290 (if (null window-system) ;; MS-DOS does this differently in pc-win.el 289 (if (null initial-window-system) ;; MS-DOS does this differently in pc-win.el
291 (let ((newparms (frame-parameters)) 290 (let ((newparms (frame-parameters))
292 (frame (selected-frame))) 291 (frame (selected-frame)))
293 (tty-handle-reverse-video frame newparms) 292 (tty-handle-reverse-video frame newparms)
@@ -571,26 +570,18 @@ The optional second argument PARAMETERS specifies additional frame parameters."
571 (interactive "sMake frame on display: ") 570 (interactive "sMake frame on display: ")
572 (or (string-match "\\`[^:]*:[0-9]+\\(\\.[0-9]+\\)?\\'" display) 571 (or (string-match "\\`[^:]*:[0-9]+\\(\\.[0-9]+\\)?\\'" display)
573 (error "Invalid display, not HOST:SERVER or HOST:SERVER.SCREEN")) 572 (error "Invalid display, not HOST:SERVER or HOST:SERVER.SCREEN"))
574 (make-frame (cons (cons 'display display) parameters))) 573 (load (concat term-file-prefix "x-win"))
574 (make-frame `((window-system . x) (display . ,display) . ,parameters)))
575 575
576;;;###autoload
577(defun make-frame-on-tty (device type &optional parameters) 576(defun make-frame-on-tty (device type &optional parameters)
578 "Make a frame on terminal DEVICE which is of type TYPE (e.g., \"xterm\"). 577 "Make a frame on terminal DEVICE which is of type TYPE (e.g., \"xterm\").
579The optional third argument PARAMETERS specifies additional frame parameters. 578The optional third argument PARAMETERS specifies additional frame parameters."
580
581DEVICE must be a proxy psudo terminal created by emacsclient,
582otherwise there will be problems with terminal input and window
583resizes. (The kernel notifies processes about pending input or
584terminal resizes only on the controlling terminal, so we need
585emacsclient to sit on the real terminal device, create SIGIO
586signals upon terminal input, and forward SIGWINCH signals to
587us.)"
588 (interactive "fOpen frame on tty device: \nsTerminal type of %s: ") 579 (interactive "fOpen frame on tty device: \nsTerminal type of %s: ")
589 (unless device 580 (unless device
590 (error "Invalid terminal device")) 581 (error "Invalid terminal device"))
591 (unless type 582 (unless type
592 (error "Invalid terminal type")) 583 (error "Invalid terminal type"))
593 (tty-create-frame-with-faces (append (list (cons 'tty device) (cons 'tty-type type)) parameters))) 584 (make-frame `((window-system . nil) (tty . ,device) (tty-type . ,type) . ,parameters)))
594 585
595(defun make-frame-command () 586(defun make-frame-command ()
596 "Make a new frame, and select it if the terminal displays only one frame." 587 "Make a new frame, and select it if the terminal displays only one frame."
@@ -630,12 +621,22 @@ You cannot specify either `width' or `height', you must use neither or both.
630 (minibuffer . only) The frame should contain only a minibuffer. 621 (minibuffer . only) The frame should contain only a minibuffer.
631 (minibuffer . WINDOW) The frame should use WINDOW as its minibuffer window. 622 (minibuffer . WINDOW) The frame should use WINDOW as its minibuffer window.
632 623
633Before the frame is created (via `frame-creation-function'), functions on the 624 (window-system . nil) The frame should be displayed on a terminal device.
625 (window-system . x) The frame should be displayed in an X window.
626
627Before the frame is created (via `frame-creation-function-alist'), functions on the
634hook `before-make-frame-hook' are run. After the frame is created, functions 628hook `before-make-frame-hook' are run. After the frame is created, functions
635on `after-make-frame-functions' are run with one arg, the newly created frame." 629on `after-make-frame-functions' are run with one arg, the newly created frame."
636 (interactive) 630 (interactive)
637 (run-hooks 'before-make-frame-hook) 631 (let* ((w (if (assq 'window-system parameters)
638 (let ((frame (funcall frame-creation-function parameters))) 632 (cdr (assq 'window-system parameters))
633 window-system))
634 (frame-creation-function (cdr (assq w frame-creation-function-alist)))
635 frame)
636 (unless frame-creation-function
637 (error "Don't know how to create a frame on window system %s" w))
638 (run-hooks 'before-make-frame-hook)
639 (funcall frame-creation-function parameters)
639 (run-hook-with-args 'after-make-frame-functions frame) 640 (run-hook-with-args 'after-make-frame-functions frame)
640 frame)) 641 frame))
641 642
@@ -780,9 +781,9 @@ If there is no frame by that name, signal an error."
780 (raise-frame frame) 781 (raise-frame frame)
781 (select-frame frame) 782 (select-frame frame)
782 ;; Ensure, if possible, that frame gets input focus. 783 ;; Ensure, if possible, that frame gets input focus.
783 (cond ((eq window-system 'x) 784 (cond ((eq (window-system frame) 'x)
784 (x-focus-frame frame)) 785 (x-focus-frame frame))
785 ((eq window-system 'w32) 786 ((eq (window-system frame) 'w32)
786 (w32-focus-frame frame))) 787 (w32-focus-frame frame)))
787 (when focus-follows-mouse 788 (when focus-follows-mouse
788 (set-mouse-position frame (1- (frame-width frame)) 0)))) 789 (set-mouse-position frame (1- (frame-width frame)) 0))))
diff --git a/lisp/loadup.el b/lisp/loadup.el
index bd90fb7c53a..26f7b34108a 100644
--- a/lisp/loadup.el
+++ b/lisp/loadup.el
@@ -67,6 +67,8 @@
67(setq load-source-file-function 'load-with-code-conversion) 67(setq load-source-file-function 'load-with-code-conversion)
68(load "files") 68(load "files")
69 69
70(load "startup")
71
70(load "cus-face") 72(load "cus-face")
71(load "faces") ; after here, `defface' may be used. 73(load "faces") ; after here, `defface' may be used.
72 74
@@ -146,7 +148,6 @@
146(message "%s" (garbage-collect)) 148(message "%s" (garbage-collect))
147(load "menu-bar") 149(load "menu-bar")
148(load "paths.el") ;Don't get confused if someone compiled paths by mistake. 150(load "paths.el") ;Don't get confused if someone compiled paths by mistake.
149(load "startup")
150(load "emacs-lisp/lisp") 151(load "emacs-lisp/lisp")
151(load "textmodes/page") 152(load "textmodes/page")
152(load "register") 153(load "register")
diff --git a/lisp/startup.el b/lisp/startup.el
index 2808689eaeb..969daf49777 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -128,6 +128,13 @@
128(defvar command-line-processed nil 128(defvar command-line-processed nil
129 "Non-nil once command line has been processed.") 129 "Non-nil once command line has been processed.")
130 130
131(defvar window-system initial-window-system
132 "Name of window system the selected frame is displaying through.
133The value is a symbol--for instance, `x' for X windows.
134The value is nil if the selected frame is on a text-only-terminal.")
135
136(make-variable-frame-local 'window-system)
137
131(defgroup initialization nil 138(defgroup initialization nil
132 "Emacs start-up procedure" 139 "Emacs start-up procedure"
133 :group 'internal) 140 :group 'internal)
@@ -512,9 +519,9 @@ or `CVS', and any subdirectory that contains a file named `.nosearch'."
512 ;; for instance due to a dense colormap. 519 ;; for instance due to a dense colormap.
513 (when (or frame-initial-frame 520 (when (or frame-initial-frame
514 ;; If frame-initial-frame has no meaning, do this anyway. 521 ;; If frame-initial-frame has no meaning, do this anyway.
515 (not (and window-system 522 (not (and initial-window-system
516 (not noninteractive) 523 (not noninteractive)
517 (not (eq window-system 'pc))))) 524 (not (eq initial-window-system 'pc)))))
518 ;; Modify the initial frame based on what .emacs puts into 525 ;; Modify the initial frame based on what .emacs puts into
519 ;; ...-frame-alist. 526 ;; ...-frame-alist.
520 (if (fboundp 'frame-notice-user-settings) 527 (if (fboundp 'frame-notice-user-settings)
@@ -527,7 +534,7 @@ or `CVS', and any subdirectory that contains a file named `.nosearch'."
527 (let ((frame-background-mode frame-background-mode) 534 (let ((frame-background-mode frame-background-mode)
528 (frame (selected-frame)) 535 (frame (selected-frame))
529 term) 536 term)
530 (when (and (null window-system) 537 (when (and (null initial-window-system)
531 ;; Don't override a possibly customized value. 538 ;; Don't override a possibly customized value.
532 (null frame-background-mode) 539 (null frame-background-mode)
533 ;; Don't override user specifications. 540 ;; Don't override user specifications.
@@ -702,9 +709,9 @@ or `CVS', and any subdirectory that contains a file named `.nosearch'."
702 709
703 ;; Read window system's init file if using a window system. 710 ;; Read window system's init file if using a window system.
704 (condition-case error 711 (condition-case error
705 (if (and window-system (not noninteractive)) 712 (if (and initial-window-system (not noninteractive))
706 (load (concat term-file-prefix 713 (load (concat term-file-prefix
707 (symbol-name window-system) 714 (symbol-name initial-window-system)
708 "-win") 715 "-win")
709 ;; Every window system should have a startup file; 716 ;; Every window system should have a startup file;
710 ;; barf if we can't find it. 717 ;; barf if we can't find it.
@@ -725,7 +732,7 @@ or `CVS', and any subdirectory that contains a file named `.nosearch'."
725 (cdr error) ", ")))) 732 (cdr error) ", "))))
726 'external-debugging-output) 733 'external-debugging-output)
727 (terpri 'external-debugging-output) 734 (terpri 'external-debugging-output)
728 (setq window-system nil) 735 (setq initial-window-system nil)
729 (kill-emacs))) 736 (kill-emacs)))
730 737
731 ;; Windowed displays do this inside their *-win.el. 738 ;; Windowed displays do this inside their *-win.el.
@@ -808,7 +815,7 @@ or `CVS', and any subdirectory that contains a file named `.nosearch'."
808 815
809 ;; If frame was created with a menu bar, set menu-bar-mode on. 816 ;; If frame was created with a menu bar, set menu-bar-mode on.
810 (unless (or noninteractive 817 (unless (or noninteractive
811 (and (memq window-system '(x w32)) 818 (and (memq initial-window-system '(x w32))
812 (<= (frame-parameter nil 'menu-bar-lines) 0))) 819 (<= (frame-parameter nil 'menu-bar-lines) 0)))
813 (menu-bar-mode 1)) 820 (menu-bar-mode 1))
814 821
@@ -818,10 +825,10 @@ or `CVS', and any subdirectory that contains a file named `.nosearch'."
818 (<= (frame-parameter nil 'tool-bar-lines) 0)) 825 (<= (frame-parameter nil 'tool-bar-lines) 0))
819 (tool-bar-mode 1)) 826 (tool-bar-mode 1))
820 827
821 ;; Can't do this init in defcustom because window-system isn't set. 828 ;; Can't do this init in defcustom because initial-window-system isn't set.
822 (unless (or noninteractive 829 (unless (or noninteractive
823 (eq system-type 'ms-dos) 830 (eq system-type 'ms-dos)
824 (not (memq window-system '(x w32)))) 831 (not (memq initial-window-system '(x w32))))
825 (setq-default blink-cursor t) 832 (setq-default blink-cursor t)
826 (blink-cursor-mode 1)) 833 (blink-cursor-mode 1))
827 834
@@ -829,13 +836,13 @@ or `CVS', and any subdirectory that contains a file named `.nosearch'."
829 ;; DOS/Windows systems have a PC-type keyboard which has both 836 ;; DOS/Windows systems have a PC-type keyboard which has both
830 ;; <delete> and <backspace> keys. 837 ;; <delete> and <backspace> keys.
831 (when (or (memq system-type '(ms-dos windows-nt)) 838 (when (or (memq system-type '(ms-dos windows-nt))
832 (and (memq window-system '(x)) 839 (and (memq initial-window-system '(x))
833 (fboundp 'x-backspace-delete-keys-p) 840 (fboundp 'x-backspace-delete-keys-p)
834 (x-backspace-delete-keys-p)) 841 (x-backspace-delete-keys-p))
835 ;; If the terminal Emacs is running on has erase char 842 ;; If the terminal Emacs is running on has erase char
836 ;; set to ^H, use the Backspace key for deleting 843 ;; set to ^H, use the Backspace key for deleting
837 ;; backward and, and the Delete key for deleting forward. 844 ;; backward and, and the Delete key for deleting forward.
838 (and (null window-system) 845 (and (null initial-window-system)
839 (eq tty-erase-char 8))) 846 (eq tty-erase-char 8)))
840 (setq-default normal-erase-is-backspace t) 847 (setq-default normal-erase-is-backspace t)
841 (normal-erase-is-backspace-mode 1))) 848 (normal-erase-is-backspace-mode 1)))
@@ -848,7 +855,7 @@ or `CVS', and any subdirectory that contains a file named `.nosearch'."
848 855
849 ;; Register default TTY colors for the case the terminal hasn't a 856 ;; Register default TTY colors for the case the terminal hasn't a
850 ;; terminal init file. 857 ;; terminal init file.
851 (unless (memq window-system '(x w32)) 858 (unless (memq initial-window-system '(x w32))
852 ;; We do this regardles of whether the terminal supports colors 859 ;; We do this regardles of whether the terminal supports colors
853 ;; or not, since they can switch that support on or off in 860 ;; or not, since they can switch that support on or off in
854 ;; mid-session by setting the tty-color-mode frame parameter. 861 ;; mid-session by setting the tty-color-mode frame parameter.
@@ -1046,7 +1053,7 @@ or `CVS', and any subdirectory that contains a file named `.nosearch'."
1046 ;; Load library for our terminal type. 1053 ;; Load library for our terminal type.
1047 ;; User init file can set term-file-prefix to nil to prevent this. 1054 ;; User init file can set term-file-prefix to nil to prevent this.
1048 (unless (or noninteractive 1055 (unless (or noninteractive
1049 window-system 1056 initial-window-system
1050 (null term-file-prefix)) 1057 (null term-file-prefix))
1051 (let ((term (getenv "TERM")) 1058 (let ((term (getenv "TERM"))
1052 hyphend) 1059 hyphend)
diff --git a/lisp/term/x-win.el b/lisp/term/x-win.el
index 2388b7e29bd..11e3c073b76 100644
--- a/lisp/term/x-win.el
+++ b/lisp/term/x-win.el
@@ -66,7 +66,7 @@
66;; An alist of X options and the function which handles them. See 66;; An alist of X options and the function which handles them. See
67;; ../startup.el. 67;; ../startup.el.
68 68
69(if (not (eq window-system 'x)) 69(if (not (fboundp 'x-create-frame))
70 (error "%s: Loading x-win.el but not compiled for X" (invocation-name))) 70 (error "%s: Loading x-win.el but not compiled for X" (invocation-name)))
71 71
72(require 'frame) 72(require 'frame)
@@ -1159,6 +1159,7 @@ XConsortium: rgb.txt,v 10.41 94/02/20 18:39:36 rws Exp")
1159 1159
1160;;;; Function keys 1160;;;; Function keys
1161 1161
1162;;; XXX This might be wrong with multi-tty support.
1162(substitute-key-definition 'suspend-emacs 'iconify-or-deiconify-frame 1163(substitute-key-definition 'suspend-emacs 'iconify-or-deiconify-frame
1163 global-map) 1164 global-map)
1164 1165
@@ -2346,10 +2347,11 @@ order until succeed.")
2346(x-open-connection (or x-display-name 2347(x-open-connection (or x-display-name
2347 (setq x-display-name (getenv "DISPLAY"))) 2348 (setq x-display-name (getenv "DISPLAY")))
2348 x-command-line-resources 2349 x-command-line-resources
2349 ;; Exit Emacs with fatal error if this fails. 2350 ;; Exit Emacs with fatal error if this fails and we
2350 t) 2351 ;; are the initial display.
2352 (eq initial-window-system 'x))
2351 2353
2352(setq frame-creation-function 'x-create-frame-with-faces) 2354(add-to-list 'frame-creation-function-alist '(x . x-create-frame-with-faces))
2353 2355
2354(setq x-cut-buffer-max (min (- (/ (x-server-max-request-size) 2) 100) 2356(setq x-cut-buffer-max (min (- (/ (x-server-max-request-size) 2) 100)
2355 x-cut-buffer-max)) 2357 x-cut-buffer-max))
@@ -2431,6 +2433,7 @@ order until succeed.")
2431 (if res-selection-timeout 2433 (if res-selection-timeout
2432 (setq x-selection-timeout (string-to-number res-selection-timeout)))) 2434 (setq x-selection-timeout (string-to-number res-selection-timeout))))
2433 2435
2436;; XXX This is wrong with multi-tty support.
2434(defun x-win-suspend-error () 2437(defun x-win-suspend-error ()
2435 (error "Suspending an Emacs running under X makes no sense")) 2438 (error "Suspending an Emacs running under X makes no sense"))
2436(add-hook 'suspend-hook 'x-win-suspend-error) 2439(add-hook 'suspend-hook 'x-win-suspend-error)
@@ -2453,5 +2456,7 @@ order until succeed.")
2453;; Turn on support for mouse wheels. 2456;; Turn on support for mouse wheels.
2454(mouse-wheel-mode 1) 2457(mouse-wheel-mode 1)
2455 2458
2459(provide 'x-win)
2460
2456;;; arch-tag: f1501302-db8b-4d95-88e3-116697d89f78 2461;;; arch-tag: f1501302-db8b-4d95-88e3-116697d89f78
2457;;; x-win.el ends here 2462;;; x-win.el ends here