*** empty log message ***
[bpt/emacs.git] / src / keymap.c
index 72d40d0..e1fbb1b 100644 (file)
@@ -1,5 +1,6 @@
 /* Manipulation of keymaps
-   Copyright (C) 1985, 86,87,88,93,94,95,98,99 Free Software Foundation, Inc.
+   Copyright (C) 1985, 86,87,88,93,94,95,98,99, 2000
+   Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -414,14 +415,15 @@ fix_submap_inheritance (map, event, submap)
 
   map_parent = Fkeymap_parent (map);
   if (! NILP (map_parent))
-    parent_entry = access_keymap (map_parent, event, 0, 0, 0);
+    parent_entry =
+      get_keymap_1 (access_keymap (map_parent, event, 0, 0, 0), 0, 0);
   else
     parent_entry = Qnil;
 
   /* If MAP's parent has something other than a keymap,
-     our own submap shadows it completely, so use nil as SUBMAP's parent.  */
-  if (! KEYMAPP (parent_entry))
-    parent_entry = Qnil;
+     our own submap shadows it completely.  */
+  if (NILP (parent_entry))
+    return;
 
   if (! EQ (parent_entry, submap))
     {
@@ -430,12 +432,16 @@ fix_submap_inheritance (map, event, submap)
       while (1)
        {
          Lisp_Object tem;
+
          tem = Fkeymap_parent (submap_parent);
-         if (keymap_memberp (tem, parent_entry))
-           /* Fset_keymap_parent could create a cycle.  */
-           return;
-          if (KEYMAPP (tem))
-           submap_parent = tem;
+
+         if (KEYMAPP (tem))
+           {
+             if (keymap_memberp (tem, parent_entry))
+               /* Fset_keymap_parent could create a cycle.  */
+               return;
+             submap_parent = tem;
+           }
          else
            break;
        }
@@ -483,15 +489,15 @@ access_keymap (map, idx, t_ok, noinherit, autoload)
   /* Handle the special meta -> esc mapping. */
   if (INTEGERP (idx) && XUINT (idx) & meta_modifier)
     {
-      Lisp_Object meta_map;
-
       /* See if there is a meta-map.  If there's none, there is
          no binding for IDX, unless a default binding exists in MAP.  */
-      meta_map = access_keymap (map, meta_prefix_char, t_ok, noinherit,
-                               autoload);
-      if (KEYMAPP (meta_map))
+      Lisp_Object meta_map =
+       get_keymap_1 (access_keymap (map, meta_prefix_char,
+                                    t_ok, noinherit, autoload),
+                     0, autoload);
+      if (!NILP (meta_map))
        {
-         map = get_keymap_1 (meta_map, 0, autoload);
+         map = meta_map;
          idx = make_number (XUINT (idx) & ~meta_modifier);
        }
       else if (t_ok)