Mercurial > emacs
comparison lisp/startup.el @ 83014:f5cadabb36dd
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
author | Karoly Lorentey <lorentey@elte.hu> |
---|---|
date | Sun, 11 Jan 2004 21:59:40 +0000 |
parents | c9d6b407c93b |
children | 1465425fe2d3 |
comparison
equal
deleted
inserted
replaced
83013:e77d1a63471b | 83014:f5cadabb36dd |
---|---|
126 (setq top-level '(normal-top-level)) | 126 (setq top-level '(normal-top-level)) |
127 | 127 |
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. | |
133 The value is a symbol--for instance, `x' for X windows. | |
134 The 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) |
134 | 141 |
135 (defcustom inhibit-startup-message nil | 142 (defcustom inhibit-startup-message nil |
510 | 517 |
511 ;; Don't do this if we failed to create the initial frame, | 518 ;; Don't do this if we failed to create the initial frame, |
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) |
521 (frame-notice-user-settings)) | 528 (frame-notice-user-settings)) |
522 (if (fboundp 'frame-set-background-mode) | 529 (if (fboundp 'frame-set-background-mode) |
525 ;; frame-set-background-mode is idempotent, so it won't | 532 ;; frame-set-background-mode is idempotent, so it won't |
526 ;; cause any harm if it's already been done. | 533 ;; cause any harm if it's already been done. |
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. |
534 (null (frame-parameter frame 'reverse)) | 541 (null (frame-parameter frame 'reverse)) |
535 (let ((bg (frame-parameter frame 'background-color))) | 542 (let ((bg (frame-parameter frame 'background-color))) |
700 (setq eol-mnemonic-dos "(DOS)" | 707 (setq eol-mnemonic-dos "(DOS)" |
701 eol-mnemonic-mac "(Mac)"))) | 708 eol-mnemonic-mac "(Mac)"))) |
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. |
711 nil t)) | 718 nil t)) |
712 ;; If we can't read it, print the error message and exit. | 719 ;; If we can't read it, print the error message and exit. |
723 (get (car error) 'error-message) | 730 (get (car error) 'error-message) |
724 (mapconcat (lambda (obj) (prin1-to-string obj t)) | 731 (mapconcat (lambda (obj) (prin1-to-string obj t)) |
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. |
732 (unless (or (display-graphic-p) noninteractive) | 739 (unless (or (display-graphic-p) noninteractive) |
733 (setq command-line-args (tty-handle-args command-line-args))) | 740 (setq command-line-args (tty-handle-args command-line-args))) |
806 (when (fboundp 'frame-initialize) | 813 (when (fboundp 'frame-initialize) |
807 (frame-initialize)) | 814 (frame-initialize)) |
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 |
815 ;; If frame was created with a tool bar, switch tool-bar-mode on. | 822 ;; If frame was created with a tool bar, switch tool-bar-mode on. |
816 (unless (or noninteractive | 823 (unless (or noninteractive |
817 (not (display-graphic-p)) | 824 (not (display-graphic-p)) |
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 |
828 (unless noninteractive | 835 (unless noninteractive |
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))) |
842 | 849 |
843 (unless (or noninteractive | 850 (unless (or noninteractive |
846 (setq-default tooltip-mode t) | 853 (setq-default tooltip-mode t) |
847 (tooltip-mode 1)) | 854 (tooltip-mode 1)) |
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. |
855 (tty-register-default-colors)) | 862 (tty-register-default-colors)) |
856 | 863 |
1044 (funcall initial-major-mode)))) | 1051 (funcall initial-major-mode)))) |
1045 | 1052 |
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) |
1053 (while (and term | 1060 (while (and term |
1054 (not (load (concat term-file-prefix term) t t))) | 1061 (not (load (concat term-file-prefix term) t t))) |