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 21:45:13 +0000 Message-ID: References: <9K_-oO834AqSJEo_pqDrfj7Q1O1vcqy19pPVpFDuVl5tfCjWqlLa8cRgM16uDFBEt63VYEUkj7ueLAZ8XLrfsZAuRPLvU4Mx3von1r73fEE=@protonmail.com> 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="24317"; 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 23:46:25 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 1qZI9o-00062J-Gz for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 24 Aug 2023 23:46:24 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qZI9Q-0004HB-Sd; Thu, 24 Aug 2023 17:46:00 -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 1qZI9O-0004Fb-SA for bug-gnu-emacs@gnu.org; Thu, 24 Aug 2023 17:45: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 1qZI9O-0000lE-K6 for bug-gnu-emacs@gnu.org; Thu, 24 Aug 2023 17:45:58 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qZI9S-0005gi-Ol for bug-gnu-emacs@gnu.org; Thu, 24 Aug 2023 17:46: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 21:46: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.169291354921833 (code B ref 65459); Thu, 24 Aug 2023 21:46:02 +0000 Original-Received: (at 65459) by debbugs.gnu.org; 24 Aug 2023 21:45:49 +0000 Original-Received: from localhost ([127.0.0.1]:38780 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qZI9E-0005g4-PR for submit@debbugs.gnu.org; Thu, 24 Aug 2023 17:45:49 -0400 Original-Received: from mail-40135.protonmail.ch ([185.70.40.135]:42861) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qZI9C-0005fm-Aw for 65459@debbugs.gnu.org; Thu, 24 Aug 2023 17:45:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1692913535; x=1693172735; bh=7wOQIS2u5Q8JJ4S/eoJ24kwaZ3ET4sWL4Lt1a4N3Bko=; 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=AIx5k7VL1YTV94Ni/p9Qk8SkWK2nF9Ti5VKxxww/4mR2m2ed4v2Im3zu8hh2tbFhs soHnhg6LGRu7HY38vwhZsXSMiEd1KBTm09H2aFO1B6QuQwT7DUkhf0wzN9H7rNRSsu 6PKZcgBbvOOtbtJSMjTqsXHG15ddw8XwIGLCEXfFBVE7stV1f78skF3DHOVxVj7KzM KrTpJ5mNFoixaPY4G0qD3BH3YxZ87+IDGrI1gXEatd8wtarV8Ec6+SJXb5uxbQ655m QMSvDLZTs50OmBOosqWzArmO/evNt7+H8wRvZ0PmsckB/V1zmVSMnuzSFVa17tCTvP UsoDmDsTbu5Ug== 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:268368 Archived-At: Sent with Proton Mail secure email. ------- Original Message ------- On Friday, August 25th, 2023 at 9:02 AM, Stefan Monnier wrote: > > > Using the DEFault arg gives you the same benefit without prefilling t= he > > > minibuffer, so I must be missing something. What would be the advanta= ge > > > for the users by prefilling the minibuffer with "Chronological Dating= "? > > > Yes, without prefilling the minibuffer. Prefilling the minibuffer is > > > quicker for users, giving them the possibility to see the current > > > stage if they forget default key shortcuts. >=20 >=20 > The `format-prompt` thingy in my example code is there to show to the > users what the default will be. >=20 > > The more we discuss this the more it seems the prefilling > > the minbuffer was something we never wanted users to have. >=20 >=20 > Indeed, it was never intended for regular use. It's only meant to be > used in specific cases like `read-file-name` where we do have something > to prefill that is almost always useful. >=20 > [ You used the term "dogma" earlier, but I like to think of Emacs > design as being rather undogmatic in that we go through a lot of > trouble to allow people to do even those things that we don't want > them to do. ] >=20 > > > > > So, IIUC, you have a `completing-read` call asking them which tem= plate > > > > > 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 simpl= e > > > > > cycling continue through the next stages. > > >=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" "= Chronological Dating" > > >=20 > > > That's what you want, right? > >=20 > > Correct, but the actual collection might still be > >=20 > > "Physical_Analysis" "Chronological Dating" "Composition and Provenance"= "Isotope Analysis" > >=20 > > Rather than applying modifications to it, I can just specify the start = index. >=20 >=20 > That's an implementation detail. >=20 > E.g. you can use >=20 > (defconst my-phases > '("Physical_Analysis" "Chronological Dating" "Composition and Provenance"= "Isotope Analysis")) >=20 > (defun my-rotate (collection first) > (let ((x (member first collection))) > (if (not x) collection > (let ((idx (- (length collection) (length x)))) > (append x (seq-take collection idx)))))) >=20 > [...] > (let ((next-phase (my-guess-next-phase))) > (completing-read (format-prompt "Phase" next-phase) > (my-rotate my-phases next-phase) > nil t nil nil next-phase)) > [...] >=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 on= e > > > based on operational flow? > >=20 > > I would think that if they use vertico, there is a reason that is conve= nient > > to them to use cempletion, if they are not employing simple cycling (th= rough > > repeated use of ). >=20 >=20 > Both `icomplete-mode` and `vertico-mode` offer/encourage the use of > cycling (but their cycling code is completely different from the one > you're using so it doesn't obey `next-history-element`), so I expect > their users would also appreciate if the ordering of the completions is > chosen with the same care as what you do for the > `next-line-or-history-element` case. >=20 > > Quite right, and help programmers from the need to go as low level as > > calling 'minibuffer-with-setup-hook' hacks. The unfortunate thing is th= at > > the inclusion of INITIAL makes people want to use it, as I did in certa= in > > circumstances. Having to go through 'minibuffer-with-setup-hook' hacks > > is not something one looks forward to do in the interactive clause of a > > function. >=20 >=20 > +1 >=20 > I guess we really should work on a replacement for `completing-read`, eh?= - Stefan If we want to surpass the present conundrum, the path in clear. completing= -read has evolved through incremental changes without considering the long-term implications.= And we continue to accumulate additional parameters, flags, and branches to accommodate new= functionalities.=20 This has led to a serious lack of cohesion and a convoluted structure. Mak= ing it difficult to discern its primary purpose. I have concluded that its evolution today = requires it acquire dependencies on other parts of its codebase. Instead, we have started chan= ging the documentation to discourage this usage, that usage, and so on. For short-term one can ac= cept it, but robust design is needed for long-term usage. =20 FREDDY - Ahl. Would you mind telling me whose brain I put in? IGOR - And you won't be angry? FREDDY - I won't be angry. IGOR - Abbey someone. FREDDY - Abbey?? Abbey who? IGOR - Abbey normal. FREDDY - ABBEYNORMAL??? IGOR - I'm almost sure that was the name. FREDDY grabbing Igor's throat I put -- an abnormal brain -- into a seven-and-a-half foot long, fourty-four inch wide GORILLA?