From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Heime via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#65459: completing-read INITIAL-VALUE unaware of COLLECTION and REQUIRE-MATCH Date: Thu, 24 Aug 2023 09:02:06 +0000 Message-ID: References: <83jztmro8z.fsf@gnu.org> Reply-To: Heime Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39272"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , 65459@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Aug 24 11:03:17 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1qZ6FI-0009y2-TA for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 24 Aug 2023 11:03:17 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qZ6F3-0006fJ-0j; Thu, 24 Aug 2023 05:03:01 -0400 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 1qZ6F0-0006ex-8r for bug-gnu-emacs@gnu.org; Thu, 24 Aug 2023 05:02:58 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qZ6Ez-0005xs-W5 for bug-gnu-emacs@gnu.org; Thu, 24 Aug 2023 05:02:58 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qZ6F3-0004E8-RB for bug-gnu-emacs@gnu.org; Thu, 24 Aug 2023 05:03:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Heime Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 24 Aug 2023 09:03:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65459 X-GNU-PR-Package: emacs Original-Received: via spool by 65459-submit@debbugs.gnu.org id=B65459.169286774716188 (code B ref 65459); Thu, 24 Aug 2023 09:03:01 +0000 Original-Received: (at 65459) by debbugs.gnu.org; 24 Aug 2023 09:02:27 +0000 Original-Received: from localhost ([127.0.0.1]:36100 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qZ6EV-0004D2-05 for submit@debbugs.gnu.org; Thu, 24 Aug 2023 05:02:27 -0400 Original-Received: from mail-4318.protonmail.ch ([185.70.43.18]:45613) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qZ6ES-0004Cl-6e for 65459@debbugs.gnu.org; Thu, 24 Aug 2023 05:02:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1692867733; x=1693126933; bh=/EGO2aunxUWgvpzscMDdbXJVDIaUJUcyTd6Z8ucKBpo=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=K8dBsFkXbJ+0wDSSCKMtpD3HvSMHKzWeJNusI2de9qbAhMAXozZ+K7WVldtR++UH9 uDBf5OkyIHLUVRkcZNYV8z1yxkzgEKZSYwLYcrYQ/FfQiQAr3W5sEQLx7Be9GX8qLn WLFuxxqGj9MqvQ5IuJhBhKHfpOmGJvaKSBlRvKLWTmcHawqJJjrnuNpMP1W53UqNzp 0ofdKG6IDlmMUIEG6Rg9a3l4mzZykBVx36iz2VuMy4yfcTuwfXAgNlIPdzbPKC+LGF oXZ5oXTq3scEj0f9IWtIXaeoB0GDSqXCIiarSqo0+js83y4BG6kvmux6jEjTEhCcJV 6BS0yulUKH8dQ== In-Reply-To: Feedback-ID: 57735886:user:proton X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:268317 Archived-At: ------- Original Message ------- On Thursday, August 24th, 2023 at 9:27 AM, Stefan Monnier wrote: > > > The normal/recommended call looks like: > > >=20 > > > (let ((cseq '("alpha" "beta" "gamma" "delta" "epsilon" "zeta" "eta"))= ) > > > (completing-read (format-prompt "Grapheme" "alpha") > > > cseq nil t nil nil "alpha")) > > >=20 > > > [ Yes, it's a bit cumbersome: hysterical raisins :-( ] - Stefan > >=20 > > Correct. The solution involves an unwieldy parameter configurations, an= d possibly > > using convoluted workarounds to achieve the desired behavior. This scen= ario implies > > that using the function as intended requires a level of effort, underst= anding, and > > manipulation that goes beyond direct usage. >=20 >=20 > Agreed. That argues in favor of introducing a new function. But that > new function would be so similar to `completing-read` that it will lead > to users wondering when to use which or why there are two unless we mark > `completing-read` as obsolete, which would in turn cause a lot of > warnings in a lot of packages and code churn. >=20 > So, we've been hesitating to make this change for a while, not sure > which choice is least bad. >=20 > But at this point do you consider the behavior of >=20 > (let ((cseq '("alpha" "beta" "gamma" "delta" "epsilon" "zeta" "eta"))) > (completing-read (format-prompt "Grapheme" "alpha") > cseq nil t nil nil "alpha")) >=20 > to be a good solution for your original problem? It is not, because the intention is on prefilling the minibuffer with "alph= a" =20 rather than considering "alpha" as DEF. =20 It appears that the maintainers might not be prioritizing the initial inten= tion of prefilling the minibuffer. Currently, their emphasis seems to be on enc= ouraging=20 developers to either utilize the "DEF" approach or actively discourage the = use of=20 "INITIAL". But, I haven't come across a clear and well-founded reasoning b= ehind=20 these shifts in approach. Let just remember that COLLECTION might already have been defined somewhere= else according to some arrangement rule regarding the order of its entries. Rea= rranging the actual order of elements in collection just to fit the limited requirem= ents of completing-read is not to be considered good function design. Apart fro= m the=20 reality that rearranging the entries in COLLECTION might be difficult or ev= en impossible to achieve. The example I show is straightforward in that you c= an see=20 the entries and you can easily arrange them as you had suggested earlier with (let ((cseq '("epsilon" "zeta" "eta" "alpha" "beta" "gamma" "delta"))) (completing-read "Grapheme: " cseq nil t "alpha")) But this is only easily done only when collection is actually being constru= cted in-place via the 'let' clause. But once COLLECTION starts getting importe= d from somewhere else (via a call to same other function for instance), your = suggested solution is impossible to achieve.=20 =20 > [ BTW, to me the main benefit of a new function is that we could try > and make it so that the user can choose between a UI where the default > is not inserted in the initial minibuffer (as in the above code), or > one where it is (presumably pre-selected so you can delete it with > a simple DEL), as is common in many other applications. ] - Stefan I am neutral towards have two functions or a single one. One can be considered as enhancing the functionaity of the other, leaving the former for simpler use cases (and to conform in regards to backward=20 compatibility) - if sensible names can be made up such that no confusion=20 about their use can arise. =20 Failing that, one can have a single function, where the coder can clearly specify the way in which he wants it used. Currently the design is for completing-read to determine by itself the strategy it should use, without giving the coder actual control on how completing-read should behave when= =20 one is faced with certain implementational circumstances where workarounds are burdens to avoid rather than embrace. =20