changeset 6774:a29237d1fdca

(get_keymap): Pass 1 as ERROR to get_keymap_1. (get_keyelt): New arg AUTOLOAD means load keymaps indirected thru. All callers changed; most pass 0. (Fdefine_key, Flookup_key): Load all the keymaps we look in.
author Richard M. Stallman <rms@gnu.org>
date Sat, 09 Apr 1994 21:09:34 +0000
parents ed16e189b9a5
children 07eb87564783
files src/keymap.c
diffstat 1 files changed, 19 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/src/keymap.c	Sat Apr 09 20:38:25 1994 +0000
+++ b/src/keymap.c	Sat Apr 09 21:09:34 1994 +0000
@@ -246,7 +246,7 @@
 get_keymap (object)
      Lisp_Object object;
 {
-  return get_keymap_1 (object, 0, 0);
+  return get_keymap_1 (object, 1, 0);
 }
 
 
@@ -344,18 +344,22 @@
    and INDEX is the object to look up in KEYMAP to yield the definition.
 
    Also if OBJECT has a menu string as the first element,
-   remove that.  Also remove a menu help string as second element.  */
+   remove that.  Also remove a menu help string as second element.
+
+   If AUTOLOAD is nonzero, load autoloadable keymaps
+   that are referred to with indirection.  */
 
 Lisp_Object
-get_keyelt (object)
+get_keyelt (object, autoload)
      register Lisp_Object object;
+     int autoload;
 {
   while (1)
     {
       register Lisp_Object map, tem;
 
       /* If the contents are (KEYMAP . ELEMENT), go indirect.  */
-      map = get_keymap_1 (Fcar_safe (object), 0, 0);
+      map = get_keymap_1 (Fcar_safe (object), 0, autoload);
       tem = Fkeymapp (map);
       if (!NILP (tem))
 	object = access_keymap (map, Fcdr (object), 0, 0);
@@ -583,7 +587,7 @@
   int length;
   struct gcpro gcpro1, gcpro2, gcpro3;
 
-  keymap = get_keymap (keymap);
+  keymap = get_keymap_1 (keymap, 1, 1);
 
   if (XTYPE (key) != Lisp_Vector
       && XTYPE (key) != Lisp_String)
@@ -627,7 +631,7 @@
       if (idx == length)
 	RETURN_UNGCPRO (store_in_keymap (keymap, c, def));
 
-      cmd = get_keyelt (access_keymap (keymap, c, 0, 1));
+      cmd = get_keyelt (access_keymap (keymap, c, 0, 1), 1);
 
       /* If this key is undefined, make it a prefix.  */
       if (NILP (cmd))
@@ -673,7 +677,7 @@
   int t_ok = ! NILP (accept_default);
   int meta_bit;
 
-  keymap = get_keymap (keymap);
+  keymap = get_keymap_1 (keymap, 1, 1);
 
   if (XTYPE (key) != Lisp_Vector
       && XTYPE (key) != Lisp_String)
@@ -709,11 +713,11 @@
 	  idx++;
 	}
 
-      cmd = get_keyelt (access_keymap (keymap, c, t_ok, 0));
+      cmd = get_keyelt (access_keymap (keymap, c, t_ok, 0), 1);
       if (idx == length)
 	return cmd;
 
-      keymap = get_keymap_1 (cmd, 0, 0);
+      keymap = get_keymap_1 (cmd, 0, 1);
       if (NILP (keymap))
 	return make_number (idx);
 
@@ -1170,7 +1174,7 @@
 		  register Lisp_Object tem;
 		  register Lisp_Object cmd;
 
-		  cmd = get_keyelt (XVECTOR (elt)->contents[i]);
+		  cmd = get_keyelt (XVECTOR (elt)->contents[i], 0);
 		  if (NILP (cmd)) continue;
 		  tem = Fkeymapp (cmd);
 		  if (!NILP (tem))
@@ -1211,7 +1215,7 @@
 	    {
 	      register Lisp_Object cmd, tem, filter;
 
-	      cmd = get_keyelt (XCONS (elt)->cdr);
+	      cmd = get_keyelt (XCONS (elt)->cdr, 0);
 	      /* Ignore definitions that aren't keymaps themselves.  */
 	      tem = Fkeymapp (cmd);
 	      if (!NILP (tem))
@@ -1635,7 +1639,7 @@
 
 	  /* Search through indirections unless that's not wanted.  */
 	  if (NILP (noindirect))
-	    binding = get_keyelt (binding);
+	    binding = get_keyelt (binding, 0);
 
 	  /* End this iteration if this element does not match
 	     the target.  */
@@ -2082,7 +2086,7 @@
       else
 	{
 	  event = Fcar_safe (Fcar (tail));
-	  definition = get_keyelt (Fcdr_safe (Fcar (tail)));
+	  definition = get_keyelt (Fcdr_safe (Fcar (tail)), 0);
 
 	  /* Don't show undefined commands or suppressed commands.  */
 	  if (NILP (definition)) continue;
@@ -2182,7 +2186,7 @@
   for (i = 0; i < XVECTOR (vector)->size; i++)
     {
       QUIT;
-      tem1 = get_keyelt (XVECTOR (vector)->contents[i]);
+      tem1 = get_keyelt (XVECTOR (vector)->contents[i], 0);
 
       if (NILP (tem1)) continue;      
 
@@ -2225,7 +2229,7 @@
 
       /* Find all consecutive characters that have the same definition.  */
       while (i + 1 < XVECTOR (vector)->size
-	     && (tem2 = get_keyelt (XVECTOR (vector)->contents[i+1]),
+	     && (tem2 = get_keyelt (XVECTOR (vector)->contents[i+1], 0),
 		 EQ (tem2, tem1)))
 	i++;