aboutsummaryrefslogtreecommitdiffstats
path: root/src/keymap.c
diff options
context:
space:
mode:
authorGerd Moellmann2000-09-08 13:30:21 +0000
committerGerd Moellmann2000-09-08 13:30:21 +0000
commit3015eec0e8c1e7b24c8db35c764afd6d6971dd15 (patch)
tree8b53ec31fcecbe82d54004eb74d2d593345d1b26 /src/keymap.c
parent018fc000724c4c8212c1870bf003e8fd57934cac (diff)
downloademacs-3015eec0e8c1e7b24c8db35c764afd6d6971dd15.tar.gz
emacs-3015eec0e8c1e7b24c8db35c764afd6d6971dd15.zip
(Fset_keymap_parent): Check for cycles in keymap
inheritance.
Diffstat (limited to 'src/keymap.c')
-rw-r--r--src/keymap.c14
1 files changed, 13 insertions, 1 deletions
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,
307 return Qnil; 307 return Qnil;
308} 308}
309 309
310
310/* Set the parent keymap of MAP to PARENT. */ 311/* Set the parent keymap of MAP to PARENT. */
311 312
312DEFUN ("set-keymap-parent", Fset_keymap_parent, Sset_keymap_parent, 2, 2, 0, 313DEFUN ("set-keymap-parent", Fset_keymap_parent, Sset_keymap_parent, 2, 2, 0,
@@ -323,7 +324,18 @@ PARENT should be nil or another keymap.")
323 GCPRO1 (keymap); 324 GCPRO1 (keymap);
324 325
325 if (!NILP (parent)) 326 if (!NILP (parent))
326 parent = get_keymap_1 (parent, 1, 1); 327 {
328 Lisp_Object k;
329
330 parent = get_keymap_1 (parent, 1, 1);
331
332 /* Check for cycles. */
333 k = parent;
334 while (KEYMAPP (k) && !EQ (keymap, k))
335 k = Fkeymap_parent (k);
336 if (EQ (keymap, k))
337 error ("Cyclic keymap inheritance");
338 }
327 339
328 /* Skip past the initial element `keymap'. */ 340 /* Skip past the initial element `keymap'. */
329 prev = keymap; 341 prev = keymap;