From 61684f41fc15f3f68d3f9858e5b57217dca6d530 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Wed, 8 Sep 1999 05:14:39 +0000 Subject: [PATCH] (fix_submap_inheritance): Do nothing if the proper parent is an ancestor of SUBMAP; otherwise, add it as the ultimate ancestor. --- src/keymap.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) 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. -- 2.39.5