diff options
| author | Richard M. Stallman | 1994-02-24 08:02:10 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1994-02-24 08:02:10 +0000 |
| commit | 1db4cfb25b6fce489973a0a50d1d4c8de37c09d2 (patch) | |
| tree | 76be1bd7d7e1386a10ca0b24ed5d3c05d11c88ff /src | |
| parent | 411acee307d5a03930257fef23a0291fb9535544 (diff) | |
| download | emacs-1db4cfb25b6fce489973a0a50d1d4c8de37c09d2.tar.gz emacs-1db4cfb25b6fce489973a0a50d1d4c8de37c09d2.zip | |
(Fy_or_n_p): Use a popup menu if reached via mouse command.
(Fyes_or_no_p): Likewise.
Diffstat (limited to 'src')
| -rw-r--r-- | src/fns.c | 47 |
1 files changed, 41 insertions, 6 deletions
| @@ -1125,13 +1125,27 @@ Also accepts Space to mean yes, or Delete to mean no.") | |||
| 1125 | 1125 | ||
| 1126 | while (1) | 1126 | while (1) |
| 1127 | { | 1127 | { |
| 1128 | cursor_in_echo_area = 1; | 1128 | if (NILP (last_nonmenu_event) || CONSP (last_nonmenu_event)) |
| 1129 | message ("%s(y or n) ", XSTRING (xprompt)->data); | 1129 | { |
| 1130 | Lisp_Object pane, menu; | ||
| 1131 | pane = Fcons (Fcons (build_string ("Yes"), Qt), | ||
| 1132 | Fcons (Fcons (build_string ("No"), Qnil), | ||
| 1133 | Qnil)); | ||
| 1134 | menu = Fcons (prompt, Fcons (Fcons (prompt, pane), Qnil)); | ||
| 1135 | obj = Fx_popup_menu (Qt, menu); | ||
| 1136 | answer = !NILP (obj); | ||
| 1137 | break; | ||
| 1138 | } | ||
| 1139 | else | ||
| 1140 | { | ||
| 1141 | cursor_in_echo_area = 1; | ||
| 1142 | message ("%s(y or n) ", XSTRING (xprompt)->data); | ||
| 1130 | 1143 | ||
| 1131 | obj = read_filtered_event (1, 0, 0); | 1144 | obj = read_filtered_event (1, 0, 0); |
| 1132 | cursor_in_echo_area = 0; | 1145 | cursor_in_echo_area = 0; |
| 1133 | /* If we need to quit, quit with cursor_in_echo_area = 0. */ | 1146 | /* If we need to quit, quit with cursor_in_echo_area = 0. */ |
| 1134 | QUIT; | 1147 | QUIT; |
| 1148 | } | ||
| 1135 | 1149 | ||
| 1136 | key = Fmake_vector (make_number (1), obj); | 1150 | key = Fmake_vector (make_number (1), obj); |
| 1137 | def = Flookup_key (map, key); | 1151 | def = Flookup_key (map, key); |
| @@ -1209,14 +1223,35 @@ and can edit it until it as been confirmed.") | |||
| 1209 | register Lisp_Object ans; | 1223 | register Lisp_Object ans; |
| 1210 | Lisp_Object args[2]; | 1224 | Lisp_Object args[2]; |
| 1211 | struct gcpro gcpro1; | 1225 | struct gcpro gcpro1; |
| 1226 | Lisp_Object menu; | ||
| 1212 | 1227 | ||
| 1213 | CHECK_STRING (prompt, 0); | 1228 | CHECK_STRING (prompt, 0); |
| 1214 | 1229 | ||
| 1230 | if (NILP (last_nonmenu_event) || CONSP (last_nonmenu_event)) | ||
| 1231 | { | ||
| 1232 | Lisp_Object pane, menu, obj; | ||
| 1233 | pane = Fcons (Fcons (build_string ("Yes"), Qt), | ||
| 1234 | Fcons (Fcons (build_string ("No"), Qnil), | ||
| 1235 | Qnil)); | ||
| 1236 | GCPRO1 (pane); | ||
| 1237 | menu = Fcons (prompt, Fcons (Fcons (prompt, pane), Qnil)); | ||
| 1238 | obj = Fx_popup_menu (Qt, menu); | ||
| 1239 | if (!NILP (obj)) | ||
| 1240 | { | ||
| 1241 | prompt = build_string ("Confirm"); | ||
| 1242 | menu = Fcons (prompt, Fcons (Fcons (prompt, pane), Qnil)); | ||
| 1243 | obj = Fx_popup_menu (Qt, menu); | ||
| 1244 | } | ||
| 1245 | UNGCPRO; | ||
| 1246 | return obj; | ||
| 1247 | } | ||
| 1248 | |||
| 1215 | args[0] = prompt; | 1249 | args[0] = prompt; |
| 1216 | args[1] = build_string ("(yes or no) "); | 1250 | args[1] = build_string ("(yes or no) "); |
| 1217 | prompt = Fconcat (2, args); | 1251 | prompt = Fconcat (2, args); |
| 1218 | 1252 | ||
| 1219 | GCPRO1 (prompt); | 1253 | GCPRO1 (prompt); |
| 1254 | |||
| 1220 | while (1) | 1255 | while (1) |
| 1221 | { | 1256 | { |
| 1222 | ans = Fdowncase (Fread_from_minibuffer (prompt, Qnil, Qnil, Qnil, | 1257 | ans = Fdowncase (Fread_from_minibuffer (prompt, Qnil, Qnil, Qnil, |