From 3015eec0e8c1e7b24c8db35c764afd6d6971dd15 Mon Sep 17 00:00:00 2001 From: Gerd Moellmann Date: Fri, 8 Sep 2000 13:30:21 +0000 Subject: [PATCH] (Fset_keymap_parent): Check for cycles in keymap inheritance. --- src/ChangeLog | 3 +++ src/keymap.c | 14 +++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/ChangeLog b/src/ChangeLog index 2ed91352645..64cd6de2da0 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2000-09-08 Gerd Moellmann + * 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. diff --git a/src/keymap.c b/src/keymap.c index 410d38e54f4..26659410227 100644 --- a/src/keymap.c +++ b/src/keymap.c @@ -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; -- 2.39.2