emacs-devel
[Top][All Lists]
Advanced

[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: Sun, 10 Nov 2024 11:37:30 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

On Sat, 09 Nov 2024 19:55:31 -0800 Joseph Turner <joseph@breatheoutbreathe.in> 
wrote:

> On November 9, 2024 1:51:24 PM PST, Stephen Berman <stephen.berman@gmx.net> 
> wrote:
>>In all uses of format-prompt I checked in the Emacs sources, the same
>>value is passed to the DEFAULT argument of both format-prompt and its
>>caller (e.g. read-string).  Do you have a realistic use case
>>(i.e. discounting willfully misleading or mischievous programming) in
>>mind where this is not so?  I couldn't find or come up with one, but
>>maybe I missed it or didn't think hard enough.
>>
>>> [ Also /s/string-match/string-match-p ]
>>
>>I just followed the current code in `read-number', which already uses
>>`string-match'.  Perhaps that should be changed regardless of my patch?
>
> I think so.

Be my guest :-)

>>> I think we're better off documenting the idiosyncrasy in the
>>> `read-number' docstring as Eli suggested.
>>
>>That's certainly the path of least risk, though I can't think of a
>>plausible use where my patch would result in duplication in the prompt
>>string.
>
> The patch works if you specify the prompt with format-prompt, but if you try
> to roll your own prompt like (read-number (format "Type number (DEFAULT %s): "
> default) default) then confusingly there's duplication.
>
> Maybe you want to display the default number in a different base in the 
> prompt.
>
> Maybe you want the prompt to be user-defined.
>
> My desire is for simplicity.

I thought the motivation of your OP was a more uniform implementation of
the *-read-* functions' prompt using format-patch; that's also a kind of
simplicity, no?

> However if the maintainers approve it, I'm happy to see it included and 
> documented.

I think that ship won't sail :-)

> In any case, I appreciate your thinking :)

Thanks.

> Cheers,
>
> Joseph

Steve Berman



reply via email to

[Prev in Thread] Current Thread [Next in Thread]