diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 20 | ||||
| -rw-r--r-- | src/keyboard.c | 69 | ||||
| -rw-r--r-- | src/keymap.c | 130 | ||||
| -rw-r--r-- | src/lisp.h | 2 |
4 files changed, 73 insertions, 148 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 842e21714c6..1e4c2f10858 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,23 @@ | |||
| 1 | 2000-10-14 Stefan Monnier <monnier@cs.yale.edu> | ||
| 2 | |||
| 3 | * keymap.c (access_keymap): Add AUTOLOAD parameter. | ||
| 4 | Do the meta->esc mapping. Call get_keyelt before returning. | ||
| 5 | Start scanning from the second element (the first is always `keymap') | ||
| 6 | to make it easier to detect when we reach a parent map. | ||
| 7 | Handle the case of inheriting from a symbol whose function is a map. | ||
| 8 | (Fkeymap_parent): Also handle the `inherit from symbol' case. | ||
| 9 | (fix_submap_inheritance, Fdefine_key): Update call to access_keymap. | ||
| 10 | (get_keyelt, Flookup_key): Update call to access_keymap. | ||
| 11 | Remove the meta->esc mappings. | ||
| 12 | (define_as_prefix): Delete old disabled code. | ||
| 13 | (menu_item_p): New function. | ||
| 14 | (where_is_internal_1): Skip over the few remaining menu items. | ||
| 15 | * lisp.h (access_keymap): Update prototype. | ||
| 16 | * keyboard.c (read_char, menu_bar_items, tool_bar_items): | ||
| 17 | Update call to access_keymap. | ||
| 18 | (follow_key, read_key_sequence): Update calls to access_keymap. | ||
| 19 | Remove the meta->esc mappings. | ||
| 20 | |||
| 1 | 2000-10-13 Gerd Moellmann <gerd@gnu.org> | 21 | 2000-10-13 Gerd Moellmann <gerd@gnu.org> |
| 2 | 22 | ||
| 3 | * dispnew.c (direct_output_for_insert): Call set_iterator_to_next | 23 | * dispnew.c (direct_output_for_insert): Call set_iterator_to_next |
diff --git a/src/keyboard.c b/src/keyboard.c index 16df84b80f5..e4aac125a61 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -2570,8 +2570,7 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu) | |||
| 2570 | and loop around to read another event. */ | 2570 | and loop around to read another event. */ |
| 2571 | save = Vquit_flag; | 2571 | save = Vquit_flag; |
| 2572 | Vquit_flag = Qnil; | 2572 | Vquit_flag = Qnil; |
| 2573 | tem = get_keyelt (access_keymap (get_keymap_1 (Vspecial_event_map, 0, 0), | 2573 | tem = access_keymap (get_keymap_1 (Vspecial_event_map, 0, 0), c, 0, 0, 1); |
| 2574 | c, 0, 0), 1); | ||
| 2575 | Vquit_flag = save; | 2574 | Vquit_flag = save; |
| 2576 | 2575 | ||
| 2577 | if (!NILP (tem)) | 2576 | if (!NILP (tem)) |
| @@ -6254,7 +6253,7 @@ menu_bar_items (old) | |||
| 6254 | for (mapno = nmaps - 1; mapno >= 0; mapno--) | 6253 | for (mapno = nmaps - 1; mapno >= 0; mapno--) |
| 6255 | if (!NILP (maps[mapno])) | 6254 | if (!NILP (maps[mapno])) |
| 6256 | { | 6255 | { |
| 6257 | def = get_keyelt (access_keymap (maps[mapno], Qmenu_bar, 1, 0), 0); | 6256 | def = access_keymap (maps[mapno], Qmenu_bar, 1, 0, 0); |
| 6258 | tem = Fkeymapp (def); | 6257 | tem = Fkeymapp (def); |
| 6259 | if (!NILP (tem)) | 6258 | if (!NILP (tem)) |
| 6260 | menu_bar_one_keymap (def); | 6259 | menu_bar_one_keymap (def); |
| @@ -6911,8 +6910,9 @@ tool_bar_items (reuse, nitems) | |||
| 6911 | if (!NILP (maps[i])) | 6910 | if (!NILP (maps[i])) |
| 6912 | { | 6911 | { |
| 6913 | Lisp_Object keymap; | 6912 | Lisp_Object keymap; |
| 6914 | 6913 | ||
| 6915 | keymap = get_keyelt (access_keymap (maps[i], Qtool_bar, 1, 1), 0); | 6914 | /* Why set the `noinherit' flag ? -sm */ |
| 6915 | keymap = access_keymap (maps[i], Qtool_bar, 1, 1, 0); | ||
| 6916 | if (!NILP (Fkeymapp (keymap))) | 6916 | if (!NILP (Fkeymapp (keymap))) |
| 6917 | { | 6917 | { |
| 6918 | Lisp_Object tail; | 6918 | Lisp_Object tail; |
| @@ -7599,31 +7599,6 @@ follow_key (key, nmaps, current, defs, next) | |||
| 7599 | int i, first_binding; | 7599 | int i, first_binding; |
| 7600 | int did_meta = 0; | 7600 | int did_meta = 0; |
| 7601 | 7601 | ||
| 7602 | /* If KEY is a meta ASCII character, treat it like meta-prefix-char | ||
| 7603 | followed by the corresponding non-meta character. | ||
| 7604 | Put the results into DEFS, since we are going to alter that anyway. | ||
| 7605 | Do not alter CURRENT or NEXT. */ | ||
| 7606 | if (INTEGERP (key) && (XUINT (key) & CHAR_META)) | ||
| 7607 | { | ||
| 7608 | for (i = 0; i < nmaps; i++) | ||
| 7609 | if (! NILP (current[i])) | ||
| 7610 | { | ||
| 7611 | Lisp_Object def; | ||
| 7612 | def = get_keyelt (access_keymap (current[i], | ||
| 7613 | meta_prefix_char, 1, 0), 0); | ||
| 7614 | |||
| 7615 | /* Note that since we pass the resulting bindings through | ||
| 7616 | get_keymap_1, non-prefix bindings for meta-prefix-char | ||
| 7617 | disappear. */ | ||
| 7618 | defs[i] = get_keymap_1 (def, 0, 1); | ||
| 7619 | } | ||
| 7620 | else | ||
| 7621 | defs[i] = Qnil; | ||
| 7622 | |||
| 7623 | did_meta = 1; | ||
| 7624 | XSETINT (key, XFASTINT (key) & ~CHAR_META); | ||
| 7625 | } | ||
| 7626 | |||
| 7627 | first_binding = nmaps; | 7602 | first_binding = nmaps; |
| 7628 | for (i = nmaps - 1; i >= 0; i--) | 7603 | for (i = nmaps - 1; i >= 0; i--) |
| 7629 | { | 7604 | { |
| @@ -7635,7 +7610,7 @@ follow_key (key, nmaps, current, defs, next) | |||
| 7635 | else | 7610 | else |
| 7636 | map = current[i]; | 7611 | map = current[i]; |
| 7637 | 7612 | ||
| 7638 | defs[i] = get_keyelt (access_keymap (map, key, 1, 0), 1); | 7613 | defs[i] = access_keymap (map, key, 1, 0, 1); |
| 7639 | if (! NILP (defs[i])) | 7614 | if (! NILP (defs[i])) |
| 7640 | first_binding = i; | 7615 | first_binding = i; |
| 7641 | } | 7616 | } |
| @@ -8457,22 +8432,8 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last, | |||
| 8457 | Lisp_Object key; | 8432 | Lisp_Object key; |
| 8458 | 8433 | ||
| 8459 | key = keybuf[fkey_end++]; | 8434 | key = keybuf[fkey_end++]; |
| 8460 | /* Look up meta-characters by prefixing them | ||
| 8461 | with meta_prefix_char. I hate this. */ | ||
| 8462 | if (INTEGERP (key) && XUINT (key) & meta_modifier) | ||
| 8463 | { | ||
| 8464 | fkey_next | ||
| 8465 | = get_keymap_1 | ||
| 8466 | (get_keyelt | ||
| 8467 | (access_keymap (fkey_map, meta_prefix_char, 1, 0), 0), | ||
| 8468 | 0, 1); | ||
| 8469 | XSETFASTINT (key, XFASTINT (key) & ~meta_modifier); | ||
| 8470 | } | ||
| 8471 | else | ||
| 8472 | fkey_next = fkey_map; | ||
| 8473 | |||
| 8474 | fkey_next | 8435 | fkey_next |
| 8475 | = get_keyelt (access_keymap (fkey_next, key, 1, 0), 1); | 8436 | = access_keymap (fkey_map, key, 1, 0, 1); |
| 8476 | 8437 | ||
| 8477 | /* Handle symbol with autoload definition. */ | 8438 | /* Handle symbol with autoload definition. */ |
| 8478 | if (SYMBOLP (fkey_next) && ! NILP (Ffboundp (fkey_next)) | 8439 | if (SYMBOLP (fkey_next) && ! NILP (Ffboundp (fkey_next)) |
| @@ -8581,22 +8542,8 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last, | |||
| 8581 | Lisp_Object key; | 8542 | Lisp_Object key; |
| 8582 | 8543 | ||
| 8583 | key = keybuf[keytran_end++]; | 8544 | key = keybuf[keytran_end++]; |
| 8584 | /* Look up meta-characters by prefixing them | ||
| 8585 | with meta_prefix_char. I hate this. */ | ||
| 8586 | if (INTEGERP (key) && XUINT (key) & meta_modifier) | ||
| 8587 | { | ||
| 8588 | keytran_next | ||
| 8589 | = get_keymap_1 | ||
| 8590 | (get_keyelt | ||
| 8591 | (access_keymap (keytran_map, meta_prefix_char, 1, 0), 0), | ||
| 8592 | 0, 1); | ||
| 8593 | XSETFASTINT (key, XFASTINT (key) & ~meta_modifier); | ||
| 8594 | } | ||
| 8595 | else | ||
| 8596 | keytran_next = keytran_map; | ||
| 8597 | |||
| 8598 | keytran_next | 8545 | keytran_next |
| 8599 | = get_keyelt (access_keymap (keytran_next, key, 1, 0), 1); | 8546 | = access_keymap (keytran_map, key, 1, 0, 1); |
| 8600 | 8547 | ||
| 8601 | /* Handle symbol with autoload definition. */ | 8548 | /* Handle symbol with autoload definition. */ |
| 8602 | if (SYMBOLP (keytran_next) && ! NILP (Ffboundp (keytran_next)) | 8549 | if (SYMBOLP (keytran_next) && ! NILP (Ffboundp (keytran_next)) |
diff --git a/src/keymap.c b/src/keymap.c index 8921f53689b..d9344397bcf 100644 --- a/src/keymap.c +++ b/src/keymap.c | |||
| @@ -302,7 +302,7 @@ DEFUN ("keymap-parent", Fkeymap_parent, Skeymap_parent, 1, 1, 0, | |||
| 302 | return list; | 302 | return list; |
| 303 | } | 303 | } |
| 304 | 304 | ||
| 305 | return Qnil; | 305 | return get_keymap_1(list, 0, autoload); |
| 306 | } | 306 | } |
| 307 | 307 | ||
| 308 | 308 | ||
| @@ -413,7 +413,7 @@ fix_submap_inheritance (map, event, submap) | |||
| 413 | 413 | ||
| 414 | map_parent = Fkeymap_parent (map); | 414 | map_parent = Fkeymap_parent (map); |
| 415 | if (! NILP (map_parent)) | 415 | if (! NILP (map_parent)) |
| 416 | parent_entry = get_keyelt (access_keymap (map_parent, event, 0, 0), 0); | 416 | parent_entry = access_keymap (map_parent, event, 0, 0, 0); |
| 417 | else | 417 | else |
| 418 | parent_entry = Qnil; | 418 | parent_entry = Qnil; |
| 419 | 419 | ||
| @@ -455,11 +455,12 @@ fix_submap_inheritance (map, event, submap) | |||
| 455 | If NOINHERIT, don't accept a subkeymap found in an inherited keymap. */ | 455 | If NOINHERIT, don't accept a subkeymap found in an inherited keymap. */ |
| 456 | 456 | ||
| 457 | Lisp_Object | 457 | Lisp_Object |
| 458 | access_keymap (map, idx, t_ok, noinherit) | 458 | access_keymap (map, idx, t_ok, noinherit, autoload) |
| 459 | Lisp_Object map; | 459 | Lisp_Object map; |
| 460 | Lisp_Object idx; | 460 | Lisp_Object idx; |
| 461 | int t_ok; | 461 | int t_ok; |
| 462 | int noinherit; | 462 | int noinherit; |
| 463 | int autoload; | ||
| 463 | { | 464 | { |
| 464 | int noprefix = 0; | 465 | int noprefix = 0; |
| 465 | Lisp_Object val; | 466 | Lisp_Object val; |
| @@ -478,12 +479,23 @@ access_keymap (map, idx, t_ok, noinherit) | |||
| 478 | with more than 24 bits of integer. */ | 479 | with more than 24 bits of integer. */ |
| 479 | XSETFASTINT (idx, XINT (idx) & (CHAR_META | (CHAR_META - 1))); | 480 | XSETFASTINT (idx, XINT (idx) & (CHAR_META | (CHAR_META - 1))); |
| 480 | 481 | ||
| 482 | /* Handle the special meta -> esc mapping. */ | ||
| 483 | if (INTEGERP (idx) && XUINT (idx) & meta_modifier) | ||
| 484 | { | ||
| 485 | map = get_keymap_1 (access_keymap | ||
| 486 | (map, meta_prefix_char, t_ok, noinherit, autoload), | ||
| 487 | 0, autoload); | ||
| 488 | XSETINT (idx, XFASTINT (idx) & ~meta_modifier); | ||
| 489 | } | ||
| 490 | |||
| 481 | { | 491 | { |
| 482 | Lisp_Object tail; | 492 | Lisp_Object tail; |
| 483 | Lisp_Object t_binding; | 493 | Lisp_Object t_binding; |
| 484 | 494 | ||
| 485 | t_binding = Qnil; | 495 | t_binding = Qnil; |
| 486 | for (tail = map; CONSP (tail); tail = XCDR (tail)) | 496 | for (tail = XCDR (map); |
| 497 | CONSP (tail) || (tail = get_keymap_1(tail, 0, autoload), CONSP (tail)); | ||
| 498 | tail = XCDR (tail)) | ||
| 487 | { | 499 | { |
| 488 | Lisp_Object binding; | 500 | Lisp_Object binding; |
| 489 | 501 | ||
| @@ -492,7 +504,7 @@ access_keymap (map, idx, t_ok, noinherit) | |||
| 492 | { | 504 | { |
| 493 | /* If NOINHERIT, stop finding prefix definitions | 505 | /* If NOINHERIT, stop finding prefix definitions |
| 494 | after we pass a second occurrence of the `keymap' symbol. */ | 506 | after we pass a second occurrence of the `keymap' symbol. */ |
| 495 | if (noinherit && EQ (binding, Qkeymap) && ! EQ (tail, map)) | 507 | if (noinherit && EQ (binding, Qkeymap)) |
| 496 | noprefix = 1; | 508 | noprefix = 1; |
| 497 | } | 509 | } |
| 498 | else if (CONSP (binding)) | 510 | else if (CONSP (binding)) |
| @@ -504,7 +516,7 @@ access_keymap (map, idx, t_ok, noinherit) | |||
| 504 | return Qnil; | 516 | return Qnil; |
| 505 | if (CONSP (val)) | 517 | if (CONSP (val)) |
| 506 | fix_submap_inheritance (map, idx, val); | 518 | fix_submap_inheritance (map, idx, val); |
| 507 | return val; | 519 | return get_keyelt (val, autoload); |
| 508 | } | 520 | } |
| 509 | if (t_ok && EQ (XCAR (binding), Qt)) | 521 | if (t_ok && EQ (XCAR (binding), Qt)) |
| 510 | t_binding = XCDR (binding); | 522 | t_binding = XCDR (binding); |
| @@ -518,7 +530,7 @@ access_keymap (map, idx, t_ok, noinherit) | |||
| 518 | return Qnil; | 530 | return Qnil; |
| 519 | if (CONSP (val)) | 531 | if (CONSP (val)) |
| 520 | fix_submap_inheritance (map, idx, val); | 532 | fix_submap_inheritance (map, idx, val); |
| 521 | return val; | 533 | return get_keyelt (val, autoload); |
| 522 | } | 534 | } |
| 523 | } | 535 | } |
| 524 | else if (CHAR_TABLE_P (binding)) | 536 | else if (CHAR_TABLE_P (binding)) |
| @@ -536,14 +548,14 @@ access_keymap (map, idx, t_ok, noinherit) | |||
| 536 | return Qnil; | 548 | return Qnil; |
| 537 | if (CONSP (val)) | 549 | if (CONSP (val)) |
| 538 | fix_submap_inheritance (map, idx, val); | 550 | fix_submap_inheritance (map, idx, val); |
| 539 | return val; | 551 | return get_keyelt (val, autoload); |
| 540 | } | 552 | } |
| 541 | } | 553 | } |
| 542 | 554 | ||
| 543 | QUIT; | 555 | QUIT; |
| 544 | } | 556 | } |
| 545 | 557 | ||
| 546 | return t_binding; | 558 | return get_keyelt (t_binding, autoload); |
| 547 | } | 559 | } |
| 548 | } | 560 | } |
| 549 | 561 | ||
| @@ -635,26 +647,9 @@ get_keyelt (object, autoload) | |||
| 635 | else | 647 | else |
| 636 | { | 648 | { |
| 637 | Lisp_Object map; | 649 | Lisp_Object map; |
| 638 | |||
| 639 | map = get_keymap_1 (Fcar_safe (object), 0, autoload); | 650 | map = get_keymap_1 (Fcar_safe (object), 0, autoload); |
| 640 | if (NILP (map)) | 651 | return (NILP (map) ? object /* Invalid keymap */ |
| 641 | /* Invalid keymap */ | 652 | : access_keymap (map, Fcdr (object), 0, 0, autoload)); |
| 642 | return object; | ||
| 643 | else | ||
| 644 | { | ||
| 645 | Lisp_Object key; | ||
| 646 | key = Fcdr (object); | ||
| 647 | if (INTEGERP (key) && (XUINT (key) & meta_modifier)) | ||
| 648 | { | ||
| 649 | object = access_keymap (map, meta_prefix_char, 0, 0); | ||
| 650 | map = get_keymap_1 (object, 0, autoload); | ||
| 651 | object = access_keymap (map, make_number (XINT (key) | ||
| 652 | & ~meta_modifier), | ||
| 653 | 0, 0); | ||
| 654 | } | ||
| 655 | else | ||
| 656 | object = access_keymap (map, key, 0, 0); | ||
| 657 | } | ||
| 658 | } | 653 | } |
| 659 | } | 654 | } |
| 660 | } | 655 | } |
| @@ -973,7 +968,7 @@ the front of KEYMAP.") | |||
| 973 | if (idx == length) | 968 | if (idx == length) |
| 974 | RETURN_UNGCPRO (store_in_keymap (keymap, c, def)); | 969 | RETURN_UNGCPRO (store_in_keymap (keymap, c, def)); |
| 975 | 970 | ||
| 976 | cmd = get_keyelt (access_keymap (keymap, c, 0, 1), 1); | 971 | cmd = access_keymap (keymap, c, 0, 1, 1); |
| 977 | 972 | ||
| 978 | /* If this key is undefined, make it a prefix. */ | 973 | /* If this key is undefined, make it a prefix. */ |
| 979 | if (NILP (cmd)) | 974 | if (NILP (cmd)) |
| @@ -1014,10 +1009,8 @@ recognize the default bindings, just as `read-key-sequence' does.") | |||
| 1014 | register int idx; | 1009 | register int idx; |
| 1015 | register Lisp_Object cmd; | 1010 | register Lisp_Object cmd; |
| 1016 | register Lisp_Object c; | 1011 | register Lisp_Object c; |
| 1017 | int metized = 0; | ||
| 1018 | int length; | 1012 | int length; |
| 1019 | int t_ok = ! NILP (accept_default); | 1013 | int t_ok = ! NILP (accept_default); |
| 1020 | int meta_bit; | ||
| 1021 | struct gcpro gcpro1; | 1014 | struct gcpro gcpro1; |
| 1022 | 1015 | ||
| 1023 | keymap = get_keymap_1 (keymap, 1, 1); | 1016 | keymap = get_keymap_1 (keymap, 1, 1); |
| @@ -1029,38 +1022,21 @@ recognize the default bindings, just as `read-key-sequence' does.") | |||
| 1029 | if (length == 0) | 1022 | if (length == 0) |
| 1030 | return keymap; | 1023 | return keymap; |
| 1031 | 1024 | ||
| 1032 | if (VECTORP (key)) | ||
| 1033 | meta_bit = meta_modifier; | ||
| 1034 | else | ||
| 1035 | meta_bit = 0x80; | ||
| 1036 | |||
| 1037 | GCPRO1 (key); | 1025 | GCPRO1 (key); |
| 1038 | 1026 | ||
| 1039 | idx = 0; | 1027 | idx = 0; |
| 1040 | while (1) | 1028 | while (1) |
| 1041 | { | 1029 | { |
| 1042 | c = Faref (key, make_number (idx)); | 1030 | c = Faref (key, make_number (idx++)); |
| 1043 | 1031 | ||
| 1044 | if (CONSP (c) && lucid_event_type_list_p (c)) | 1032 | if (CONSP (c) && lucid_event_type_list_p (c)) |
| 1045 | c = Fevent_convert_list (c); | 1033 | c = Fevent_convert_list (c); |
| 1046 | 1034 | ||
| 1047 | if (INTEGERP (c) | 1035 | /* Turn the 8th bit of string chars into a meta modifier. */ |
| 1048 | && (XINT (c) & meta_bit) | 1036 | if (XINT (c) & 0x80 && STRINGP (key)) |
| 1049 | && !metized) | 1037 | XSETINT (c, (XINT (c) | meta_modifier) & ~0x80); |
| 1050 | { | ||
| 1051 | c = meta_prefix_char; | ||
| 1052 | metized = 1; | ||
| 1053 | } | ||
| 1054 | else | ||
| 1055 | { | ||
| 1056 | if (INTEGERP (c)) | ||
| 1057 | XSETINT (c, XINT (c) & ~meta_bit); | ||
| 1058 | |||
| 1059 | metized = 0; | ||
| 1060 | idx++; | ||
| 1061 | } | ||
| 1062 | 1038 | ||
| 1063 | cmd = get_keyelt (access_keymap (keymap, c, t_ok, 0), 1); | 1039 | cmd = access_keymap (keymap, c, t_ok, 0, 1); |
| 1064 | if (idx == length) | 1040 | if (idx == length) |
| 1065 | RETURN_UNGCPRO (cmd); | 1041 | RETURN_UNGCPRO (cmd); |
| 1066 | 1042 | ||
| @@ -1080,44 +1056,13 @@ static Lisp_Object | |||
| 1080 | define_as_prefix (keymap, c) | 1056 | define_as_prefix (keymap, c) |
| 1081 | Lisp_Object keymap, c; | 1057 | Lisp_Object keymap, c; |
| 1082 | { | 1058 | { |
| 1083 | Lisp_Object inherit, cmd; | 1059 | Lisp_Object cmd; |
| 1084 | 1060 | ||
| 1085 | cmd = Fmake_sparse_keymap (Qnil); | 1061 | cmd = Fmake_sparse_keymap (Qnil); |
| 1086 | /* If this key is defined as a prefix in an inherited keymap, | 1062 | /* If this key is defined as a prefix in an inherited keymap, |
| 1087 | make it a prefix in this map, and make its definition | 1063 | make it a prefix in this map, and make its definition |
| 1088 | inherit the other prefix definition. */ | 1064 | inherit the other prefix definition. */ |
| 1089 | inherit = access_keymap (keymap, c, 0, 0); | 1065 | cmd = nconc2 (cmd, access_keymap (keymap, c, 0, 0, 0)); |
| 1090 | #if 0 | ||
| 1091 | /* This code is needed to do the right thing in the following case: | ||
| 1092 | keymap A inherits from B, | ||
| 1093 | you define KEY as a prefix in A, | ||
| 1094 | then later you define KEY as a prefix in B. | ||
| 1095 | We want the old prefix definition in A to inherit from that in B. | ||
| 1096 | It is hard to do that retroactively, so this code | ||
| 1097 | creates the prefix in B right away. | ||
| 1098 | |||
| 1099 | But it turns out that this code causes problems immediately | ||
| 1100 | when the prefix in A is defined: it causes B to define KEY | ||
| 1101 | as a prefix with no subcommands. | ||
| 1102 | |||
| 1103 | So I took out this code. */ | ||
| 1104 | if (NILP (inherit)) | ||
| 1105 | { | ||
| 1106 | /* If there's an inherited keymap | ||
| 1107 | and it doesn't define this key, | ||
| 1108 | make it define this key. */ | ||
| 1109 | Lisp_Object tail; | ||
| 1110 | |||
| 1111 | for (tail = Fcdr (keymap); CONSP (tail); tail = XCDR (tail)) | ||
| 1112 | if (EQ (XCAR (tail), Qkeymap)) | ||
| 1113 | break; | ||
| 1114 | |||
| 1115 | if (!NILP (tail)) | ||
| 1116 | inherit = define_as_prefix (tail, c); | ||
| 1117 | } | ||
| 1118 | #endif | ||
| 1119 | |||
| 1120 | cmd = nconc2 (cmd, inherit); | ||
| 1121 | store_in_keymap (keymap, c, cmd); | 1066 | store_in_keymap (keymap, c, cmd); |
| 1122 | 1067 | ||
| 1123 | return cmd; | 1068 | return cmd; |
| @@ -2082,6 +2027,15 @@ static void where_is_internal_2 (); | |||
| 2082 | 2027 | ||
| 2083 | /* This function can GC if Flookup_key autoloads any keymaps. */ | 2028 | /* This function can GC if Flookup_key autoloads any keymaps. */ |
| 2084 | 2029 | ||
| 2030 | static INLINE int | ||
| 2031 | menu_item_p (item) | ||
| 2032 | Lisp_Object item; | ||
| 2033 | { | ||
| 2034 | return (CONSP (item) | ||
| 2035 | && (EQ (XCAR (item),Qmenu_item) | ||
| 2036 | || STRINGP (XCAR (item)))); | ||
| 2037 | } | ||
| 2038 | |||
| 2085 | DEFUN ("where-is-internal", Fwhere_is_internal, Swhere_is_internal, 1, 4, 0, | 2039 | DEFUN ("where-is-internal", Fwhere_is_internal, Swhere_is_internal, 1, 4, 0, |
| 2086 | "Return list of keys that invoke DEFINITION.\n\ | 2040 | "Return list of keys that invoke DEFINITION.\n\ |
| 2087 | If KEYMAP is non-nil, search only KEYMAP and the global keymap.\n\ | 2041 | If KEYMAP is non-nil, search only KEYMAP and the global keymap.\n\ |
| @@ -2334,6 +2288,10 @@ where_is_internal_1 (binding, key, definition, noindirect, keymap, this, last, | |||
| 2334 | int keymap_specified = !NILP (keymap); | 2288 | int keymap_specified = !NILP (keymap); |
| 2335 | struct gcpro gcpro1, gcpro2; | 2289 | struct gcpro gcpro1, gcpro2; |
| 2336 | 2290 | ||
| 2291 | /* Skip left-over menu-items. | ||
| 2292 | These can appear in a keymap bound to a mouse click, for example. */ | ||
| 2293 | if (nomenus && menu_item_p (binding)) | ||
| 2294 | return Qnil; | ||
| 2337 | /* Search through indirections unless that's not wanted. */ | 2295 | /* Search through indirections unless that's not wanted. */ |
| 2338 | if (NILP (noindirect)) | 2296 | if (NILP (noindirect)) |
| 2339 | binding = get_keyelt (binding, 0); | 2297 | binding = get_keyelt (binding, 0); |
diff --git a/src/lisp.h b/src/lisp.h index 9f5a94408e9..19620d93cea 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -2591,7 +2591,7 @@ EXFUN (Fkey_binding, 2); | |||
| 2591 | EXFUN (Fkey_description, 1); | 2591 | EXFUN (Fkey_description, 1); |
| 2592 | EXFUN (Fsingle_key_description, 2); | 2592 | EXFUN (Fsingle_key_description, 2); |
| 2593 | EXFUN (Fwhere_is_internal, 4); | 2593 | EXFUN (Fwhere_is_internal, 4); |
| 2594 | extern Lisp_Object access_keymap P_ ((Lisp_Object, Lisp_Object, int, int)); | 2594 | extern Lisp_Object access_keymap P_ ((Lisp_Object, Lisp_Object, int, int, int)); |
| 2595 | extern Lisp_Object get_keyelt P_ ((Lisp_Object, int)); | 2595 | extern Lisp_Object get_keyelt P_ ((Lisp_Object, int)); |
| 2596 | extern Lisp_Object get_keymap P_ ((Lisp_Object)); | 2596 | extern Lisp_Object get_keymap P_ ((Lisp_Object)); |
| 2597 | extern Lisp_Object get_keymap_1 P_ ((Lisp_Object, int, int)); | 2597 | extern Lisp_Object get_keymap_1 P_ ((Lisp_Object, int, int)); |