From: Richard M. Stallman Date: Wed, 8 Sep 1999 05:14:39 +0000 (+0000) Subject: (fix_submap_inheritance): Do nothing if the proper parent is an X-Git-Tag: emacs-pretest-21.0.90~6842 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=61684f41fc15f3f68d3f9858e5b57217dca6d530;p=emacs.git (fix_submap_inheritance): Do nothing if the proper parent is an ancestor of SUBMAP; otherwise, add it as the ultimate ancestor. --- diff --git a/src/keymap.c b/src/keymap.c index 1b673384806..c209a690226 100644 --- a/src/keymap.c +++ b/src/keymap.c @@ -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); + } } /* Look up IDX in MAP. IDX may be any sort of event.