]> git.eshelyaron.com Git - emacs.git/commitdiff
(fix_submap_inheritance): Do nothing if the proper parent is an
authorRichard M. Stallman <rms@gnu.org>
Wed, 8 Sep 1999 05:14:39 +0000 (05:14 +0000)
committerRichard M. Stallman <rms@gnu.org>
Wed, 8 Sep 1999 05:14:39 +0000 (05:14 +0000)
ancestor of SUBMAP; otherwise, add it as the ultimate ancestor.

src/keymap.c

index 1b6733848063d0afc83cefb3ec594a499fba23ba..c209a6902268a76a30c9d084a1d803764a49f8e1 100644 (file)
@@ -426,7 +426,23 @@ fix_submap_inheritance (map, event, submap)
     parent_entry = Qnil;
 
   if (! EQ (parent_entry, submap))
-    Fset_keymap_parent (submap, parent_entry);
+    {
+      Lisp_Object submap_parent;
+      submap_parent = submap;
+      while (1)
+       {
+         Lisp_Object tem;
+         tem = Fkeymap_parent (submap_parent);
+         if (EQ (tem, parent_entry))
+           return;
+          if (CONSP (tem)
+             && EQ (XCONS (tem)->car, Qkeymap))
+           submap_parent = tem;
+         else
+           break;
+       }
+      Fset_keymap_parent (submap_parent, parent_entry);
+    }
 }
 \f
 /* Look up IDX in MAP.  IDX may be any sort of event.