From 7f53446a10eaf029f73e637bba3c9c6bf7c33111 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Thu, 16 Sep 2021 09:23:51 +0200 Subject: [PATCH] Doc fix for y-or-n-p; trailing space is no longer needed * doc/lispref/minibuf.texi (Yes-or-No Queries): * doc/lispref/os.texi (Suspending Emacs): * doc/lispref/tips.texi (Programming Tips): * doc/misc/gnus-faq.texi (FAQ 5-9): * lisp/subr.el (y-or-n-p): * src/fns.c (Fyes_or_no_p): Doc fix to reflect that a trailing space is no longer needed; one is added or removed automatically. --- doc/lispref/minibuf.texi | 2 +- doc/lispref/os.texi | 2 +- doc/lispref/tips.texi | 2 +- doc/misc/gnus-faq.texi | 2 +- etc/NEWS | 5 +++++ lisp/subr.el | 6 ++++-- src/fns.c | 6 ++++-- 7 files changed, 17 insertions(+), 8 deletions(-) diff --git a/doc/lispref/minibuf.texi b/doc/lispref/minibuf.texi index d54c654562f..281e987e7f1 100644 --- a/doc/lispref/minibuf.texi +++ b/doc/lispref/minibuf.texi @@ -2209,7 +2209,7 @@ Here is an example: @smallexample @group -(yes-or-no-p "Do you really want to remove everything? ") +(yes-or-no-p "Do you really want to remove everything?") ;; @r{After evaluation of the preceding expression,} ;; @r{the following prompt appears,} diff --git a/doc/lispref/os.texi b/doc/lispref/os.texi index 12ddaf04b6a..658f742c418 100644 --- a/doc/lispref/os.texi +++ b/doc/lispref/os.texi @@ -813,7 +813,7 @@ Here is an example of how you could use these hooks: @smallexample @group (add-hook 'suspend-hook - (lambda () (or (y-or-n-p "Really suspend? ") + (lambda () (or (y-or-n-p "Really suspend?") (error "Suspend canceled")))) @end group (add-hook 'suspend-resume-hook (lambda () (message "Resumed!") diff --git a/doc/lispref/tips.texi b/doc/lispref/tips.texi index 0b20c107bba..1611b983ea2 100644 --- a/doc/lispref/tips.texi +++ b/doc/lispref/tips.texi @@ -398,7 +398,7 @@ with a period. @item A question asked in the minibuffer with @code{yes-or-no-p} or @code{y-or-n-p} should start with a capital letter and end with -@samp{? }. +@samp{?}. @item When you mention a default value in a minibuffer prompt, diff --git a/doc/misc/gnus-faq.texi b/doc/misc/gnus-faq.texi index 28bee11d2bd..eac5f0861ff 100644 --- a/doc/misc/gnus-faq.texi +++ b/doc/misc/gnus-faq.texi @@ -1559,7 +1559,7 @@ if you already use Gnus 5.10, if you still use 5.8.8 or "Request confirmation when replying to news." (interactive) (when (or (not (gnus-news-group-p gnus-newsgroup-name)) - (y-or-n-p "Really reply by mail to article author? ")) + (y-or-n-p "Really reply by mail to article author?")) ad-do-it)))) @end example @noindent diff --git a/etc/NEWS b/etc/NEWS index f22801cfbef..17c42ce104d 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -4084,6 +4084,11 @@ The special events 'dbus-event' and 'file-notify' are now ignored in ** 'start-process-shell-command' and 'start-file-process-shell-command' do not support the old calling conventions any longer. ++++ +** 'yes-or-no-p' and 'y-or-n-p' PROMPT parameter no longer needs trailing space. +This has been the case since Emacs 24.4 but was not announced or +documented until now. + +++ ** The 'uniquify' argument in 'auto-save-file-name-transforms' can be a symbol. If this symbol is one of the members of 'secure-hash-algorithms', diff --git a/lisp/subr.el b/lisp/subr.el index be13fc0d653..b80d1c28385 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -3204,8 +3204,10 @@ character. This is not possible when using `read-key', but using (defun y-or-n-p (prompt) "Ask user a \"y or n\" question. Return t if answer is \"y\" and nil if it is \"n\". -PROMPT is the string to display to ask the question. It should -end in a space; `y-or-n-p' adds \"(y or n) \" to it. + +PROMPT is the string to display to ask the question; `y-or-n-p' +adds \" (y or n) \" to it. It does not need to end in space, but +if it does up to one space will be removed. If you bind the variable `help-form' to a non-nil value while calling this function, then pressing `help-char' diff --git a/src/fns.c b/src/fns.c index c39fce21c70..4e74589ef26 100644 --- a/src/fns.c +++ b/src/fns.c @@ -2950,8 +2950,10 @@ do_yes_or_no_p (Lisp_Object prompt) DEFUN ("yes-or-no-p", Fyes_or_no_p, Syes_or_no_p, 1, 1, 0, doc: /* Ask user a yes-or-no question. Return t if answer is yes, and nil if the answer is no. -PROMPT 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. + +PROMPT is the string to display to ask the question; `yes-or-no-p' +adds \"(yes or no) \" to it. It does not need to end in space, but if +it does up to one space will be removed. The user must confirm the answer with RET, and can edit it until it has been confirmed. -- 2.39.5