# HG changeset patch # User Gerd Moellmann # Date 968419803 0 # Node ID 946e1ba42cc9d065c41e38e2edcdfa9211ea4d61 # Parent 1cec17cdcff11b19e2262c601d2a1722820cf1c7 (Fset_keymap_parent): Check for cycles in keymap inheritance. diff -r 1cec17cdcff1 -r 946e1ba42cc9 src/keymap.c --- a/src/keymap.c Fri Sep 08 13:14:07 2000 +0000 +++ b/src/keymap.c Fri Sep 08 13:30:03 2000 +0000 @@ -307,6 +307,7 @@ return Qnil; } + /* Set the parent keymap of MAP to PARENT. */ DEFUN ("set-keymap-parent", Fset_keymap_parent, Sset_keymap_parent, 2, 2, 0, @@ -323,7 +324,18 @@ GCPRO1 (keymap); if (!NILP (parent)) - parent = get_keymap_1 (parent, 1, 1); + { + Lisp_Object k; + + parent = get_keymap_1 (parent, 1, 1); + + /* Check for cycles. */ + k = parent; + while (KEYMAPP (k) && !EQ (keymap, k)) + k = Fkeymap_parent (k); + if (EQ (keymap, k)) + error ("Cyclic keymap inheritance"); + } /* Skip past the initial element `keymap'. */ prev = keymap;