emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 7f53446: Doc fix for y-or-n-p; trailing space is no longer needed


From: Stefan Kangas
Subject: master 7f53446: Doc fix for y-or-n-p; trailing space is no longer needed
Date: Thu, 16 Sep 2021 03:38:53 -0400 (EDT)

branch: master
commit 7f53446a10eaf029f73e637bba3c9c6bf7c33111
Author: Stefan Kangas <stefan@marxist.se>
Commit: Stefan Kangas <stefan@marxist.se>

    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 d54c654..281e987 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 12ddaf0..658f742 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 0b20c10..1611b98 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 28bee11..eac5f08 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 f22801c..17c42ce 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -4085,6 +4085,11 @@ The special events 'dbus-event' and 'file-notify' are 
now ignored in
 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',
 Emacs constructs the nondirectory part of the auto-save file name by
diff --git a/lisp/subr.el b/lisp/subr.el
index be13fc0..b80d1c2 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 c39fce2..4e74589 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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]