comparison src/keyboard.c @ 32988:c3435dc00ed7

* 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.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Fri, 27 Oct 2000 22:20:19 +0000
parents 923b8d6d8277
children a4b7690c68da
comparison
equal deleted inserted replaced
32987:a2813d16337d 32988:c3435dc00ed7
2572 2572
2573 /* Process special events within read_char 2573 /* Process special events within read_char
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))
2581 { 2581 {
2582 int was_locked = single_kboard; 2582 int was_locked = single_kboard;
6257 result = Qnil; 6257 result = Qnil;
6258 6258
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
6268 /* Move to the end those items that should be at the end. */ 6268 /* Move to the end those items that should be at the end. */
6269 6269
6324 static void 6324 static void
6325 menu_bar_one_keymap (keymap) 6325 menu_bar_one_keymap (keymap)
6326 Lisp_Object keymap; 6326 Lisp_Object keymap;
6327 { 6327 {
6328 Lisp_Object tail, item; 6328 Lisp_Object tail, item;
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 6329
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. */
6338 for (tail = keymap; CONSP (tail); tail = XCDR (tail)) 6333 for (tail = keymap; CONSP (tail); tail = XCDR (tail))
6659 AREF (item_properties, ITEM_PROPERTY_ENABLE) = tem; 6654 AREF (item_properties, ITEM_PROPERTY_ENABLE) = tem;
6660 } 6655 }
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;
6670 return 1; 6665 return 1;
6671 } 6666 }
6916 if (!NILP (maps[i])) 6911 if (!NILP (maps[i]))
6917 { 6912 {
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 {
6934 Lisp_Object keydef = XCAR (tail); 6924 Lisp_Object keydef = XCAR (tail);
6935 if (CONSP (keydef)) 6925 if (CONSP (keydef))
7142 = menu_item_eval_property (list2 (filter, 7132 = menu_item_eval_property (list2 (filter,
7143 list2 (Qquote, 7133 list2 (Qquote,
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. */
7151 if (!EQ (PROP (TOOL_BAR_ITEM_ENABLED_P), Qt)) 7141 if (!EQ (PROP (TOOL_BAR_ITEM_ENABLED_P), Qt))
7152 PROP (TOOL_BAR_ITEM_ENABLED_P) 7142 PROP (TOOL_BAR_ITEM_ENABLED_P)
7625 } 7615 }
7626 7616
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 }
7634 7624
7635 /* Read a sequence of keys that ends with a non prefix character, 7625 /* Read a sequence of keys that ends with a non prefix character,
7791 delayed_switch_frame = Qnil; 7781 delayed_switch_frame = Qnil;
7792 fkey_map = Vfunction_key_map; 7782 fkey_map = Vfunction_key_map;
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)
7804 { 7794 {
7805 if (!NILP (prompt)) 7795 if (!NILP (prompt))
8450 8440
8451 /* Handle a symbol whose function definition is a keymap 8441 /* Handle a symbol whose function definition is a keymap
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
8459 for the mapping of return into C-m and tab into C-i. */ 8449 for the mapping of return into C-m and tab into C-i. */
8460 /* Optionally don't map function keys into other things. 8450 /* Optionally don't map function keys into other things.
8523 keytran_map = Vkey_translation_map; 8513 keytran_map = Vkey_translation_map;
8524 8514
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;
8536 function_key_possible = 0; 8526 function_key_possible = 0;
8537 } 8527 }
8560 8550
8561 /* Handle a symbol whose function definition is a keymap 8551 /* Handle a symbol whose function definition is a keymap
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
8569 array, then call the function with one arg and use 8559 array, then call the function with one arg and use
8570 its value instead. */ 8560 its value instead. */
8624 fkey_map = Vfunction_key_map; 8614 fkey_map = Vfunction_key_map;
8625 8615
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;
8637 key_translation_possible = 0; 8627 key_translation_possible = 0;
8638 } 8628 }