[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Unexpected behavior of format-number with format-prompt
From: |
Stephen Berman |
Subject: |
Re: Unexpected behavior of format-number with format-prompt |
Date: |
Thu, 07 Nov 2024 16:57:48 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
On Thu, 07 Nov 2024 16:47:40 +0200 Eli Zaretskii <eliz@gnu.org> wrote:
>> From: Stephen Berman <stephen.berman@gmx.net>
>> Cc: Joseph Turner <joseph@breatheoutbreathe.in>, emacs-devel@gnu.org
>> Date: Thu, 07 Nov 2024 14:50:27 +0100
>>
>> > More to the point: we cannot possibly change the behavior of
>> > read-number in such a backward-incompatible way. Especially since
>> > this behavior is old, and explicitly called out in the doc string. It
>> > is perhaps unfortunate that read-number behaves differently in this
>> > manner, but I'm afraid we will have to live with this.
>>
>> Maybe something like the attached patch is acceptable? With it,
>> evaluating each of the following prompts with "Enter (default 42): "
>>
>> (read-number "Enter: " 42)
>> (read-number (format-prompt "Enter" 42))
>> (read-number (format-prompt "Enter" 42) 42)
>
> This assumes that using the same format as
> minibuffer-default-prompt-format necessarily means that format-prompt
> is being used. I'm not sure we can rely on that, it's too ad-hoc.
The patch itself does not assume format-prompt but only checks whether
the prompt uses minibuffer-default-prompt-format (which format-prompt
does); the following also prompt with "Enter (default 42): ":
(read-number (concat "Enter"
(format minibuffer-default-prompt-format 42)
": "))
(read-number (concat "Enter:"
(format minibuffer-default-prompt-format 42)
": ")
42)
So the reference to format-prompt in the comment I added is misleading
and should be either removed or revised, e.g.: "If PROMPT uses
`minibuffer-default-prompt-format' (as e.g. with `format-prompt'), don't
duplicate DEFAULT in the prompt string."
Steve Berman
- Re: Unexpected behavior of format-number with format-prompt, (continued)
- Re: Unexpected behavior of format-number with format-prompt, Eli Zaretskii, 2024/11/07
- Re: Unexpected behavior of format-number with format-prompt, Joseph Turner, 2024/11/07
- Re: Unexpected behavior of format-number with format-prompt, Eli Zaretskii, 2024/11/07
- Re: Unexpected behavior of format-number with format-prompt, Joseph Turner, 2024/11/10
- Re: Unexpected behavior of format-number with format-prompt, Eli Zaretskii, 2024/11/14
- Re: Unexpected behavior of format-number with format-prompt, Joseph Turner, 2024/11/15
- Re: Unexpected behavior of format-number with format-prompt, Eli Zaretskii, 2024/11/15
- Re: Unexpected behavior of format-number with format-prompt, Joseph Turner, 2024/11/16
Re: Unexpected behavior of format-number with format-prompt, Stephen Berman, 2024/11/07
- Re: Unexpected behavior of format-number with format-prompt, Eli Zaretskii, 2024/11/07
- Re: Unexpected behavior of format-number with format-prompt,
Stephen Berman <=
- Re: Unexpected behavior of format-number with format-prompt, Joseph Turner, 2024/11/09
- Re: Unexpected behavior of format-number with format-prompt, Stephen Berman, 2024/11/09
- Re: Unexpected behavior of format-number with format-prompt, Joseph Turner, 2024/11/10
- Re: Unexpected behavior of format-number with format-prompt, Stephen Berman, 2024/11/10
Re: Unexpected behavior of format-number with format-prompt, Eli Zaretskii, 2024/11/10
Re: Unexpected behavior of format-number with format-prompt, Stephen Berman, 2024/11/10