aboutsummaryrefslogtreecommitdiffstats
path: root/src/keyboard.c
diff options
context:
space:
mode:
authorStefan Monnier2000-10-27 22:20:19 +0000
committerStefan Monnier2000-10-27 22:20:19 +0000
commit020676925cfa3fee6a016bcbee89635dc647036f (patch)
treea4e3a50558adeba85798f52dd015cd24c076aa3e /src/keyboard.c
parentb01c997e2b7319b27bf1a57c65bc484178f6772e (diff)
downloademacs-020676925cfa3fee6a016bcbee89635dc647036f.tar.gz
emacs-020676925cfa3fee6a016bcbee89635dc647036f.zip
* lisp.h (KEYMAPP): New macro.
(get_keymap): Remove. (get_keymap_1): Rename get_keymap. * keyboard.h (get_keymap_1, Fkeymapp): Remove prototype. * xterm.c (note_mode_line_highlight): Use KEYMAPP. * xmenu.c (single_submenu): Use KEYMAPP. (Fx_popup_menu): Fetch keymaps rather than checking Fkeymapp. Use KEYMAPP rather than Fkeymapp. * w32term.c (note_mode_line_highlight): Use KEYMAPP. * w32menu.c (True, False): Remove (use TRUE and FALSE instead). (Fx_popup_menu): Fetch keymaps rather than checking Fkeymapp. Use KEYMAPP rather than Fkeymapp. (single_submenu): Use KEYMAPP. (w32_menu_show, w32_dialog_show): Use TRUE. * minibuf.c (Fread_from_minibuffer): Update call to get_keymap. * keymap.c (KEYMAPP): Remove (moved to lisp.h). (Fkeymapp): Use KEYMAPP. (get_keymap): Rename from get_keymap_1. Remove old def. Return t when autoload=0 and error=0 and the keymap needs autoloading. (Fcopy_keymap): Check (eq (car x) 'keymap) rather than using Fkeymapp. (Fminor_mode_key_binding): Don't raise an error if the binding is not a keymap. (Fuse_global_map, Fuse_local_map): Allow autoloading. (Faccessible_keymaps): Fetch keymaps rather than checking Fkeymapp. * keyboard.c (read_char): get_keymap_1 -> get_keymap. Allow Vspecial_event_map to be autoloaded. (menu_bar_items): Fetch the keymap rather than using keymapp. (menu_bar_one_keymap): No need to follow func-indirect any more. (parse_menu_item): get_keymap_1 -> get_keymap. (tool_bar_items): Fetch the keymap rather than using keymapp. (read_key_sequence): Use KEYMAPP. * intervals.c (get_local_map): Use get_keymap rather than following function-indirections explicitly. * doc.c (Fsubstitute_command_keys): get_keymap_1 -> get_keymap.
Diffstat (limited to 'src/keyboard.c')
-rw-r--r--src/keyboard.c46
1 files changed, 18 insertions, 28 deletions
diff --git a/src/keyboard.c b/src/keyboard.c
index 4e08cc5c3d6..380c5646a83 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -2574,7 +2574,7 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu)
2574 and loop around to read another event. */ 2574 and loop around to read another event. */
2575 save = Vquit_flag; 2575 save = Vquit_flag;
2576 Vquit_flag = Qnil; 2576 Vquit_flag = Qnil;
2577 tem = access_keymap (get_keymap_1 (Vspecial_event_map, 0, 0), c, 0, 0, 1); 2577 tem = access_keymap (get_keymap (Vspecial_event_map, 0, 1), c, 0, 0, 1);
2578 Vquit_flag = save; 2578 Vquit_flag = save;
2579 2579
2580 if (!NILP (tem)) 2580 if (!NILP (tem))
@@ -6259,9 +6259,9 @@ menu_bar_items (old)
6259 for (mapno = nmaps - 1; mapno >= 0; mapno--) 6259 for (mapno = nmaps - 1; mapno >= 0; mapno--)
6260 if (!NILP (maps[mapno])) 6260 if (!NILP (maps[mapno]))
6261 { 6261 {
6262 def = access_keymap (maps[mapno], Qmenu_bar, 1, 0, 0); 6262 def = get_keymap (access_keymap (maps[mapno], Qmenu_bar, 1, 0, 0),
6263 tem = Fkeymapp (def); 6263 0, 0);
6264 if (!NILP (tem)) 6264 if (CONSP (def))
6265 menu_bar_one_keymap (def); 6265 menu_bar_one_keymap (def);
6266 } 6266 }
6267 6267
@@ -6327,11 +6327,6 @@ menu_bar_one_keymap (keymap)
6327{ 6327{
6328 Lisp_Object tail, item; 6328 Lisp_Object tail, item;
6329 6329
6330 /* If KEYMAP is a symbol, its function definition is the keymap
6331 to use. */
6332 if (SYMBOLP (keymap))
6333 keymap = indirect_function (keymap);
6334
6335 menu_bar_one_keymap_changed_items = Qnil; 6330 menu_bar_one_keymap_changed_items = Qnil;
6336 6331
6337 /* Loop over all keymap entries that have menu strings. */ 6332 /* Loop over all keymap entries that have menu strings. */
@@ -6661,9 +6656,9 @@ parse_menu_item (item, notreal, inmenubar)
6661 6656
6662 /* See if this is a separate pane or a submenu. */ 6657 /* See if this is a separate pane or a submenu. */
6663 def = AREF (item_properties, ITEM_PROPERTY_DEF); 6658 def = AREF (item_properties, ITEM_PROPERTY_DEF);
6664 tem = get_keymap_1 (def, 0, 1); 6659 tem = get_keymap (def, 0, 1);
6665 /* For a subkeymap, just record its details and exit. */ 6660 /* For a subkeymap, just record its details and exit. */
6666 if (!NILP (tem)) 6661 if (CONSP (tem))
6667 { 6662 {
6668 AREF (item_properties, ITEM_PROPERTY_MAP) = tem; 6663 AREF (item_properties, ITEM_PROPERTY_MAP) = tem;
6669 AREF (item_properties, ITEM_PROPERTY_DEF) = tem; 6664 AREF (item_properties, ITEM_PROPERTY_DEF) = tem;
@@ -6918,16 +6913,11 @@ tool_bar_items (reuse, nitems)
6918 Lisp_Object keymap; 6913 Lisp_Object keymap;
6919 6914
6920 /* Why set the `noinherit' flag ? -sm */ 6915 /* Why set the `noinherit' flag ? -sm */
6921 keymap = access_keymap (maps[i], Qtool_bar, 1, 1, 0); 6916 keymap = get_keymap (access_keymap (maps[i], Qtool_bar, 1, 1, 0), 0, 0);
6922 if (!NILP (Fkeymapp (keymap))) 6917 if (CONSP (keymap))
6923 { 6918 {
6924 Lisp_Object tail; 6919 Lisp_Object tail;
6925 6920
6926 /* If KEYMAP is a symbol, its function definition is the
6927 keymap to use. */
6928 if (SYMBOLP (keymap))
6929 keymap = indirect_function (keymap);
6930
6931 /* KEYMAP is a list `(keymap (KEY . BINDING) ...)'. */ 6921 /* KEYMAP is a list `(keymap (KEY . BINDING) ...)'. */
6932 for (tail = keymap; CONSP (tail); tail = XCDR (tail)) 6922 for (tail = keymap; CONSP (tail); tail = XCDR (tail))
6933 { 6923 {
@@ -7144,7 +7134,7 @@ parse_tool_bar_item (key, item)
7144 PROP (TOOL_BAR_ITEM_BINDING)))); 7134 PROP (TOOL_BAR_ITEM_BINDING))));
7145 7135
7146 /* See if the binding is a keymap. Give up if it is. */ 7136 /* See if the binding is a keymap. Give up if it is. */
7147 if (!NILP (get_keymap_1 (PROP (TOOL_BAR_ITEM_BINDING), 0, 1))) 7137 if (CONSP (get_keymap (PROP (TOOL_BAR_ITEM_BINDING), 0, 1)))
7148 return 0; 7138 return 0;
7149 7139
7150 /* Enable or disable selection of item. */ 7140 /* Enable or disable selection of item. */
@@ -7627,7 +7617,7 @@ follow_key (key, nmaps, current, defs, next)
7627 /* Given the set of bindings we've found, produce the next set of maps. */ 7617 /* Given the set of bindings we've found, produce the next set of maps. */
7628 if (first_binding < nmaps) 7618 if (first_binding < nmaps)
7629 for (i = 0; i < nmaps; i++) 7619 for (i = 0; i < nmaps; i++)
7630 next[i] = NILP (defs[i]) ? Qnil : get_keymap_1 (defs[i], 0, 1); 7620 next[i] = NILP (defs[i]) ? Qnil : get_keymap (defs[i], 0, 1);
7631 7621
7632 return first_binding; 7622 return first_binding;
7633} 7623}
@@ -7793,11 +7783,11 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last,
7793 keytran_map = Vkey_translation_map; 7783 keytran_map = Vkey_translation_map;
7794 7784
7795 /* If there is no function-key-map, turn off function key scanning. */ 7785 /* If there is no function-key-map, turn off function key scanning. */
7796 if (NILP (Fkeymapp (Vfunction_key_map))) 7786 if (!KEYMAPP (Vfunction_key_map))
7797 fkey_start = fkey_end = bufsize + 1; 7787 fkey_start = fkey_end = bufsize + 1;
7798 7788
7799 /* If there is no key-translation-map, turn off scanning. */ 7789 /* If there is no key-translation-map, turn off scanning. */
7800 if (NILP (Fkeymapp (Vkey_translation_map))) 7790 if (!KEYMAPP (Vkey_translation_map))
7801 keytran_start = keytran_end = bufsize + 1; 7791 keytran_start = keytran_end = bufsize + 1;
7802 7792
7803 if (INTERACTIVE) 7793 if (INTERACTIVE)
@@ -8452,7 +8442,7 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last,
8452 or an array. */ 8442 or an array. */
8453 if (SYMBOLP (fkey_next) && ! NILP (Ffboundp (fkey_next)) 8443 if (SYMBOLP (fkey_next) && ! NILP (Ffboundp (fkey_next))
8454 && (!NILP (Farrayp (XSYMBOL (fkey_next)->function)) 8444 && (!NILP (Farrayp (XSYMBOL (fkey_next)->function))
8455 || !NILP (Fkeymapp (XSYMBOL (fkey_next)->function)))) 8445 || KEYMAPP (XSYMBOL (fkey_next)->function)))
8456 fkey_next = XSYMBOL (fkey_next)->function; 8446 fkey_next = XSYMBOL (fkey_next)->function;
8457 8447
8458#if 0 /* I didn't turn this on, because it might cause trouble 8448#if 0 /* I didn't turn this on, because it might cause trouble
@@ -8525,11 +8515,11 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last,
8525 goto replay_sequence; 8515 goto replay_sequence;
8526 } 8516 }
8527 8517
8528 fkey_map = get_keymap_1 (fkey_next, 0, 1); 8518 fkey_map = get_keymap (fkey_next, 0, 1);
8529 8519
8530 /* If we no longer have a bound suffix, try a new positions for 8520 /* If we no longer have a bound suffix, try a new positions for
8531 fkey_start. */ 8521 fkey_start. */
8532 if (NILP (fkey_map)) 8522 if (!CONSP (fkey_map))
8533 { 8523 {
8534 fkey_end = ++fkey_start; 8524 fkey_end = ++fkey_start;
8535 fkey_map = Vfunction_key_map; 8525 fkey_map = Vfunction_key_map;
@@ -8562,7 +8552,7 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last,
8562 or an array. */ 8552 or an array. */
8563 if (SYMBOLP (keytran_next) && ! NILP (Ffboundp (keytran_next)) 8553 if (SYMBOLP (keytran_next) && ! NILP (Ffboundp (keytran_next))
8564 && (!NILP (Farrayp (XSYMBOL (keytran_next)->function)) 8554 && (!NILP (Farrayp (XSYMBOL (keytran_next)->function))
8565 || !NILP (Fkeymapp (XSYMBOL (keytran_next)->function)))) 8555 || KEYMAPP (XSYMBOL (keytran_next)->function)))
8566 keytran_next = XSYMBOL (keytran_next)->function; 8556 keytran_next = XSYMBOL (keytran_next)->function;
8567 8557
8568 /* If the key translation map gives a function, not an 8558 /* If the key translation map gives a function, not an
@@ -8626,11 +8616,11 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last,
8626 goto replay_sequence; 8616 goto replay_sequence;
8627 } 8617 }
8628 8618
8629 keytran_map = get_keymap_1 (keytran_next, 0, 1); 8619 keytran_map = get_keymap (keytran_next, 0, 1);
8630 8620
8631 /* If we no longer have a bound suffix, try a new positions for 8621 /* If we no longer have a bound suffix, try a new positions for
8632 keytran_start. */ 8622 keytran_start. */
8633 if (NILP (keytran_map)) 8623 if (!CONSP (keytran_map))
8634 { 8624 {
8635 keytran_end = ++keytran_start; 8625 keytran_end = ++keytran_start;
8636 keytran_map = Vkey_translation_map; 8626 keytran_map = Vkey_translation_map;