From: Michael Albinus <michael.albinus@gmx.de>
To: Tim Landscheidt <tim@tim-landscheidt.de>
Cc: 63399@debbugs.gnu.org
Subject: bug#63399: 28.2; Documentation for yes-or-no-p wrong/different between docstring and lispref
Date: Wed, 10 May 2023 12:08:24 +0200 [thread overview]
Message-ID: <87r0rozeg7.fsf@gmx.de> (raw)
In-Reply-To: <874jolxmyf.fsf@vagabond.tim-landscheidt.de> (Tim Landscheidt's message of "Tue, 09 May 2023 20:35:20 +0000")
[-- Attachment #1: Type: text/plain, Size: 1304 bytes --]
Tim Landscheidt <tim@tim-landscheidt.de> writes:
Hi,
> 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.
I guess we should pad the prompt with a trailing space, if there isn't
any already. As we do in `y-or-no-p'. What about the appended patch?
Documentation must be updated as well, of course.
Best regards, Michael.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 768 bytes --]
diff --git a/src/fns.c b/src/fns.c
index bb6efdda655..b081cb225e1 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -26,6 +26,7 @@ Copyright (C) 1985-2023 Free Software Foundation, Inc.
#include <intprops.h>
#include <vla.h>
#include <errno.h>
+#include <ctype.h>
#include "lisp.h"
#include "bignum.h"
@@ -3234,6 +3235,12 @@ DEFUN ("yes-or-no-p", Fyes_or_no_p, Syes_or_no_p, 1, 1, 0,
if (use_short_answers)
return call1 (intern ("y-or-n-p"), prompt);
+ {
+ char *s = SSDATA (prompt);
+ ptrdiff_t len = strlen (s);
+ if (!(len == 0) && !(isspace (s[len - 1])))
+ prompt = CALLN (Fconcat, prompt, make_string (" ", 1));
+ }
prompt = CALLN (Fconcat, prompt, Vyes_or_no_prompt);
specpdl_ref count = SPECPDL_INDEX ();
next prev parent reply other threads:[~2023-05-10 10:08 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87r0rozeg7.fsf@gmx.de \
--to=michael.albinus@gmx.de \
--cc=63399@debbugs.gnu.org \
--cc=tim@tim-landscheidt.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.