changeset 11973:4e0f3e3b4cc7

(describe_vector): New arg entire_map. Don't show bindings shadowed earlier on in the same map. (Fdescribe_vector, describe_map): Pass new arg.
author Karl Heuer <kwzh@gnu.org>
date Mon, 29 May 1995 06:07:34 +0000
parents be9d727c58c2
children 1a038aa90ad6
files src/keymap.c
diffstat 1 files changed, 29 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/src/keymap.c	Mon May 29 06:07:10 1995 +0000
+++ b/src/keymap.c	Mon May 29 06:07:34 1995 +0000
@@ -2108,7 +2108,7 @@
 
       if (VECTORP (XCONS (tail)->car))
 	describe_vector (XCONS (tail)->car,
-			 elt_prefix, elt_describer, partial, shadow);
+			 elt_prefix, elt_describer, partial, shadow, map);
       else if (CONSP (XCONS (tail)->car))
 	{
 	  event = XCONS (XCONS (tail)->car)->car;
@@ -2193,34 +2193,37 @@
 
   specbind (Qstandard_output, Fcurrent_buffer ());
   CHECK_VECTOR (vector, 0);
-  describe_vector (vector, Qnil, describe_vector_princ, 0, Qnil);
+  describe_vector (vector, Qnil, describe_vector_princ, 0, Qnil, Qnil);
 
   return unbind_to (count, Qnil);
 }
 
-describe_vector (vector, elt_prefix, elt_describer, partial, shadow)
+describe_vector (vector, elt_prefix, elt_describer,
+		 partial, shadow, entire_map)
      register Lisp_Object vector;
      Lisp_Object elt_prefix;
      int (*elt_describer) ();
      int partial;
      Lisp_Object shadow;
+     Lisp_Object entire_map;
 {
   Lisp_Object this;
   Lisp_Object dummy;
-  Lisp_Object tem1, tem2;
+  Lisp_Object definition;
+  Lisp_Object tem2;
   register int i;
   Lisp_Object suppress;
   Lisp_Object kludge;
   int first = 1;
   struct gcpro gcpro1, gcpro2, gcpro3;
 
-  tem1 = Qnil;
+  definition = Qnil;
 
   /* This vector gets used to present single keys to Flookup_key.  Since
      that is done once per vector element, we don't want to cons up a
      fresh vector every time.  */
   kludge = Fmake_vector (make_number (1), Qnil);
-  GCPRO3 (elt_prefix, tem1, kludge);
+  GCPRO3 (elt_prefix, definition, kludge);
 
   if (partial)
     suppress = intern ("suppress-keymap");
@@ -2228,20 +2231,19 @@
   for (i = 0; i < XVECTOR (vector)->size; i++)
     {
       QUIT;
-      tem1 = get_keyelt (XVECTOR (vector)->contents[i], 0);
+      definition = get_keyelt (XVECTOR (vector)->contents[i], 0);
 
-      if (NILP (tem1)) continue;      
+      if (NILP (definition)) continue;      
 
       /* Don't mention suppressed commands.  */
-      if (SYMBOLP (tem1) && partial)
+      if (SYMBOLP (definition) && partial)
 	{
-	  this = Fget (tem1, suppress);
+	  this = Fget (definition, suppress);
 	  if (!NILP (this))
 	    continue;
 	}
 
-      /* If this command in this map is shadowed by some other map,
-	 ignore it.  */
+      /* If this binding is shadowed by some other map, ignore it.  */
       if (!NILP (shadow))
 	{
 	  Lisp_Object tem;
@@ -2252,6 +2254,19 @@
 	  if (!NILP (tem)) continue;
 	}
 
+      /* Ignore this definition if it is shadowed by an earlier
+	 one in the same keymap.  */
+      if (!NILP (entire_map))
+	{
+	  Lisp_Object tem;
+
+	  XVECTOR (kludge)->contents[0] = make_number (i);
+	  tem = Flookup_key (entire_map, kludge, Qt);
+
+	  if (! EQ (tem, definition))
+	    continue;
+	}
+
       if (first)
 	{
 	  insert ("\n", 1);
@@ -2272,7 +2287,7 @@
       /* Find all consecutive characters that have the same definition.  */
       while (i + 1 < XVECTOR (vector)->size
 	     && (tem2 = get_keyelt (XVECTOR (vector)->contents[i+1], 0),
-		 EQ (tem2, tem1)))
+		 EQ (tem2, definition)))
 	i++;
 
       /* If we have a range of more than one character,
@@ -2291,7 +2306,7 @@
       /* Print a description of the definition of this character.
 	 elt_describer will take care of spacing out far enough
 	 for alignment purposes.  */
-      (*elt_describer) (tem1);
+      (*elt_describer) (definition);
     }
 
   UNGCPRO;