summaryrefslogtreecommitdiff
path: root/src/fns.c
diff options
context:
space:
mode:
authorChong Yidong <cyd@stupidchicken.com>2011-01-07 12:34:02 -0500
committerChong Yidong <cyd@stupidchicken.com>2011-01-07 12:34:02 -0500
commit8c51d2a2c2dcae4e54a7e5aa7543a3ecb8d7d886 (patch)
tree46b8e5d3a0becbf28e17c17ed3ae58208585dd3c /src/fns.c
parent3162010355ae4934296cf3e4e7fcd20197e9887a (diff)
downloademacs-8c51d2a2c2dcae4e54a7e5aa7543a3ecb8d7d886.tar.gz
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)
/* 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 @@ and can edit it until it has been confirmed.
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 @@ is nil, and `use-dialog-box' is non-nil. */)
}
#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)