GNU bug report logs -
#63399
28.2; Documentation for yes-or-no-p wrong/different between docstring and lispref
Previous Next
Reported by: Tim Landscheidt <tim <at> tim-landscheidt.de>
Date: Tue, 9 May 2023 20:36:02 UTC
Severity: minor
Found in version 28.2
Fixed in version 30.1
Done: Michael Albinus <michael.albinus <at> gmx.de>
Bug is archived. No further changes may be made.
Full log
Message #11 received at 63399 <at> debbugs.gnu.org (full text, mbox):
> From: Tim Landscheidt <tim <at> tim-landscheidt.de>
> Date: Tue, 09 May 2023 20:35:20 +0000
>
> 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) ".
The doc string in Emacs 29 no longer includes the above confusing and
inaccurate text about removing the space. So I think this
documentation bug was already fixed.
> 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.
I've now fixed the example to be consistent with the result.
> 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) ".
You are supposed to include the trailing blank if you want to ensure
there's a blank between the prompt and the "(y or n)" part.
I think we should close this bug now.
This bug report was last modified 2 years and 11 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.