From 70b8d0a4a3042a7da72f6e8999d39b018ca3520a Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Thu, 25 Oct 2007 02:38:41 +0000 Subject: [PATCH] Make `window-system' into a keyboard-local variable (rather than frame-local as done originally by multi-tty). * startup.el (window-system): Remove. Don't make it frame-local. * keyboard.h (struct kboard): Add Vwindow_system. * keyboard.c (init_kboard): Set a default for Vwindow_system. (mark_kboards): Mark Vwindow_system. * dispnew.c (syms_of_display) : Declare terminal-local. (init_display): Don't set the obsolete `window-system' frame-param. * xterm.c (x_term_init): * w32term.c (w32_create_terminal): * term.c (init_tty): Set Vwindow_system. * macterm.c (mac_create_terminal): Set a keyboard (missing piece of the multi-tty merge maybe?), copied from w32term.c. Set Vwindow_system. * xfns.c (Fx_create_frame, x_create_tip_frame): * w32fns.c (Fx_create_frame, x_create_tip_frame): * macfns.c (Fx_create_frame): Don't set the obsolete `window-system' frame-param. * frame.h (Qwindow_system): Remove. * frame.c (Qwindow_system): Remove. In `syms_of_frame' as well. (Fmake_terminal_frame): Don't set obsolete `window-system' frame-param. --- lisp/ChangeLog | 4 ++++ lisp/startup.el | 7 ------- src/ChangeLog | 27 +++++++++++++++++++++++++++ src/dispnew.c | 6 +++++- src/frame.c | 5 +---- src/frame.h | 2 -- src/keyboard.c | 3 +++ src/keyboard.h | 6 ++++-- src/macfns.c | 2 -- src/macterm.c | 20 ++++++++++++++++++++ src/term.c | 1 + src/w32fns.c | 4 ---- src/w32term.c | 1 + src/xfns.c | 4 ---- src/xterm.c | 1 + 15 files changed, 67 insertions(+), 26 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index fbb5d9f35b3..f0e82180a8b 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2007-10-25 Stefan Monnier + + * startup.el (window-system): Remove. Don't make it frame-local. + 2007-10-24 Dan Nicolaescu * textmodes/org-publish.el (org-publish-attachment): Re-install diff --git a/lisp/startup.el b/lisp/startup.el index e0b4c794687..366491fe125 100644 --- a/lisp/startup.el +++ b/lisp/startup.el @@ -36,13 +36,6 @@ (defvar command-line-processed nil "Non-nil once command line has been processed.") -(defvar window-system initial-window-system - "Name of window system the selected frame is displaying through. -The value is a symbol--for instance, `x' for X windows. -The value is nil if the selected frame is on a text-only-terminal.") - -(make-variable-frame-local 'window-system) - (defgroup initialization nil "Emacs start-up procedure." :group 'environment) diff --git a/src/ChangeLog b/src/ChangeLog index c137d23acfb..5785c3df247 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,30 @@ +2007-10-25 Stefan Monnier + + Make `window-system' into a keyboard-local variable (rather than + frame-local as done originally by multi-tty). + + * keyboard.h (struct kboard): Add Vwindow_system. + * keyboard.c (init_kboard): Set a default for Vwindow_system. + (mark_kboards): Mark Vwindow_system. + + * dispnew.c (syms_of_display) : Declare terminal-local. + (init_display): Don't set the obsolete `window-system' frame-param. + + * xterm.c (x_term_init): + * w32term.c (w32_create_terminal): + * term.c (init_tty): Set Vwindow_system. + * macterm.c (mac_create_terminal): Set a keyboard (missing piece of the + multi-tty merge maybe?), copied from w32term.c. Set Vwindow_system. + + * xfns.c (Fx_create_frame, x_create_tip_frame): + * w32fns.c (Fx_create_frame, x_create_tip_frame): + * macfns.c (Fx_create_frame): + Don't set the obsolete `window-system' frame-param. + + * frame.h (Qwindow_system): Remove. + * frame.c (Qwindow_system): Remove. In `syms_of_frame' as well. + (Fmake_terminal_frame): Don't set obsolete `window-system' frame-param. + 2007-10-23 Stefan Monnier * process.c (unwind_request_sigio): Only define if __ultrix__. diff --git a/src/dispnew.c b/src/dispnew.c index 1778d5c818b..ad139681d54 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -6956,7 +6956,6 @@ For types not defined in VMS, use define emacs_term \"TYPE\".\n\ (*initial_terminal->delete_terminal_hook) (initial_terminal); /* Update frame parameters to reflect the new type. */ - Fmodify_frame_parameters (selected_frame, Fcons (Fcons (Qwindow_system, Qnil), Qnil)); Fmodify_frame_parameters (selected_frame, Fcons (Fcons (Qtty_type, Ftty_type (selected_frame)), Qnil)); @@ -7106,6 +7105,11 @@ It is up to you to set this variable if your terminal can do that. */); The value is a symbol--for instance, `x' for X windows. The value is nil if Emacs is using a text-only terminal. */); + DEFVAR_KBOARD ("window-system", Vwindow_system, + doc: /* Name of window system through which the selected frame is displayed. +The value is a symbol--for instance, `x' for X windows. +The value is nil if the selected frame is on a text-only-terminal. */); + DEFVAR_LISP ("window-system-version", &Vwindow_system_version, doc: /* The version number of the window system in use. For X windows, this is 10 or 11. */); diff --git a/src/frame.c b/src/frame.c index 090de96cebd..ab778ae084a 100644 --- a/src/frame.c +++ b/src/frame.c @@ -110,7 +110,6 @@ Lisp_Object Qleft_fringe, Qright_fringe; Lisp_Object Qbuffer_predicate, Qbuffer_list, Qburied_buffer_list; Lisp_Object Qtty_color_mode; Lisp_Object Qtty, Qtty_type; -Lisp_Object Qwindow_system; Lisp_Object Qfullscreen, Qfullwidth, Qfullheight, Qfullboth; @@ -520,6 +519,7 @@ make_initial_frame (void) { initial_kboard = (KBOARD *) xmalloc (sizeof (KBOARD)); init_kboard (initial_kboard); + /* Leave Vwindow_system at its `t' default for now. */ initial_kboard->next_kboard = all_kboards; all_kboards = initial_kboard; } @@ -764,7 +764,6 @@ affects all frames on the same terminal device. */) XSETFRAME (frame, f); Fmodify_frame_parameters (frame, Vdefault_frame_alist); Fmodify_frame_parameters (frame, parms); - Fmodify_frame_parameters (frame, Fcons (Fcons (Qwindow_system, Qnil), Qnil)); Fmodify_frame_parameters (frame, Fcons (Fcons (Qtty_type, build_string (t->display_info.tty->type)), Qnil)); @@ -4292,8 +4291,6 @@ syms_of_frame () staticpro (&Qtty); Qtty_type = intern ("tty-type"); staticpro (&Qtty_type); - Qwindow_system = intern ("window-system"); - staticpro (&Qwindow_system); Qface_set_after_frame_default = intern ("face-set-after-frame-default"); staticpro (&Qface_set_after_frame_default); diff --git a/src/frame.h b/src/frame.h index d76cc15402a..539b0b7edd0 100644 --- a/src/frame.h +++ b/src/frame.h @@ -1020,8 +1020,6 @@ extern Lisp_Object Qx_resource_name; extern Lisp_Object Qleft, Qright, Qtop, Qbox; extern Lisp_Object Qdisplay; -extern Lisp_Object Qwindow_system; - #ifdef HAVE_WINDOW_SYSTEM /* The class of this X application. */ diff --git a/src/keyboard.c b/src/keyboard.c index 527cc9c6338..cc6b46a6ba4 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -11489,6 +11489,7 @@ init_kboard (kb) kb->reference_count = 0; kb->Vsystem_key_alist = Qnil; kb->system_key_syms = Qnil; + kb->Vwindow_system = Qt; /* Unset. */ kb->Vinput_decode_map = Fmake_sparse_keymap (Qnil); kb->Vlocal_function_key_map = Fmake_sparse_keymap (Qnil); Fset_keymap_parent (kb->Vlocal_function_key_map, Vfunction_key_map); @@ -11571,6 +11572,7 @@ init_keyboard () #endif wipe_kboard (current_kboard); init_kboard (current_kboard); + /* Leave Vwindow_system at its `t' default for now. */ if (!noninteractive) { @@ -12466,6 +12468,7 @@ mark_kboards () mark_object (kb->Vlast_kbd_macro); mark_object (kb->Vsystem_key_alist); mark_object (kb->system_key_syms); + mark_object (kb->Vwindow_system); mark_object (kb->Vinput_decode_map); mark_object (kb->Vlocal_function_key_map); mark_object (kb->Vdefault_minibuffer_frame); diff --git a/src/keyboard.h b/src/keyboard.h index ae135b30b77..6d046bc98e7 100644 --- a/src/keyboard.h +++ b/src/keyboard.h @@ -80,8 +80,7 @@ struct kboard commands that set the prefix argument. */ Lisp_Object Vlast_command; - /* Normally same as last-command, but never modified by - other commands. */ + /* Normally same as last-command, but never modified by other commands. */ Lisp_Object Vreal_last_command; /* User-supplied table to translate input characters through. */ @@ -130,6 +129,9 @@ struct kboard /* Cache for modify_event_symbol. */ Lisp_Object system_key_syms; + /* The kind of display: x, w32, ... */ + Lisp_Object Vwindow_system; + /* Keymap mapping keys to alternative preferred forms. See the DEFVAR for more documentation. */ Lisp_Object Vlocal_function_key_map; diff --git a/src/macfns.c b/src/macfns.c index d0b859054a6..56ef81c9701 100644 --- a/src/macfns.c +++ b/src/macfns.c @@ -2830,8 +2830,6 @@ This function is an internal primitive--use `make-frame' instead. */) if (CONSP (XCAR (tem)) && !NILP (XCAR (XCAR (tem)))) f->param_alist = Fcons (XCAR (tem), f->param_alist); - store_frame_param (f, Qwindow_system, Qmac); - UNGCPRO; /* Make sure windows on this frame appear in calls to next-window diff --git a/src/macterm.c b/src/macterm.c index ef1fa7c7453..d015a00e146 100644 --- a/src/macterm.c +++ b/src/macterm.c @@ -12819,6 +12819,26 @@ mac_create_terminal (struct mac_display_info *dpyinfo) terminal->memory_below_frame = 0; /* We don't remember what scrolls off the bottom. */ +#endif + + /* FIXME: This keyboard setup is 100% untested, just copied from + w32_create_terminal in order to set window-system now that it's + a keyboard object. */ +#ifdef MULTI_KBOARD + /* We don't yet support separate terminals on Mac, so don't try to share + keyboards between virtual terminals that are on the same physical + terminal like X does. */ + terminal->kboard = (KBOARD *) xmalloc (sizeof (KBOARD)); + init_kboard (terminal->kboard); + terminal->kboard->Vwindow_system = intern ("mac"); + terminal->kboard->next_kboard = all_kboards; + all_kboards = terminal->kboard; + /* Don't let the initial kboard remain current longer than necessary. + That would cause problems if a file loaded on startup tries to + prompt in the mini-buffer. */ + if (current_kboard == initial_kboard) + current_kboard = terminal->kboard; + terminal->kboard->reference_count++; #endif return terminal; diff --git a/src/term.c b/src/term.c index b97e77b2320..cdf84eef091 100644 --- a/src/term.c +++ b/src/term.c @@ -3487,6 +3487,7 @@ to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.", #ifdef MULTI_KBOARD terminal->kboard = (KBOARD *) xmalloc (sizeof (KBOARD)); init_kboard (terminal->kboard); + terminal->kboard->Vwindow_system = Qnil; terminal->kboard->next_kboard = all_kboards; all_kboards = terminal->kboard; terminal->kboard->reference_count++; diff --git a/src/w32fns.c b/src/w32fns.c index bc088a3d4f5..e5c730a528c 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -4455,8 +4455,6 @@ This function is an internal primitive--use `make-frame' instead. */) if (CONSP (XCAR (tem)) && !NILP (XCAR (XCAR (tem)))) f->param_alist = Fcons (XCAR (tem), f->param_alist); - store_frame_param (f, Qwindow_system, Qw32); - UNGCPRO; /* Make sure windows on this frame appear in calls to next-window @@ -7439,8 +7437,6 @@ x_create_tip_frame (dpyinfo, parms, text) Qnil)); } - Fmodify_frame_parameters (frame, Fcons (Fcons (Qwindow_system, Qw32), Qnil)); - f->no_split = 1; UNGCPRO; diff --git a/src/w32term.c b/src/w32term.c index 80ea9983cef..edde95f5f13 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -6331,6 +6331,7 @@ w32_create_terminal (struct w32_display_info *dpyinfo) terminal like X does. */ terminal->kboard = (KBOARD *) xmalloc (sizeof (KBOARD)); init_kboard (terminal->kboard); + terminal->kboard->Vwindow_system = intern ("w32"); terminal->kboard->next_kboard = all_kboards; all_kboards = terminal->kboard; /* Don't let the initial kboard remain current longer than necessary. diff --git a/src/xfns.c b/src/xfns.c index 43ed2f75514..4492064622a 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -3472,8 +3472,6 @@ This function is an internal primitive--use `make-frame' instead. */) if (CONSP (XCAR (tem)) && !NILP (XCAR (XCAR (tem)))) f->param_alist = Fcons (XCAR (tem), f->param_alist); - store_frame_param (f, Qwindow_system, Qx); - UNGCPRO; /* Make sure windows on this frame appear in calls to next-window @@ -4979,8 +4977,6 @@ x_create_tip_frame (dpyinfo, parms, text) Qnil)); } - Fmodify_frame_parameters (frame, Fcons (Fcons (Qwindow_system, Qx), Qnil)); - f->no_split = 1; UNGCPRO; diff --git a/src/xterm.c b/src/xterm.c index 29c840ff799..f4bead6080c 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -10781,6 +10781,7 @@ x_term_init (display_name, xrm_option, resource_name) { terminal->kboard = (KBOARD *) xmalloc (sizeof (KBOARD)); init_kboard (terminal->kboard); + terminal->kboard->Vwindow_system = intern ("x"); if (!EQ (XSYMBOL (Qvendor_specific_keysyms)->function, Qunbound)) { char *vendor = ServerVendor (dpy); -- 2.39.2