all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#63399: 28.2; Documentation for yes-or-no-p wrong/different between docstring and lispref
@ 2023-05-09 20:35 Tim Landscheidt
  2023-05-10 10:08 ` Michael Albinus
  2023-05-10 13:48 ` Eli Zaretskii
  0 siblings, 2 replies; 14+ messages in thread
From: Tim Landscheidt @ 2023-05-09 20:35 UTC (permalink / raw)
  To: 63399

The documentation for yes-or-no-p in Emacs 28.2 reads:

| yes-or-no-p is a built-in function in ‘C source code’.

| (yes-or-no-p PROMPT)

| 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; ‘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.

| […]

This is wrong: (yes-or-no-p "Prompt? ") gives the prompt
"Prompt? (yes or no) ", but according to the docstring it
should be "Prompt?(yes or no) ".

With the big caveat that I have never looked deeper at
Emacs's C code, the source in src/fns.c does not appear to
change the prompt given as an argument in any way, but just
append yes-or-no-prompt to it.

Also, (elisp) Yes-or-No Queries reads (since 7f53446a10ea;
doc/lispref/minibuf.texi):

| […]

|      Here is an example:

|           (yes-or-no-p "Do you really want to remove everything?")

|           ;; After evaluation of the preceding expression,
|           ;;   the following prompt appears,
|           ;;   with an empty minibuffer:

|           ---------- Buffer: minibuffer ----------
|           Do you really want to remove everything? (yes or no)
|           ---------- Buffer: minibuffer ----------

| […]

This is not the actual result: (yes-or-no-p "Do you really
want to remove everything?") gives the prompt "Do you really
want to remove everything?(yes or no) ", i. e., the space
before the parenthesis is missing.

Finally, the behaviour is different when using
use-short-answers:

| (yes-or-no-p "Prompt?")

gives "Prompt?(yes or no) ", while:

| (let ((use-short-answers t)) (yes-or-no-p "Prompt?"))

gives "Prompt? (y or n) ".





^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2023-05-12 10:49 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-09 20:35 bug#63399: 28.2; Documentation for yes-or-no-p wrong/different between docstring and lispref Tim Landscheidt
2023-05-10 10:08 ` Michael Albinus
2023-05-10 14:05   ` Eli Zaretskii
2023-05-10 14:07     ` Michael Albinus
2023-05-10 14:42       ` Eli Zaretskii
2023-05-10 14:57         ` Michael Albinus
2023-05-10 15:44           ` Eli Zaretskii
2023-05-10 16:04             ` Tim Landscheidt
2023-05-10 16:44               ` Eli Zaretskii
2023-05-10 16:57                 ` Michael Albinus
2023-05-10 16:55             ` Michael Albinus
2023-05-12 10:49             ` Michael Albinus
2023-05-10 13:48 ` Eli Zaretskii
2023-05-10 14:05   ` Michael Albinus

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.