From 2a5af1cf4fe26c2f7518e2be34380c7439dc5ca3 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Wed, 12 Jun 1996 21:47:59 +0000 Subject: [PATCH] (Fset_keymap_parent): Return early if KEYMAP already has the proper parent. --- src/keymap.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/keymap.c b/src/keymap.c index a0c28bb0782..88f89cdf72b 100644 --- a/src/keymap.c +++ b/src/keymap.c @@ -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; } -- 2.39.5