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 20:22:45 +0000 Message-ID: <9K_-oO834AqSJEo_pqDrfj7Q1O1vcqy19pPVpFDuVl5tfCjWqlLa8cRgM16uDFBEt63VYEUkj7ueLAZ8XLrfsZAuRPLvU4Mx3von1r73fEE=@protonmail.com> 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="12642"; 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 22:24:06 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 1qZGsA-00032V-EP for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 24 Aug 2023 22:24:06 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qZGs5-000216-Do; Thu, 24 Aug 2023 16:24: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 1qZGs3-00020g-4D for bug-gnu-emacs@gnu.org; Thu, 24 Aug 2023 16:23:59 -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 1qZGs2-0002wW-SU for bug-gnu-emacs@gnu.org; Thu, 24 Aug 2023 16:23:58 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qZGs6-0000mY-Hq for bug-gnu-emacs@gnu.org; Thu, 24 Aug 2023 16:24:02 -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 20:24:02 +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.16929085922935 (code B ref 65459); Thu, 24 Aug 2023 20:24:02 +0000 Original-Received: (at 65459) by debbugs.gnu.org; 24 Aug 2023 20:23:12 +0000 Original-Received: from localhost ([127.0.0.1]:38687 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qZGrI-0000lG-8U for submit@debbugs.gnu.org; Thu, 24 Aug 2023 16:23:12 -0400 Original-Received: from mail-40137.protonmail.ch ([185.70.40.137]:42257) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qZGrG-0000kj-97 for 65459@debbugs.gnu.org; Thu, 24 Aug 2023 16:23:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1692908579; x=1693167779; bh=kDRa6QGgE2tdpQ2uu/8wT0UbyO7mcFQqp1PlLrsfS2U=; 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=M3toiusl/84+5gb+Wnp+aKckGDiL4FBEUxutGXUP0pl+8HaDsKCiPzuengE4q/cME Ea11IyYJelKhOfcQOhhLMcLTkIAa/xsU0VFJ9P+2xvBV1oT77M2D4FZ7m6zjJQfK/C TEDTT7HYJFpK1jFwZnla++JfzmkYY/9xa39k3e1rD5xYqoDuNlp1plYHzwQpcoD28X APKg8qUzTGF9UxbDJTQ/DKzAY2c9ZS4jrRievAmRFa3i9JGLVEWXa/kQfzmbx8b6Ni BQbw951gwFOqHsiAfjeXr0SeL+/7+/Lxpr/XI8MGJdqkOoix+Ahf6Ex2hQtx9OVh1I VtypiwHX25GUQ== 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:268356 Archived-At: ------- Original Message ------- On Friday, August 25th, 2023 at 7:35 AM, Stefan Monnier wrote: > > > My question is not about INITIAL-INPUT but about the behavior that th= e > > > 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 > > I was planning something like for 'read-file-name' where one can expect > > that the initial input will very likely be the part the user will end u= p > > typing, >=20 >=20 > You mean if the users will probably select "Chronological Dating", > you want to prefill the buffer so they don't need to type it and just > hit RET? Correct. =20 > Using the DEFault arg gives you the same benefit without prefilling the > minibuffer, so I must be missing something. What would be the advantage > for the users by prefilling the minibuffer with "Chronological Dating"? Yes, without prefilling the minibuffer. Prefilling the minibuffer is quick= er for users, giving them the possibility to see the current stage if they for= get=20 default key shortcuts. The more we discuss this the more it seems the pref= illing the minbuffer was something we never wanted users to have.=20 > > > So, IIUC, you have a `completing-read` call asking them which templat= e > > > 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 u= sed > > > to prefill the minibuffer entry and consecutive elements in simple > > > cycling continue through the next stages. >=20 >=20 > Yes, the ordering I'm talking about is the order in the operational > flow refined such that if the likely next stage is "Composition and > Provenance", then you'll want to use: >=20 > "Composition and Provenance" "Isotope Analysis" "Physical Analysis" "Chro= nological Dating" >=20 > That's what you want, right? Correct, but the actual collection might still be=20 "Physical_Analysis" "Chronological Dating" "Composition and Provenance" "Is= otope Analysis" Rather than applying modifications to it, I can just specify the start inde= x. =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 usin= g, but > > > users have the possibility to use a different UI such as the usual ma= nipulation > > > possibilities provided by completing read. >=20 >=20 > You mean, if they use, say, `icomplete-mode` or `vertico-mode`, you'd > prefer that those UIs use an alphabetical ordering rather than the one > based on operational flow? I would think that if they use vertico, there is a reason that is convenien= t to them to use cempletion, if they are not employing simple cycling (throug= h repeated use of ).=20 =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 'completin= g-read' > > > was a mistake. That completing-read should only be about completion. = And that > > > prefilling the minibuffer should involve a separate function call. >=20 >=20 > FWIW, I tend to agree and if(?) we introduce a new API I'd replace this > INITIAL-INPUT argument with a function which could then do what we > usually do via the `minibuffer-with-setup-hook` hack. - Stefan Quite right, and help programmers from the need to go as low level as=20 calling 'minibuffer-with-setup-hook' hacks. The unfortunate thing is that the inclusion of INITIAL makes people want to use it, as I did in certain= =20 circumstances. Having to go through 'minibuffer-with-setup-hook' hacks is not something one looks forward to do in the interactive clause of a=20 function.