changeset 6456:9854df0e91e1

(Fcopy_keymap): Account for menus and equiv-key cache.
author Karl Heuer <kwzh@gnu.org>
date Mon, 21 Mar 1994 22:48:13 +0000
parents 2fc99253fb65
children 13aa19ca4b4f
files src/keymap.c
diffstat 1 files changed, 34 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/keymap.c	Mon Mar 21 22:27:20 1994 +0000
+++ b/src/keymap.c	Mon Mar 21 22:48:13 1994 +0000
@@ -503,10 +503,40 @@
 	      XVECTOR (elt)->contents[i] =
 		Fcopy_keymap (XVECTOR (elt)->contents[i]);
 	}
-      else if (CONSP (elt)
-	       && XTYPE (XCONS (elt)->cdr) != Lisp_Symbol
-	       && ! NILP (Fkeymapp (XCONS (elt)->cdr)))
-	XCONS (elt)->cdr = Fcopy_keymap (XCONS (elt)->cdr);
+      else if (CONSP (elt))
+	{
+	  /* Skip the optional menu string.  */
+	  if (CONSP (XCONS (elt)->cdr)
+	      && STRINGP (XCONS (XCONS (elt)->cdr)->car))
+	    {
+	      Lisp_Object tem;
+
+	      /* Copy the cell, since copy-alist didn't go this deep.  */
+	      XCONS (elt)->cdr = Fcons (XCONS (XCONS (elt)->cdr)->car,
+					XCONS (XCONS (elt)->cdr)->cdr);
+	      elt = XCONS (elt)->cdr;
+
+	      /* Also skip the optional menu help string.  */
+	      if (CONSP (XCONS (elt)->cdr)
+		  && STRINGP (XCONS (XCONS (elt)->cdr)->car))
+		{
+		  XCONS (elt)->cdr = Fcons (XCONS (XCONS (elt)->cdr)->car,
+					    XCONS (XCONS (elt)->cdr)->cdr);
+		  elt = XCONS (elt)->cdr;
+		}
+	      /* There may also be a list that caches key equivalences.
+		 Just delete it for the new keymap.  */
+	      if (CONSP (XCONS (elt)->cdr)
+		  && CONSP (XCONS (XCONS (elt)->cdr)->car)
+		  && (NILP (tem = XCONS (XCONS (XCONS (elt)->cdr)->car)->car)
+		      || VECTORP (tem)))
+		XCONS (elt)->cdr = XCONS (XCONS (elt)->cdr)->cdr;
+	    }
+	  if (CONSP (elt)
+	      && ! SYMBOLP (XCONS (elt)->cdr)
+	      && ! NILP (Fkeymapp (XCONS (elt)->cdr)))
+	    XCONS (elt)->cdr = Fcopy_keymap (XCONS (elt)->cdr);
+	}
     }
 
   return copy;