diff options
| author | Eli Zaretskii | 2023-05-12 14:07:29 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2023-05-12 14:07:29 +0300 |
| commit | e535494491cb6266260e5adcbcbc9b7cd76cab2f (patch) | |
| tree | 39736c347fc23cfbccd80bede0680b724f73e8e8 | |
| parent | 0b39e4daee4383d9e535148a973e0d5701125ada (diff) | |
| parent | cbb59267c757b747c48a2690f96073614e8b4fd4 (diff) | |
| download | emacs-e535494491cb6266260e5adcbcbc9b7cd76cab2f.tar.gz emacs-e535494491cb6266260e5adcbcbc9b7cd76cab2f.zip | |
Merge branch 'master' of git.savannah.gnu.org:/srv/git/emacs
| -rw-r--r-- | doc/lispref/minibuf.texi | 6 | ||||
| -rw-r--r-- | lisp/subr.el | 4 | ||||
| -rw-r--r-- | src/fns.c | 11 |
3 files changed, 19 insertions, 2 deletions
diff --git a/doc/lispref/minibuf.texi b/doc/lispref/minibuf.texi index 5d59387fb1f..ff12808762f 100644 --- a/doc/lispref/minibuf.texi +++ b/doc/lispref/minibuf.texi | |||
| @@ -2200,6 +2200,9 @@ the expected answers (@kbd{y}, @kbd{n}, @kbd{@key{SPC}}, | |||
| 2200 | @kbd{@key{DEL}}, or something that quits), the function responds | 2200 | @kbd{@key{DEL}}, or something that quits), the function responds |
| 2201 | @samp{Please answer y or n.}, and repeats the request. | 2201 | @samp{Please answer y or n.}, and repeats the request. |
| 2202 | 2202 | ||
| 2203 | If @var{prompt} is a non-empty string, and it ends with a non-space | ||
| 2204 | character, a @samp{SPC} character will be appended to it. | ||
| 2205 | |||
| 2203 | This function actually uses the minibuffer, but does not allow editing | 2206 | This function actually uses the minibuffer, but does not allow editing |
| 2204 | of the answer. The cursor moves to the minibuffer while the question | 2207 | of the answer. The cursor moves to the minibuffer while the question |
| 2205 | is being asked. | 2208 | is being asked. |
| @@ -2240,6 +2243,9 @@ minibuffer, followed by the value of @code{yes-or-no-prompt} @w{(default | |||
| 2240 | responses; otherwise, the function responds @w{@samp{Please answer yes or | 2243 | responses; otherwise, the function responds @w{@samp{Please answer yes or |
| 2241 | no.}}, waits about two seconds and repeats the request. | 2244 | no.}}, waits about two seconds and repeats the request. |
| 2242 | 2245 | ||
| 2246 | If @var{prompt} is a non-empty string, and it ends with a non-space | ||
| 2247 | character, a @samp{SPC} character will be appended to it. | ||
| 2248 | |||
| 2243 | @code{yes-or-no-p} requires more work from the user than | 2249 | @code{yes-or-no-p} requires more work from the user than |
| 2244 | @code{y-or-n-p} and is appropriate for more crucial decisions. | 2250 | @code{y-or-n-p} and is appropriate for more crucial decisions. |
| 2245 | 2251 | ||
diff --git a/lisp/subr.el b/lisp/subr.el index 0501fc67a3e..a52abb38772 100644 --- a/lisp/subr.el +++ b/lisp/subr.el | |||
| @@ -3590,7 +3590,9 @@ confusing to some users.") | |||
| 3590 | Return t if answer is \"y\" and nil if it is \"n\". | 3590 | Return t if answer is \"y\" and nil if it is \"n\". |
| 3591 | 3591 | ||
| 3592 | PROMPT is the string to display to ask the question; `y-or-n-p' | 3592 | PROMPT is the string to display to ask the question; `y-or-n-p' |
| 3593 | adds \"(y or n) \" to it. | 3593 | adds \"(y or n) \" to it. If PROMPT is a non-empty string, and |
| 3594 | it ends with a non-space character, a space character will be | ||
| 3595 | appended to it. | ||
| 3594 | 3596 | ||
| 3595 | If you bind the variable `help-form' to a non-nil value | 3597 | If you bind the variable `help-form' to a non-nil value |
| 3596 | while calling this function, then pressing `help-char' | 3598 | while calling this function, then pressing `help-char' |
| @@ -26,6 +26,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ | |||
| 26 | #include <intprops.h> | 26 | #include <intprops.h> |
| 27 | #include <vla.h> | 27 | #include <vla.h> |
| 28 | #include <errno.h> | 28 | #include <errno.h> |
| 29 | #include <ctype.h> | ||
| 29 | 30 | ||
| 30 | #include "lisp.h" | 31 | #include "lisp.h" |
| 31 | #include "bignum.h" | 32 | #include "bignum.h" |
| @@ -3202,7 +3203,9 @@ DEFUN ("yes-or-no-p", Fyes_or_no_p, Syes_or_no_p, 1, 1, 0, | |||
| 3202 | Return t if answer is yes, and nil if the answer is no. | 3203 | Return t if answer is yes, and nil if the answer is no. |
| 3203 | 3204 | ||
| 3204 | PROMPT is the string to display to ask the question; `yes-or-no-p' | 3205 | PROMPT is the string to display to ask the question; `yes-or-no-p' |
| 3205 | appends `yes-or-no-prompt' (default \"(yes or no) \") to it. | 3206 | appends `yes-or-no-prompt' (default \"(yes or no) \") to it. If |
| 3207 | PROMPT is a non-empty string, and it ends with a non-space character, | ||
| 3208 | a space character will be appended to it. | ||
| 3206 | 3209 | ||
| 3207 | The user must confirm the answer with RET, and can edit it until it | 3210 | The user must confirm the answer with RET, and can edit it until it |
| 3208 | has been confirmed. | 3211 | has been confirmed. |
| @@ -3234,6 +3237,12 @@ if `last-nonmenu-event' is nil, and `use-dialog-box' is non-nil. */) | |||
| 3234 | if (use_short_answers) | 3237 | if (use_short_answers) |
| 3235 | return call1 (intern ("y-or-n-p"), prompt); | 3238 | return call1 (intern ("y-or-n-p"), prompt); |
| 3236 | 3239 | ||
| 3240 | { | ||
| 3241 | char *s = SSDATA (prompt); | ||
| 3242 | ptrdiff_t len = strlen (s); | ||
| 3243 | if ((len > 0) && !isspace (s[len - 1])) | ||
| 3244 | prompt = CALLN (Fconcat, prompt, build_string (" ")); | ||
| 3245 | } | ||
| 3237 | prompt = CALLN (Fconcat, prompt, Vyes_or_no_prompt); | 3246 | prompt = CALLN (Fconcat, prompt, Vyes_or_no_prompt); |
| 3238 | 3247 | ||
| 3239 | specpdl_ref count = SPECPDL_INDEX (); | 3248 | specpdl_ref count = SPECPDL_INDEX (); |