2000-09-08 Gerd Moellmann <gerd@gnu.org>
+ * keymap.c (Fset_keymap_parent): Check for cycles in keymap
+ inheritance.
+
* xdisp.c (try_window_id): When trying to locate cursor in
unchanged rows at the top, handle the case that we can't find it.
return Qnil;
}
+
/* Set the parent keymap of MAP to PARENT. */
DEFUN ("set-keymap-parent", Fset_keymap_parent, Sset_keymap_parent, 2, 2, 0,
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;