diff src/fns.c @ 112139:8d03223bf479

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.
author Chong Yidong <cyd@stupidchicken.com>
date Fri, 07 Jan 2011 12:34:02 -0500
parents ac49e05bfcf2
children 6bac5e026755
line wrap: on
line diff
--- a/src/fns.c	Fri Jan 07 12:47:44 2011 +0200
+++ b/src/fns.c	Fri Jan 07 12:34:02 2011 -0500
@@ -2460,7 +2460,7 @@
 
 /* Anything that calls this function must protect from GC!  */
 
-DEFUN ("yes-or-no-p", Fyes_or_no_p, Syes_or_no_p, 1, 1, 0,
+DEFUN ("yes-or-no-p", Fyes_or_no_p, Syes_or_no_p, 1, MANY, 0,
        doc: /* Ask user a yes-or-no question.  Return t if answer is yes.
 Takes one argument, which is the string to display to ask the question.
 It should end in a space; `yes-or-no-p' adds `(yes or no) ' to it.
@@ -2469,13 +2469,11 @@
 
 Under a windowing system a dialog box will be used if `last-nonmenu-event'
 is nil, and `use-dialog-box' is non-nil.  */)
-  (Lisp_Object prompt)
+  (int nargs, Lisp_Object *args)
 {
   register Lisp_Object ans;
-  Lisp_Object args[2];
   struct gcpro gcpro1;
-
-  CHECK_STRING (prompt);
+  Lisp_Object prompt = Fformat (nargs, args);
 
 #ifdef HAVE_MENUS
   if (FRAME_WINDOW_P (SELECTED_FRAME ())
@@ -2496,10 +2494,7 @@
     }
 #endif /* HAVE_MENUS */
 
-  args[0] = prompt;
-  args[1] = build_string ("(yes or no) ");
-  prompt = Fconcat (2, args);
-
+  prompt = concat2 (prompt, build_string ("(yes or no) "));
   GCPRO1 (prompt);
 
   while (1)