aboutsummaryrefslogtreecommitdiffstats
path: root/src/fns.c
diff options
context:
space:
mode:
authorChong Yidong2011-01-07 12:34:02 -0500
committerChong Yidong2011-01-07 12:34:02 -0500
commit8c51d2a2c2dcae4e54a7e5aa7543a3ecb8d7d886 (patch)
tree46b8e5d3a0becbf28e17c17ed3ae58208585dd3c /src/fns.c
parent3162010355ae4934296cf3e4e7fcd20197e9887a (diff)
downloademacs-8c51d2a2c2dcae4e54a7e5aa7543a3ecb8d7d886.tar.gz
emacs-8c51d2a2c2dcae4e54a7e5aa7543a3ecb8d7d886.zip
Allow format args for y-or-n-p and yes-or-no-p.
* lisp/subr.el (y-or-n-p): Accept format string args. * src/fns.c (Fyes_or_no_p): Accept format string args.
Diffstat (limited to 'src/fns.c')
-rw-r--r--src/fns.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/src/fns.c b/src/fns.c
index 8d54b73586f..3282b300f49 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -2460,7 +2460,7 @@ do_yes_or_no_p (Lisp_Object prompt)
2460 2460
2461/* Anything that calls this function must protect from GC! */ 2461/* Anything that calls this function must protect from GC! */
2462 2462
2463DEFUN ("yes-or-no-p", Fyes_or_no_p, Syes_or_no_p, 1, 1, 0, 2463DEFUN ("yes-or-no-p", Fyes_or_no_p, Syes_or_no_p, 1, MANY, 0,
2464 doc: /* Ask user a yes-or-no question. Return t if answer is yes. 2464 doc: /* Ask user a yes-or-no question. Return t if answer is yes.
2465Takes one argument, which is the string to display to ask the question. 2465Takes one argument, which is the string to display to ask the question.
2466It should end in a space; `yes-or-no-p' adds `(yes or no) ' to it. 2466It should end in a space; `yes-or-no-p' adds `(yes or no) ' to it.
@@ -2469,13 +2469,11 @@ and can edit it until it has been confirmed.
2469 2469
2470Under a windowing system a dialog box will be used if `last-nonmenu-event' 2470Under a windowing system a dialog box will be used if `last-nonmenu-event'
2471is nil, and `use-dialog-box' is non-nil. */) 2471is nil, and `use-dialog-box' is non-nil. */)
2472 (Lisp_Object prompt) 2472 (int nargs, Lisp_Object *args)
2473{ 2473{
2474 register Lisp_Object ans; 2474 register Lisp_Object ans;
2475 Lisp_Object args[2];
2476 struct gcpro gcpro1; 2475 struct gcpro gcpro1;
2477 2476 Lisp_Object prompt = Fformat (nargs, args);
2478 CHECK_STRING (prompt);
2479 2477
2480#ifdef HAVE_MENUS 2478#ifdef HAVE_MENUS
2481 if (FRAME_WINDOW_P (SELECTED_FRAME ()) 2479 if (FRAME_WINDOW_P (SELECTED_FRAME ())
@@ -2496,10 +2494,7 @@ is nil, and `use-dialog-box' is non-nil. */)
2496 } 2494 }
2497#endif /* HAVE_MENUS */ 2495#endif /* HAVE_MENUS */
2498 2496
2499 args[0] = prompt; 2497 prompt = concat2 (prompt, build_string ("(yes or no) "));
2500 args[1] = build_string ("(yes or no) ");
2501 prompt = Fconcat (2, args);
2502
2503 GCPRO1 (prompt); 2498 GCPRO1 (prompt);
2504 2499
2505 while (1) 2500 while (1)