From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stephen Berman Newsgroups: gmane.emacs.devel Subject: Re: Unexpected behavior of format-number with format-prompt Date: Thu, 07 Nov 2024 16:57:48 +0100 Message-ID: <87fro3ox37.fsf@gmx.net> References: <875xp0b00l.fsf@breatheoutbreathe.in> <86h68jqyut.fsf@gnu.org> <87jzdfp2zg.fsf@gmx.net> <86ses3p0c3.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="10005"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: joseph@breatheoutbreathe.in, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Nov 07 16:58:39 2024 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1t94u6-0002GK-P6 for ged-emacs-devel@m.gmane-mx.org; Thu, 07 Nov 2024 16:58:38 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t94tV-00071o-J2; Thu, 07 Nov 2024 10:58:01 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t94tT-00071F-Sp for emacs-devel@gnu.org; Thu, 07 Nov 2024 10:57:59 -0500 Original-Received: from mout.gmx.net ([212.227.15.18]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t94tR-0006gb-Vg; Thu, 07 Nov 2024 10:57:59 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.net; s=s31663417; t=1730995069; x=1731599869; i=stephen.berman@gmx.net; bh=KLJUGDHtclhSXoSgkg5YaFVIY7bsN3xvCX+2cTMATGU=; h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date: Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:cc: content-transfer-encoding:content-type:date:from:message-id: mime-version:reply-to:subject:to; b=HtLJiwDlSrA6y4lgj3Qxru+qcuk/6CDRs+QaUFViAvuJItRNQ+Yg+Dz2lYiZB6Ka 3/tqw8Zq5i1F4JG0LagHXTZNNiJ3/Btc9nUC8J1nZhxEAjZ7LqZrE+jq6Hq0/0BGn W33/In5hKFpp4bqQ9c4KKi1KW0B0u2VhltL1XfumIWgFaZLkps+NGCgXCsKBNiS9l Cq+uT+YPrYeTsmdofjs3f+JGX552tEHKYCTRYxPsdYg30NZlEE6KmpbVkkO5/sPMa Mk/M8O1VCh//QM8WO9+DE3h+64WOMcq7B2J8Ovz4MCS1qk9pL1R7ltaqGpBi+Uyhg 6MaJ0n/rkc5oi4tDFQ== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Original-Received: from strobelfssd ([94.134.94.224]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1N7iCW-1tvncF15Wc-013Spz; Thu, 07 Nov 2024 16:57:49 +0100 In-Reply-To: <86ses3p0c3.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 07 Nov 2024 16:47:40 +0200") X-Provags-ID: V03:K1:eCZ7c4gD0SxPN3fb/vP7/XcEze4cLC5I6ikVBfq+SLPQ6cQMGVy IkHG1c6ywnjcx21zEZwBKWXozDoP2/+iCMr+qurcq+Yov4Fugi6o0XPtvkkhMHCxZfo5N24 k4vtPlUMC6fD9M6a5bT49hr99amRjbKGXAbeT2Z2zBDVKdvMT7FkMTA04HKGDzYYtgxnMgb hmgG7gZlMhSaxaj05ko6A== UI-OutboundReport: notjunk:1;M01:P0:KyW4k8wmkX0=;z228CU1nhLrxbX2W7uupRd0Nmgj FIHCuW6N8yBViIR/iDEDmMqZtmTj0DHr7p2wvQIvyY1U8d45QjhLr0UdK8FLRZulV+bRn0T9Z gYJOcKjJlCNQfUxg1xoLZH/dOIuRoqWniaXKfqDATH3MtClY4bEKbJTihnJgU8XyPJxnCqWRb zcOmZ1vR9SwTzxeMmNfY3XYPDi2rY0Qypk6w3b82h6JTEmjyu9V3ok6Lw+ah4cfGRa5oy5CGc HqE6nsBkAsnb+Yt4S7il/cF6aAsCglxEbLcB0tx16rgOoso/RRkdW8mit3/jiO1YScmyqyqEP Atr6FMJjmbWegOvdDdj9eq9JHV0Ea+ra8/mlJpB/eQ924wRXf6Gs+gnso+xPBnDED3eIjuUA8 XlgQDQ+BhKE8OqmKuEmwa1UB5wboifbHKA7zAKFivmfunJpWCuXYqhE01fzoncEiuNCCI6b2U Exc8vY1NH8QHQMguH1XoY3/MAtc0EOqiEIL2ER5cMnj9apghzuVN/ERtRrm9trIV17TKqkMJ7 3t1bp+vvve5YSbJxwvZ/1ECFUIDoBvjLLl46K3KeFU+0x7SnGxx30d2Vn/MHSN6TTudCahkHQ 0wZMsMq1DmfoTUcWDjNafOPNCfLCI2QI27xwr8+34BowZOsSo5HVKD4qAQb3n7Ujf/11FUNBg lFj2RqEH3iVsQqVAxNGvqJg/tVURFlq4GA2K4KSizMbxjIAmRhqWtBluib51gjWkHp5ME7fsQ VLs4n/Jexs3W+jXm3OXpdAcMU86B6Z3hXCC+8SUi+38xTAlUmFz0VBQNcRypZ1jeB1CkMo4b Received-SPF: pass client-ip=212.227.15.18; envelope-from=stephen.berman@gmx.net; helo=mout.gmx.net X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:325231 Archived-At: On Thu, 07 Nov 2024 16:47:40 +0200 Eli Zaretskii wrote: >> From: Stephen Berman >> Cc: Joseph Turner , 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. I= t >> > 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