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: Joseph Turner
Subject: Re: Unexpected behavior of format-number with format-prompt
Date: Sat, 09 Nov 2024 19:55:31 -0800


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.

>> 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.

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

In any case, I appreciate your thinking :)

Cheers,

Joseph



reply via email to

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