Commit 3015eec0 authored by Gerd Moellmann's avatar Gerd Moellmann

(Fset_keymap_parent): Check for cycles in keymap

inheritance.
parent 018fc000
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.
......
......@@ -307,6 +307,7 @@ DEFUN ("keymap-parent", Fkeymap_parent, Skeymap_parent, 1, 1, 0,
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 @@ PARENT should be nil or another keymap.")
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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment