comparison src/keyboard.c @ 12469:bec888e46e6a

(Vspecial_event_map): New variable. (syms_of_keyboard): Define Lisp var; init the map. (read_char): Look up each event in Vspecial_event_map; if bound, execute the binding here and read another event. (keys_of_keyboard): Make bindings for iconify-frame, make-frame-visible and delete-frame.
author Richard M. Stallman <rms@gnu.org>
date Sun, 02 Jul 1995 00:08:34 +0000
parents 87aeb150a91a
children 5518def44198
comparison
equal deleted inserted replaced
12468:395a1d99820b 12469:bec888e46e6a
196 /* If non-nil, this is a map that overrides all other local maps. */ 196 /* If non-nil, this is a map that overrides all other local maps. */
197 Lisp_Object Voverriding_local_map; 197 Lisp_Object Voverriding_local_map;
198 198
199 /* If non-nil, Voverriding_local_map applies to the menu bar. */ 199 /* If non-nil, Voverriding_local_map applies to the menu bar. */
200 Lisp_Object Voverriding_local_map_menu_flag; 200 Lisp_Object Voverriding_local_map_menu_flag;
201
202 /* Keymap that defines special misc events that should
203 be processed immediately at a low level. */
204 Lisp_Object Vspecial_event_map;
201 205
202 /* Current depth in recursive edits. */ 206 /* Current depth in recursive edits. */
203 int command_loop_level; 207 int command_loop_level;
204 208
205 /* Total number of times command_loop has read a key sequence. */ 209 /* Total number of times command_loop has read a key sequence. */
1643 register Lisp_Object c; 1647 register Lisp_Object c;
1644 int count; 1648 int count;
1645 jmp_buf local_getcjmp; 1649 jmp_buf local_getcjmp;
1646 jmp_buf save_jump; 1650 jmp_buf save_jump;
1647 int key_already_recorded = 0; 1651 int key_already_recorded = 0;
1652 Lisp_Object tem;
1648 Lisp_Object also_record; 1653 Lisp_Object also_record;
1649 also_record = Qnil; 1654 also_record = Qnil;
1650 1655
1651 before_command_key_count = this_command_key_count; 1656 before_command_key_count = this_command_key_count;
1652 before_command_echo_length = echo_length (); 1657 before_command_echo_length = echo_length ();
1658
1659 retry:
1653 1660
1654 if (CONSP (Vunread_command_events)) 1661 if (CONSP (Vunread_command_events))
1655 { 1662 {
1656 c = XCONS (Vunread_command_events)->car; 1663 c = XCONS (Vunread_command_events)->car;
1657 Vunread_command_events = XCONS (Vunread_command_events)->cdr; 1664 Vunread_command_events = XCONS (Vunread_command_events)->cdr;
2016 if (BUFFERP (c)) 2023 if (BUFFERP (c))
2017 return c; 2024 return c;
2018 2025
2019 if (key_already_recorded) 2026 if (key_already_recorded)
2020 return c; 2027 return c;
2028
2029 /* Process special events within read_char
2030 and loop around to read another event. */
2031 tem = get_keyelt (access_keymap (get_keymap_1 (Vspecial_event_map, 0, 0),
2032 c, 0, 0), 1);
2033
2034 if (!NILP (tem))
2035 {
2036 last_input_char = c;
2037 Fcommand_execute (tem, Qnil);
2038 goto retry;
2039 }
2021 2040
2022 /* Wipe the echo area. */ 2041 /* Wipe the echo area. */
2023 echo_area_glyphs = 0; 2042 echo_area_glyphs = 0;
2024 2043
2025 /* Handle things that only apply to characters. */ 2044 /* Handle things that only apply to characters. */
7218 "Non-nil means `overriding-local-map' applies to the menu bar.\n\ 7237 "Non-nil means `overriding-local-map' applies to the menu bar.\n\
7219 Otherwise, the menu bar continues to reflect the buffer's local map\n\ 7238 Otherwise, the menu bar continues to reflect the buffer's local map\n\
7220 and the minor mode maps regardless of `overriding-local-map'."); 7239 and the minor mode maps regardless of `overriding-local-map'.");
7221 Voverriding_local_map_menu_flag = Qnil; 7240 Voverriding_local_map_menu_flag = Qnil;
7222 7241
7242 DEFVAR_LISP ("special-event-map", &Vspecial_event_map,
7243 "Keymap defining bindings for special events to execute at low level.");
7244 Vspecial_event_map = Fcons (intern ("keymap"), Qnil);
7245
7223 DEFVAR_LISP ("track-mouse", &do_mouse_tracking, 7246 DEFVAR_LISP ("track-mouse", &do_mouse_tracking,
7224 "*Non-nil means generate motion events for mouse motion."); 7247 "*Non-nil means generate motion events for mouse motion.");
7225 7248
7226 DEFVAR_KBOARD ("system-key-alist", Vsystem_key_alist, 7249 DEFVAR_KBOARD ("system-key-alist", Vsystem_key_alist,
7227 "Alist of system-specific X windows key symbols.\n\ 7250 "Alist of system-specific X windows key symbols.\n\
7246 initial_define_key (global_map, Ctl ('Z'), "suspend-emacs"); 7269 initial_define_key (global_map, Ctl ('Z'), "suspend-emacs");
7247 initial_define_key (control_x_map, Ctl ('Z'), "suspend-emacs"); 7270 initial_define_key (control_x_map, Ctl ('Z'), "suspend-emacs");
7248 initial_define_key (meta_map, Ctl ('C'), "exit-recursive-edit"); 7271 initial_define_key (meta_map, Ctl ('C'), "exit-recursive-edit");
7249 initial_define_key (global_map, Ctl (']'), "abort-recursive-edit"); 7272 initial_define_key (global_map, Ctl (']'), "abort-recursive-edit");
7250 initial_define_key (meta_map, 'x', "execute-extended-command"); 7273 initial_define_key (meta_map, 'x', "execute-extended-command");
7251 } 7274
7275 initial_define_lispy_key (Vspecial_event_map, "delete-frame",
7276 "handle-delete-frame");
7277 initial_define_lispy_key (Vspecial_event_map, "iconify-frame",
7278 "ignore-event");
7279 initial_define_lispy_key (Vspecial_event_map, "make-frame-visible",
7280 "ignore-event");
7281 }