all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stephen Berman <stephen.berman@gmx.net>
To: Joseph Turner <joseph@breatheoutbreathe.in>
Cc: Eli Zaretskii <eliz@gnu.org>,  emacs-devel@gnu.org
Subject: Re: Unexpected behavior of format-number with format-prompt
Date: Sun, 10 Nov 2024 11:37:30 +0100	[thread overview]
Message-ID: <87bjynv0gl.fsf@gmx.net> (raw)
In-Reply-To: <DBE77F28-639D-447B-8410-975FF501CE6B@breatheoutbreathe.in> (Joseph Turner's message of "Sat, 09 Nov 2024 19:55:31 -0800")

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	other threads:[~2024-11-10 10:37 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-06 20:06 Unexpected behavior of format-number with format-prompt Joseph Turner
2024-11-07  7:36 ` Eli Zaretskii
2024-11-07  7:44   ` Joseph Turner
2024-11-07  7:57     ` Eli Zaretskii
2024-11-09 19:18       ` Joseph Turner
2024-11-14  8:29         ` Eli Zaretskii
2024-11-07 13:50   ` Stephen Berman
2024-11-07 14:47     ` Eli Zaretskii
2024-11-07 15:57       ` Stephen Berman
2024-11-09 19:02         ` Joseph Turner
2024-11-09 21:51           ` Stephen Berman
2024-11-10  3:55             ` Joseph Turner
2024-11-10 10:37               ` Stephen Berman [this message]
2024-11-10  5:46             ` Eli Zaretskii
2024-11-10 10:40               ` Stephen Berman

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=87bjynv0gl.fsf@gmx.net \
    --to=stephen.berman@gmx.net \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=joseph@breatheoutbreathe.in \
    /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.