diff src/xmenu.c @ 1213:0901fe62d97b

(single_keymap_panes): Handle vectors properly.
author Richard M. Stallman <rms@gnu.org>
date Fri, 25 Sep 1992 23:23:17 +0000
parents 3640e799d5fc
children 93d55019750e
line wrap: on
line diff
--- a/src/xmenu.c	Thu Sep 24 07:23:59 1992 +0000
+++ b/src/xmenu.c	Fri Sep 25 23:23:17 1992 +0000
@@ -468,17 +468,10 @@
   /* Get the length of the list level of the keymap.  */
   i = XFASTINT (Flength (keymap));
 
-#if 0
-  /* If the keymap has a dense table, put it in TABLE,
-     and leave only the list level in KEYMAP.
-     Include the length of the dense table in I.  */
-  table = keymap_table (keymap);
-  if (!NILP (table))
-    {
-      i += XFASTINT (Flength (table));
-      keymap = XCONS (XCONS (keymap)->cdr)->cdr;
-    }
-#endif
+  /* Add in lengths of any arrays.  */
+  for (tail = keymap; XTYPE (tail) == Lisp_Cons; tail = XCONS (tail)->cdr)
+    if (XTYPE (XCONS (tail)->car) == Lisp_Vector)
+      i += XVECTOR (XCONS (tail)->car)->size;
 
   /* Create vectors for the names and values of the items in the pane.
      I is an upper bound for the number of items.  */
@@ -515,6 +508,37 @@
 		}
 	    }
 	}
+      else if (XTYPE (item) == Lisp_Vector)
+	{
+	  /* Loop over the char values represented in the vector.  */
+	  int len = XVECTOR (item)->size;
+	  int c;
+	  for (c = 0; c < len; c++)
+	    {
+	      Lisp_Object character;
+	      XFASTINT (character) = c;
+	      item1 = XVECTOR (item)->contents[c];
+	      if (XTYPE (item1) == Lisp_Cons)
+		{
+		  item2 = XCONS (item1)->car;
+		  if (XTYPE (item2) == Lisp_String)
+		    {
+		      Lisp_Object tem;
+		      tem = Fkeymapp (Fcdr (item1));
+		      if (XSTRING (item2)->data[0] == '@' && !NILP (tem))
+			pending_maps = Fcons (Fcons (Fcdr (item1), item2),
+					      pending_maps);
+		      else
+			{
+			  (*names)[*p_ptr][i] = (char *) XSTRING (item2)->data;
+			  /* The menu item "value" is the key bound here.  */
+			  (*vector)[*p_ptr][i] = character;
+			  i++;
+			}
+		    }
+		}
+	    }
+	}
     }
   /* Record the number of items in the pane.  */
   (*items)[*p_ptr] = i;