Mercurial > emacs
changeset 6057:b2cc63a56415
(Fy_or_n_p): Use a popup menu if reached via mouse command.
(Fyes_or_no_p): Likewise.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Thu, 24 Feb 1994 08:02:10 +0000 |
parents | afa75a0c15f8 |
children | 662b9cd767fe |
files | src/fns.c |
diffstat | 1 files changed, 41 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/fns.c Thu Feb 24 06:22:50 1994 +0000 +++ b/src/fns.c Thu Feb 24 08:02:10 1994 +0000 @@ -1125,13 +1125,27 @@ while (1) { - cursor_in_echo_area = 1; - message ("%s(y or n) ", XSTRING (xprompt)->data); + if (NILP (last_nonmenu_event) || CONSP (last_nonmenu_event)) + { + Lisp_Object pane, menu; + pane = Fcons (Fcons (build_string ("Yes"), Qt), + Fcons (Fcons (build_string ("No"), Qnil), + Qnil)); + menu = Fcons (prompt, Fcons (Fcons (prompt, pane), Qnil)); + obj = Fx_popup_menu (Qt, menu); + answer = !NILP (obj); + break; + } + else + { + cursor_in_echo_area = 1; + message ("%s(y or n) ", XSTRING (xprompt)->data); - obj = read_filtered_event (1, 0, 0); - cursor_in_echo_area = 0; - /* If we need to quit, quit with cursor_in_echo_area = 0. */ - QUIT; + obj = read_filtered_event (1, 0, 0); + cursor_in_echo_area = 0; + /* If we need to quit, quit with cursor_in_echo_area = 0. */ + QUIT; + } key = Fmake_vector (make_number (1), obj); def = Flookup_key (map, key); @@ -1209,14 +1223,35 @@ register Lisp_Object ans; Lisp_Object args[2]; struct gcpro gcpro1; + Lisp_Object menu; CHECK_STRING (prompt, 0); + if (NILP (last_nonmenu_event) || CONSP (last_nonmenu_event)) + { + Lisp_Object pane, menu, obj; + pane = Fcons (Fcons (build_string ("Yes"), Qt), + Fcons (Fcons (build_string ("No"), Qnil), + Qnil)); + GCPRO1 (pane); + menu = Fcons (prompt, Fcons (Fcons (prompt, pane), Qnil)); + obj = Fx_popup_menu (Qt, menu); + if (!NILP (obj)) + { + prompt = build_string ("Confirm"); + menu = Fcons (prompt, Fcons (Fcons (prompt, pane), Qnil)); + obj = Fx_popup_menu (Qt, menu); + } + UNGCPRO; + return obj; + } + args[0] = prompt; args[1] = build_string ("(yes or no) "); prompt = Fconcat (2, args); GCPRO1 (prompt); + while (1) { ans = Fdowncase (Fread_from_minibuffer (prompt, Qnil, Qnil, Qnil,