Mercurial > emacs
changeset 45222:c525c7445e1b
(Vemulation_mode_map_alists): New variable.
(syms_of_keymap): DEFVAR_LISP it.
(current_minor_maps): Process keymap alists in that list before
minor-mode-overriding-map-alist and minor-mode-map-alist.
author | Kim F. Storm <storm@cua.dk> |
---|---|
date | Fri, 10 May 2002 07:03:20 +0000 |
parents | c57fc4d56186 |
children | 4cb22a508fe3 |
files | src/keymap.c |
diffstat | 1 files changed, 93 insertions(+), 67 deletions(-) [+] |
line wrap: on
line diff
--- a/src/keymap.c Fri May 10 07:02:42 2002 +0000 +++ b/src/keymap.c Fri May 10 07:03:20 2002 +0000 @@ -75,6 +75,9 @@ minor mode variables and keymaps. */ Lisp_Object Vminor_mode_overriding_map_alist; +/* List of emulation mode keymap alists. */ +Lisp_Object Vemulation_mode_map_alists; + /* Keymap mapping ASCII function key sequences onto their preferred forms. Initialized by the terminal-specific lisp files. See DEFVAR for more documentation. */ @@ -1278,81 +1281,94 @@ int i = 0; int list_number = 0; Lisp_Object alist, assoc, var, val; + Lisp_Object emulation_alists; Lisp_Object lists[2]; + emulation_alists = Vemulation_mode_map_alists; lists[0] = Vminor_mode_overriding_map_alist; lists[1] = Vminor_mode_map_alist; for (list_number = 0; list_number < 2; list_number++) - for (alist = lists[list_number]; - CONSP (alist); - alist = XCDR (alist)) - if ((assoc = XCAR (alist), CONSP (assoc)) - && (var = XCAR (assoc), SYMBOLP (var)) - && (val = find_symbol_value (var), !EQ (val, Qunbound)) - && !NILP (val)) + { + if (CONSP (emulation_alists)) { - Lisp_Object temp; - - /* If a variable has an entry in Vminor_mode_overriding_map_alist, - and also an entry in Vminor_mode_map_alist, - ignore the latter. */ - if (list_number == 1) - { - val = assq_no_quit (var, lists[0]); - if (!NILP (val)) - continue; - } - - if (i >= cmm_size) - { - Lisp_Object *newmodes, *newmaps; - - /* Use malloc/realloc here. See the comment above - this function. */ - if (cmm_maps) - { - BLOCK_INPUT; - cmm_size *= 2; - newmodes - = (Lisp_Object *) realloc (cmm_modes, - cmm_size * sizeof *newmodes); - newmaps - = (Lisp_Object *) realloc (cmm_maps, - cmm_size * sizeof *newmaps); - UNBLOCK_INPUT; - } - else - { - BLOCK_INPUT; - cmm_size = 30; - newmodes - = (Lisp_Object *) malloc (cmm_size * sizeof *newmodes); - newmaps - = (Lisp_Object *) malloc (cmm_size * sizeof *newmaps); - UNBLOCK_INPUT; - } - - if (newmodes) - cmm_modes = newmodes; - if (newmaps) - cmm_maps = newmaps; + alist = XCAR (emulation_alists); + emulation_alists = XCDR (emulation_alists); + if (SYMBOLP (alist)) + alist = find_symbol_value (alist); + list_number = -1; + } + else + alist = lists[list_number]; + + for ( ; CONSP (alist); alist = XCDR (alist)) + if ((assoc = XCAR (alist), CONSP (assoc)) + && (var = XCAR (assoc), SYMBOLP (var)) + && (val = find_symbol_value (var), !EQ (val, Qunbound)) + && !NILP (val)) + { + Lisp_Object temp; + + /* If a variable has an entry in Vminor_mode_overriding_map_alist, + and also an entry in Vminor_mode_map_alist, + ignore the latter. */ + if (list_number == 1) + { + val = assq_no_quit (var, lists[0]); + if (!NILP (val)) + continue; + } + + if (i >= cmm_size) + { + Lisp_Object *newmodes, *newmaps; + + /* Use malloc/realloc here. See the comment above + this function. */ + if (cmm_maps) + { + BLOCK_INPUT; + cmm_size *= 2; + newmodes + = (Lisp_Object *) realloc (cmm_modes, + cmm_size * sizeof *newmodes); + newmaps + = (Lisp_Object *) realloc (cmm_maps, + cmm_size * sizeof *newmaps); + UNBLOCK_INPUT; + } + else + { + BLOCK_INPUT; + cmm_size = 30; + newmodes + = (Lisp_Object *) malloc (cmm_size * sizeof *newmodes); + newmaps + = (Lisp_Object *) malloc (cmm_size * sizeof *newmaps); + UNBLOCK_INPUT; + } + + if (newmodes) + cmm_modes = newmodes; + if (newmaps) + cmm_maps = newmaps; - if (newmodes == NULL || newmaps == NULL) - break; - } - - /* Get the keymap definition--or nil if it is not defined. */ - temp = internal_condition_case_1 (Findirect_function, - XCDR (assoc), - Qerror, current_minor_maps_error); - if (!NILP (temp)) - { - cmm_modes[i] = var; - cmm_maps [i] = temp; - i++; - } - } + if (newmodes == NULL || newmaps == NULL) + break; + } + + /* Get the keymap definition--or nil if it is not defined. */ + temp = internal_condition_case_1 (Findirect_function, + XCDR (assoc), + Qerror, current_minor_maps_error); + if (!NILP (temp)) + { + cmm_modes[i] = var; + cmm_maps [i] = temp; + i++; + } + } + } if (modeptr) *modeptr = cmm_modes; if (mapptr) *mapptr = cmm_maps; @@ -3579,6 +3595,16 @@ it is provided for major modes to bind locally. */); Vminor_mode_overriding_map_alist = Qnil; + DEFVAR_LISP ("emulation-mode-map-alists", &Vemulation_mode_map_alists, + doc: /* List of keymap alists to use for emulations modes. +It is intended for modes or packages using multiple minor-mode keymaps. +Each element is a keymap alist just like `minor-mode-map-alist', or a +symbol with a variable binding which is a keymap alist, and it is used +the same way. The "active" keymaps in each alist are used before +`minor-mode-map-alist' and `minor-mode-overriding-map-alist'. */); + Vemulation_mode_map_alists = Qnil; + + DEFVAR_LISP ("function-key-map", &Vfunction_key_map, doc: /* Keymap mapping ASCII function key sequences onto their preferred forms. This allows Emacs to recognize function keys sent from ASCII