Mercurial > emacs
changeset 5614:16074afb03df
(Voverriding_local_map): New variable.
(syms_of_keyboard): Set up Lisp variable.
(read_key_sequence, menu_bar_items): Handle Voverriding_local_map.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sun, 16 Jan 1994 23:40:22 +0000 |
parents | cad51b2de6cd |
children | e7dd5c1d36dc |
files | src/keyboard.c |
diffstat | 1 files changed, 45 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/src/keyboard.c Sun Jan 16 23:39:50 1994 +0000 +++ b/src/keyboard.c Sun Jan 16 23:40:22 1994 +0000 @@ -159,6 +159,9 @@ extern Lisp_Object current_global_map; extern int minibuf_level; +/* If non-nil, this is a map that overrides all other local maps. */ +Lisp_Object Voverriding_local_map; + /* Current depth in recursive edits. */ int command_loop_level; @@ -3463,14 +3466,23 @@ { Lisp_Object *tmaps; - nmaps = current_minor_maps (0, &tmaps) + 2; - maps = (Lisp_Object *) alloca (nmaps * sizeof (maps[0])); - bcopy (tmaps, maps, (nmaps - 2) * sizeof (maps[0])); + if (!NILP (Voverriding_local_map)) + { + nmaps = 2; + maps = (Lisp_Object *) alloca (nmaps * sizeof (maps[0])); + maps[0] = Voverriding_local_map; + } + else + { + nmaps = current_minor_maps (0, &tmaps) + 2; + maps = (Lisp_Object *) alloca (nmaps * sizeof (maps[0])); + bcopy (tmaps, maps, (nmaps - 2) * sizeof (maps[0])); #ifdef USE_TEXT_PROPERTIES - maps[nmaps-2] = get_local_map (PT, current_buffer); + maps[nmaps-2] = get_local_map (PT, current_buffer); #else - maps[nmaps-2] = current_buffer->keymap; + maps[nmaps-2] = current_buffer->keymap; #endif + } maps[nmaps-1] = current_global_map; } @@ -4133,19 +4145,33 @@ { Lisp_Object *maps; - nmaps = current_minor_maps (0, &maps) + 2; - if (nmaps > nmaps_allocated) + if (!NILP (Voverriding_local_map)) { - submaps = (Lisp_Object *) alloca (nmaps * sizeof (submaps[0])); - defs = (Lisp_Object *) alloca (nmaps * sizeof (defs[0])); - nmaps_allocated = nmaps; + nmaps = 2; + if (nmaps > nmaps_allocated) + { + submaps = (Lisp_Object *) alloca (nmaps * sizeof (submaps[0])); + defs = (Lisp_Object *) alloca (nmaps * sizeof (defs[0])); + nmaps_allocated = nmaps; + } + submaps[0] = Voverriding_local_map; } - bcopy (maps, submaps, (nmaps - 2) * sizeof (submaps[0])); + else + { + nmaps = current_minor_maps (0, &maps) + 2; + if (nmaps > nmaps_allocated) + { + submaps = (Lisp_Object *) alloca (nmaps * sizeof (submaps[0])); + defs = (Lisp_Object *) alloca (nmaps * sizeof (defs[0])); + nmaps_allocated = nmaps; + } + bcopy (maps, submaps, (nmaps - 2) * sizeof (submaps[0])); #ifdef USE_TEXT_PROPERTIES - submaps[nmaps-2] = get_local_map (PT, current_buffer); + submaps[nmaps-2] = get_local_map (PT, current_buffer); #else - submaps[nmaps-2] = current_buffer->keymap; + submaps[nmaps-2] = current_buffer->keymap; #endif + } submaps[nmaps-1] = current_global_map; } @@ -5795,6 +5821,12 @@ The elements of the list are event types that may have menu bar bindings."); Vmenu_bar_final_items = Qnil; + DEFVAR_LISP ("overriding-local-map", &Voverriding_local_map, + "Keymap that overrides all other local keymaps.\n\ +If this variable is non-nil, it is used as a keymap instead of the\n\ +buffer's local map, and the minor mode keymaps and text property keymaps."); + Voverriding_local_map = Qnil; + DEFVAR_BOOL ("track-mouse", &do_mouse_tracking, "*Non-nil means generate motion events for mouse motion.");