aboutsummaryrefslogtreecommitdiffstats
path: root/src
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
parent018fc000724c4c8212c1870bf003e8fd57934cac (diff)
downloademacs-3015eec0e8c1e7b24c8db35c764afd6d6971dd15.tar.gz
emacs-3015eec0e8c1e7b24c8db35c764afd6d6971dd15.zip
(Fset_keymap_parent): Check for cycles in keymap
inheritance.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog3
-rw-r--r--src/keymap.c14
2 files changed, 16 insertions, 1 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 2ed91352645..64cd6de2da0 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,8 @@
12000-09-08 Gerd Moellmann <gerd@gnu.org> 12000-09-08 Gerd Moellmann <gerd@gnu.org>
2 2
3 * keymap.c (Fset_keymap_parent): Check for cycles in keymap
4 inheritance.
5
3 * xdisp.c (try_window_id): When trying to locate cursor in 6 * xdisp.c (try_window_id): When trying to locate cursor in
4 unchanged rows at the top, handle the case that we can't find it. 7 unchanged rows at the top, handle the case that we can't find it.
5 8
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;