comparison src/keymap.c @ 32739:5ce157b2eaa9

(fix_submap_inheritance): Don't do anything if parent_entry is nil: since we go to the end of submap anyway, we'd end up setting nil to nil. (access_keymap): Don't use KEYMAPP on meta_map since KEYMAPP doesn't obey autoload.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Sun, 22 Oct 2000 04:48:48 +0000
parents 5f6178a60e6b
children f915f46d067c
comparison
equal deleted inserted replaced
32738:0b777485ae55 32739:5ce157b2eaa9
417 parent_entry = access_keymap (map_parent, event, 0, 0, 0); 417 parent_entry = access_keymap (map_parent, event, 0, 0, 0);
418 else 418 else
419 parent_entry = Qnil; 419 parent_entry = Qnil;
420 420
421 /* If MAP's parent has something other than a keymap, 421 /* If MAP's parent has something other than a keymap,
422 our own submap shadows it completely, so use nil as SUBMAP's parent. */ 422 our own submap shadows it completely. */
423 if (! KEYMAPP (parent_entry)) 423 if (! KEYMAPP (parent_entry))
424 parent_entry = Qnil; 424 return;
425 425
426 if (! EQ (parent_entry, submap)) 426 if (! EQ (parent_entry, submap))
427 { 427 {
428 Lisp_Object submap_parent; 428 Lisp_Object submap_parent;
429 submap_parent = submap; 429 submap_parent = submap;
430 while (1) 430 while (1)
431 { 431 {
432 Lisp_Object tem; 432 Lisp_Object tem;
433
433 tem = Fkeymap_parent (submap_parent); 434 tem = Fkeymap_parent (submap_parent);
434 if (keymap_memberp (tem, parent_entry)) 435
435 /* Fset_keymap_parent could create a cycle. */ 436 if (KEYMAPP (tem))
436 return; 437 {
437 if (KEYMAPP (tem)) 438 if (keymap_memberp (tem, parent_entry))
438 submap_parent = tem; 439 /* Fset_keymap_parent could create a cycle. */
440 return;
441 submap_parent = tem;
442 }
439 else 443 else
440 break; 444 break;
441 } 445 }
442 Fset_keymap_parent (submap_parent, parent_entry); 446 Fset_keymap_parent (submap_parent, parent_entry);
443 } 447 }
481 XSETFASTINT (idx, XINT (idx) & (CHAR_META | (CHAR_META - 1))); 485 XSETFASTINT (idx, XINT (idx) & (CHAR_META | (CHAR_META - 1)));
482 486
483 /* Handle the special meta -> esc mapping. */ 487 /* Handle the special meta -> esc mapping. */
484 if (INTEGERP (idx) && XUINT (idx) & meta_modifier) 488 if (INTEGERP (idx) && XUINT (idx) & meta_modifier)
485 { 489 {
486 Lisp_Object meta_map;
487
488 /* See if there is a meta-map. If there's none, there is 490 /* See if there is a meta-map. If there's none, there is
489 no binding for IDX, unless a default binding exists in MAP. */ 491 no binding for IDX, unless a default binding exists in MAP. */
490 meta_map = access_keymap (map, meta_prefix_char, t_ok, noinherit, 492 Lisp_Object meta_map =
491 autoload); 493 get_keymap_1 (access_keymap
492 if (KEYMAPP (meta_map)) 494 (map, meta_prefix_char, t_ok, noinherit, autoload),
493 { 495 0, autoload);
494 map = get_keymap_1 (meta_map, 0, autoload); 496 if (!NILP (meta_map))
497 {
498 map = meta_map;
495 idx = make_number (XUINT (idx) & ~meta_modifier); 499 idx = make_number (XUINT (idx) & ~meta_modifier);
496 } 500 }
497 else if (t_ok) 501 else if (t_ok)
498 /* Set IDX to t, so that we only find a default binding. */ 502 /* Set IDX to t, so that we only find a default binding. */
499 idx = Qt; 503 idx = Qt;