aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman1998-05-12 21:33:59 +0000
committerRichard M. Stallman1998-05-12 21:33:59 +0000
commitfd3613d785a1858928f5f40afd4041f2792689d4 (patch)
treea31c36c6b0b904272b5e6b18f2438e08b517af5a /src
parentbb1584c878678ba2949c4c65087404b12671a36c (diff)
downloademacs-fd3613d785a1858928f5f40afd4041f2792689d4.tar.gz
emacs-fd3613d785a1858928f5f40afd4041f2792689d4.zip
(parse_menu_item): Argument inmenubar < 0 now means
parsing a keyboard menu item. (read_char_minibuf_menu_prompt): Use `parse_menu_item' to understand new menu item format.
Diffstat (limited to 'src')
-rw-r--r--src/keyboard.c39
1 files changed, 31 insertions, 8 deletions
diff --git a/src/keyboard.c b/src/keyboard.c
index dd7c7bf922a..a154776891c 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -5625,8 +5625,9 @@ menu_item_eval_property (sexpr)
5625 ITEM is a key binding, a possible menu item. 5625 ITEM is a key binding, a possible menu item.
5626 If NOTREAL is nonzero, only check for equivalent key bindings, don't 5626 If NOTREAL is nonzero, only check for equivalent key bindings, don't
5627 evaluate dynamic expressions in the menu item. 5627 evaluate dynamic expressions in the menu item.
5628 INMENUBAR is true when this is considered for an entry in a menu bar 5628 INMENUBAR is > 0 when this is considered for an entry in a menu bar
5629 top level. 5629 top level.
5630 INMENUBAR is < 0 when this is considered for an entry in a keyboard menu.
5630 parse_menu_item returns true if the item is a menu item and false 5631 parse_menu_item returns true if the item is a menu item and false
5631 otherwise. */ 5632 otherwise. */
5632 5633
@@ -6175,7 +6176,7 @@ read_char_minibuf_menu_prompt (commandflag, nmaps, maps)
6175 /* Loop over elements of map. */ 6176 /* Loop over elements of map. */
6176 while (i < width) 6177 while (i < width)
6177 { 6178 {
6178 Lisp_Object s, elt; 6179 Lisp_Object elt;
6179 6180
6180 /* If reached end of map, start at beginning of next map. */ 6181 /* If reached end of map, start at beginning of next map. */
6181 if (NILP (rest)) 6182 if (NILP (rest))
@@ -6208,26 +6209,27 @@ read_char_minibuf_menu_prompt (commandflag, nmaps, maps)
6208 else 6209 else
6209 { 6210 {
6210 /* An ordinary element. */ 6211 /* An ordinary element. */
6211 Lisp_Object event; 6212 Lisp_Object event, tem;
6212 6213
6213 if (idx < 0) 6214 if (idx < 0)
6214 { 6215 {
6215 s = Fcar_safe (Fcdr_safe (elt)); /* alist */ 6216 event = Fcar_safe (elt); /* alist */
6216 event = Fcar_safe (elt); 6217 elt = Fcdr_safe (elt);
6217 } 6218 }
6218 else 6219 else
6219 { 6220 {
6220 s = Fcar_safe (elt); /* vector */ 6221 XSETINT (event, idx); /* vector */
6221 XSETINT (event, idx);
6222 } 6222 }
6223 6223
6224 /* Ignore the element if it has no prompt string. */ 6224 /* Ignore the element if it has no prompt string. */
6225 if (STRINGP (s) && INTEGERP (event)) 6225 if (INTEGERP (event) && parse_menu_item (elt, 0, -1))
6226 { 6226 {
6227 /* 1 if the char to type matches the string. */ 6227 /* 1 if the char to type matches the string. */
6228 int char_matches; 6228 int char_matches;
6229 Lisp_Object upcased_event, downcased_event; 6229 Lisp_Object upcased_event, downcased_event;
6230 Lisp_Object desc; 6230 Lisp_Object desc;
6231 Lisp_Object s
6232 = XVECTOR (item_properties)->contents[ITEM_PROPERTY_NAME];
6231 6233
6232 upcased_event = Fupcase (event); 6234 upcased_event = Fupcase (event);
6233 downcased_event = Fdowncase (event); 6235 downcased_event = Fdowncase (event);
@@ -6236,6 +6238,27 @@ read_char_minibuf_menu_prompt (commandflag, nmaps, maps)
6236 if (! char_matches) 6238 if (! char_matches)
6237 desc = Fsingle_key_description (event); 6239 desc = Fsingle_key_description (event);
6238 6240
6241 tem
6242 = XVECTOR (item_properties)->contents[ITEM_PROPERTY_KEYEQ];
6243 if (!NILP (tem))
6244 /* Insert equivalent keybinding. */
6245 s = concat2 (s, tem);
6246
6247 tem
6248 = XVECTOR (item_properties)->contents[ITEM_PROPERTY_TYPE];
6249 if (EQ (tem, QCradio) || EQ (tem, QCtoggle))
6250 {
6251 /* Insert button prefix. */
6252 Lisp_Object selected
6253 = XVECTOR (item_properties)->contents[ITEM_PROPERTY_SELECTED];
6254 if (EQ (tem, QCradio))
6255 tem = build_string (NILP (selected) ? "(*) " : "( ) ");
6256 else
6257 tem = build_string (NILP (selected) ? "[X] " : "[ ] ");
6258 s = concat2 (tem, s);
6259 }
6260
6261
6239 /* If we have room for the prompt string, add it to this line. 6262 /* If we have room for the prompt string, add it to this line.
6240 If this is the first on the line, always add it. */ 6263 If this is the first on the line, always add it. */
6241 if ((XSTRING (s)->size + i + 2 6264 if ((XSTRING (s)->size + i + 2