aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman1993-03-15 06:00:04 +0000
committerRichard M. Stallman1993-03-15 06:00:04 +0000
commit24af387fb2eedffca32e5962d3e48cb5bf2c1ccf (patch)
tree6c77adefa68c33da7a11496814d229d8a577ec38 /src
parent70728a80cb7f0cf5ce5259f5e655113e4973fd07 (diff)
downloademacs-24af387fb2eedffca32e5962d3e48cb5bf2c1ccf.tar.gz
emacs-24af387fb2eedffca32e5962d3e48cb5bf2c1ccf.zip
(list_of_items): Allow strings among the alist items;
they make nonselectable lines. (single_keymap_panes): When storing in ENABLES, check def before enabled.
Diffstat (limited to 'src')
-rw-r--r--src/xmenu.c43
1 files changed, 22 insertions, 21 deletions
diff --git a/src/xmenu.c b/src/xmenu.c
index fde58fbf416..8c1f8a5ba24 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -101,10 +101,11 @@ the keymap as a top-level element.\n\n\
101You can also use a list of keymaps as MENU.\n\ 101You can also use a list of keymaps as MENU.\n\
102 Then each keymap makes a separate pane.\n\n\ 102 Then each keymap makes a separate pane.\n\n\
103Alternatively, you can specify a menu of multiple panes\n\ 103Alternatively, you can specify a menu of multiple panes\n\
104 with a list of the form\n\ 104 with a list of the form (TITLE PANE1 PANE2...),\n\
105\(TITLE PANE1 PANE2...), where each pane is a list of form\n\ 105where each pane is a list of form (TITLE ITEM1 ITEM2...).\n\
106\(TITLE (LINE ITEM)...). Each line should be a string, and item should\n\ 106Each ITEM is normally a cons cell (STRING . VALUE);\n\
107be the return value for that line (i.e. if it is selected).") 107but a string can appear as an item--that makes a nonselectable line\n\
108in the menu.")
108 (position, menu) 109 (position, menu)
109 Lisp_Object position, menu; 110 Lisp_Object position, menu;
110{ 111{
@@ -567,8 +568,7 @@ single_keymap_panes (keymap, panes, vector, names, enables, items,
567 /* The menu item "value" is the key bound here. */ 568 /* The menu item "value" is the key bound here. */
568 (*vector)[*p_ptr][i] = XCONS (item)->car; 569 (*vector)[*p_ptr][i] = XCONS (item)->car;
569 (*enables)[*p_ptr][i] 570 (*enables)[*p_ptr][i]
570 = (!NILP (enabled) ? 1 571 = (NILP (def) ? -1 : !NILP (enabled) ? 1 : 0);
571 : NILP (def) ? -1 : 0);
572 i++; 572 i++;
573 } 573 }
574 } 574 }
@@ -614,8 +614,7 @@ single_keymap_panes (keymap, panes, vector, names, enables, items,
614 /* The menu item "value" is the key bound here. */ 614 /* The menu item "value" is the key bound here. */
615 (*vector)[*p_ptr][i] = character; 615 (*vector)[*p_ptr][i] = character;
616 (*enables)[*p_ptr][i] 616 (*enables)[*p_ptr][i]
617 = (!NILP (enabled) ? 1 617 = (NILP (def) ? -1 : !NILP (enabled) ? 1 : 0);
618 : NILP (def) ? -1 : 0);
619 i++; 618 i++;
620 } 619 }
621 } 620 }
@@ -726,19 +725,21 @@ list_of_items (vector, names, enables, pane)
726 for (i = 0, tail = pane; !NILP (tail); tail = Fcdr (tail), i++) 725 for (i = 0, tail = pane; !NILP (tail); tail = Fcdr (tail), i++)
727 { 726 {
728 item = Fcar (tail); 727 item = Fcar (tail);
729 if (XTYPE (item) != Lisp_Cons) (void) wrong_type_argument (Qlistp, item); 728 if (STRINGP (item))
730#ifdef XDEBUG 729 {
731 fprintf (stderr, "list_of_items check tail, i=%d\n", i); 730 (*vector)[i] = Qnil;
732#endif 731 (*names)[i] = (char *) XSTRING (item)->data;
733 (*vector)[i] = Fcdr (item); 732 (*enables)[i] = -1;
734 item1 = Fcar (item); 733 }
735 CHECK_STRING (item1, 1); 734 else
736#ifdef XDEBUG 735 {
737 fprintf (stderr, "list_of_items check item, i=%d%s\n", i, 736 CHECK_CONS (item, 0);
738 XSTRING (item1)->data); 737 (*vector)[i] = Fcdr (item);
739#endif 738 item1 = Fcar (item);
740 (*names)[i] = (char *) XSTRING (item1)->data; 739 CHECK_STRING (item1, 1);
741 (*enables)[i] = 1; 740 (*names)[i] = (char *) XSTRING (item1)->data;
741 (*enables)[i] = 1;
742 }
742 } 743 }
743 return i; 744 return i;
744} 745}