(Fset_keymap_parent): Return early if KEYMAP already has the proper parent.
authorRichard M. Stallman <rms@gnu.org>
Wed, 12 Jun 1996 21:47:59 +0000 (21:47 +0000)
committerRichard M. Stallman <rms@gnu.org>
Wed, 12 Jun 1996 21:47:59 +0000 (21:47 +0000)
src/keymap.c

index a0c28bb..88f89cd 100644 (file)
@@ -307,6 +307,11 @@ PARENT should be nil or another keymap.")
         If we came to the end, add the parent in PREV.  */
       if (! CONSP (list) || EQ (Qkeymap, XCONS (list)->car))
        {
+         /* If we already have the right parent, return now
+            so that we avoid the loops below.  */
+         if (EQ (XCONS (prev)->cdr, parent))
+           return parent;
+
          XCONS (prev)->cdr = parent;
          break;
        }