aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/keyboard.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/keyboard.c b/src/keyboard.c
index e63b3e06398..7428fc3c287 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -199,6 +199,10 @@ Lisp_Object Voverriding_local_map;
199/* If non-nil, Voverriding_local_map applies to the menu bar. */ 199/* If non-nil, Voverriding_local_map applies to the menu bar. */
200Lisp_Object Voverriding_local_map_menu_flag; 200Lisp_Object Voverriding_local_map_menu_flag;
201 201
202/* Keymap that defines special misc events that should
203 be processed immediately at a low level. */
204Lisp_Object Vspecial_event_map;
205
202/* Current depth in recursive edits. */ 206/* Current depth in recursive edits. */
203int command_loop_level; 207int command_loop_level;
204 208
@@ -1645,12 +1649,15 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu)
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 ();
1653 1658
1659 retry:
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;
@@ -2019,6 +2026,18 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu)
2019 if (key_already_recorded) 2026 if (key_already_recorded)
2020 return c; 2027 return c;
2021 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 }
2040
2022 /* Wipe the echo area. */ 2041 /* Wipe the echo area. */
2023 echo_area_glyphs = 0; 2042 echo_area_glyphs = 0;
2024 2043
@@ -7220,6 +7239,10 @@ Otherwise, the menu bar continues to reflect the buffer's local map\n\
7220and the minor mode maps regardless of `overriding-local-map'."); 7239and 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
@@ -7248,4 +7271,11 @@ keys_of_keyboard ()
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");
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");
7251} 7281}