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 18:50:44 +0000 Message-ID: References: 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="28713"; 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 20:52:23 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 1qZFRO-0007D9-7i for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 24 Aug 2023 20:52:22 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qZFR4-00065Z-3T; Thu, 24 Aug 2023 14:52:02 -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 1qZFR0-00064j-IY for bug-gnu-emacs@gnu.org; Thu, 24 Aug 2023 14:51: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 1qZFR0-0002B5-3v for bug-gnu-emacs@gnu.org; Thu, 24 Aug 2023 14:51:58 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qZFR3-0006q8-SD for bug-gnu-emacs@gnu.org; Thu, 24 Aug 2023 14:52: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 18:52: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.169290307726233 (code B ref 65459); Thu, 24 Aug 2023 18:52:01 +0000 Original-Received: (at 65459) by debbugs.gnu.org; 24 Aug 2023 18:51:17 +0000 Original-Received: from localhost ([127.0.0.1]:38645 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qZFQK-0006p3-In for submit@debbugs.gnu.org; Thu, 24 Aug 2023 14:51:17 -0400 Original-Received: from mail-4325.protonmail.ch ([185.70.43.25]:64025) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qZFQH-0006oo-Uj for 65459@debbugs.gnu.org; Thu, 24 Aug 2023 14:51:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1692903062; x=1693162262; bh=h97iZOKnYwDHhhhLH/95G5QpvI7s+dB6ZSEQ9xakQF8=; 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=vVP22Miu4pefWElHAKvGitKTWg0VKacGydOjZSOPuzZzl8tH836P0DXAicxriTIe9 a3BwMhZhzyFXtmW1FNOoMfsOt8DdJeZyzhaRAdLOM2cs2VuwVt6wI/uJbQIIKuPByt eSLp7gXLmFJcUdu5VyZV6SnRmxkhiCIY35kJ6ROaziNaY5kSX/Y3AGqIZr+PaWRbvW Di+jiQYOW8zjKuLTDmLEL2v2LoXhM6QMUxWHSR5frtedYEKuKjR5aWh29sIkyadOB8 NxcKY7vP72XY3dItpVT+YNx5HzihgFusVqxQpLkjdm86F1v0eNHQnREaxOiHoJN4Pd naubNR/Rezamg== 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:268352 Archived-At: Sent with Proton Mail secure email. ------- Original Message ------- On Friday, August 25th, 2023 at 4:45 AM, Stefan Monnier via "Bug reports fo= r GNU Emacs, the Swiss army knife of text editors" = wrote: > > > > It is not, because the intention is on prefilling the minibuffer wi= th > > > > "alpha" rather than considering "alpha" as DEF. > > >=20 > > > Could you explain why this is important in your case? > >=20 > > There purpose of INITIAL has always been about prefilling the minibuffe= r. > > No other 'completing-read' functionality can do such a thing. DEF has > > always served a different purpose. For some reason that I cannot unders= tand, > > most of the communications I have try to persuade me to set INITIAL to = nil. > > INITIAL had a purpose, which under certain circumstances has implicatio= ns > > to the way COLLECTION is constructed and used. Rather than fixing the > > difficulties for certain cases, the answer has always been the same, pu= t > > INITIAL to nil and just don't use it, and use DEF if you want. Even tho= ugh > > Default Settings and Minibuffer Prefilling result in two completely dis= tinct > > behaviours. >=20 >=20 > My question is not about INITIAL-INPUT but about the behavior that the > user sees: why do you want the users of your code to see a minibuffer > that is prefilled rather than one whose content is initially empty? >=20 > That question is not rhetorical. There can be many different perfectly > valid answers. Depending on that answer, the best way to code it can be > quite different, tho. I was planning something like for 'read-file-name' where one can expect=20 that the initial input will very likely be the part the user will end up typing, otherwise they can quickly do a simple cycling to see the possibili= ties. =20 > > > That's partly why I've asked about a concrete example showing the wid= er > > > context :-) - Stefan > >=20 > > I am working on an Emacs org library for archeological investigations w= here > > field practitioners can insert specific org templates detailing the pro= gress > > of excavations and finds. Each phase is categorised. > >=20 > > For instance > >=20 > > "Physical Analysis" "Chronological Dating" "Composition and Provenance"= "Isotope Analysis" > >=20 > > And there exists a certain order. It would be difficult to change > > that order on-the-fly just to make 'completing-read' happy. With each > > exists specific templates that practitioners can introduce and > > elaborate. Once certain aspects are completed, the previous > > categorisations would be skipped, because they would no longer be > > relevant. What gets shown is then directed towards improving > > productivity, particularly when tight deadlines are imposed. >=20 > So, IIUC, you have a `completing-read` call asking them which template > to insert, and you want to order the set of completions based on > knowledge of the stage at which they are? No ordering actually happens, a particular element in collection is used to prefill the minibuffer entry and consecutive elements in simple=20 cycling continue through the next stages. The ordering in=20 "Physical Analysis" "Chronological Dating" "Composition and Provenance" "Is= otope Analysis" is an order in the operational flow, and it would not be possible to apply = any alphabetical type of sorting. =20 > I suspect you'll want to use a COLLECTION that explicitly asks to not be > (re)sorted and which you "manually" re-order before the call, so that > the sort order you choose is obeyed not just by this specific cycling > you're using but also for users who rely on different UIs. Actually, tho order is only obeyed for the specific cycling I am using, but users have the possibility to use a different UI such as the usual manipula= tion possibilities provided by completing read. =20 > I don't see any part there that explains why the minibuffer needs to be > prefilled, but that is usually handled separately from the > completions anyway. - Stefan Then my conclusion is that the introduction of INITIAL for 'completing-read= ' was a mistake. That completing-read should only be about completion. And = that prefilling the minibuffer should involve a separate function call. >From my interactions, it seems evident that we cannot get rid of INITIAL ei= ther, and we are stuck with it. And the reason for discouraging its use. I am n= ot sure whether simple cycling and completion should be provided by a single functi= on,=20 although the capability of managing both would be very powerful.