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: Wed, 23 Aug 2023 16:39:52 +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="922"; 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 Wed Aug 23 18:43:08 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 1qYqwl-000AZ3-SV for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 23 Aug 2023 18:43:07 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qYqwK-0004o3-KN; Wed, 23 Aug 2023 12:42:40 -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 1qYquj-0002Ve-R8 for bug-gnu-emacs@gnu.org; Wed, 23 Aug 2023 12:41:01 -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 1qYquj-0004D1-Ig for bug-gnu-emacs@gnu.org; Wed, 23 Aug 2023 12:41:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qYqun-0000uo-1B for bug-gnu-emacs@gnu.org; Wed, 23 Aug 2023 12:41:05 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Heime Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 23 Aug 2023 16:41:04 +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.16928088283314 (code B ref 65459); Wed, 23 Aug 2023 16:41:04 +0000 Original-Received: (at 65459) by debbugs.gnu.org; 23 Aug 2023 16:40:28 +0000 Original-Received: from localhost ([127.0.0.1]:34983 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qYqu9-0000rE-Ps for submit@debbugs.gnu.org; Wed, 23 Aug 2023 12:40:28 -0400 Original-Received: from mail-4325.protonmail.ch ([185.70.43.25]:45627) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qYqu5-0000qr-F7 for 65459@debbugs.gnu.org; Wed, 23 Aug 2023 12:40:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1692808811; x=1693068011; bh=z96a5ip/dto3umT51lqm+ND1/iogpO3wrYWDPfwFnT0=; 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=c0tKPJVpKz1bg5GNEe+Egsg/aWSsmZxQjPqU1fLk3D2NFK1VwRWTl6zEm1iR+FpFN qKGzb5JSP5JWEF9JQgVYsIzC5TT2vhJ5Nk+6WCA9M1Q0KidYMmW85E3MHa4AIXYwy9 J7QZiF9LNX12lntxYZrWgcxIkvVg2vxCzyPWzSIPz4kXMVr4R7vdu7zpxORPLT/I9N saS1UPW7Szwf/E6iY8fO4mw+myP6Jwb26gcAxuPJJ+x6HsPBX5+1tKufL34xr+dkBA xSqigolASsDIAibbTtaYgkxB8dlQnEk9aM3lCHR95boiowTBirJa754QTiwzT/IoCF 7955AXr7oUtSQ== 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:268258 Archived-At: ------- Original Message ------- On Thursday, August 24th, 2023 at 4:05 AM, Stefan Monnier wrote: > > Then, repeatedly hit . You get > >=20 > > alpha alpha beta gamma delta epsilon zeta eta alpha beta gamma and-so-o= n >=20 > Ah, OK, yes, that sounds like a problem (one I've heard before). > I think it's a problem in the cycling code rather than in INITIAL-VALUE > or COLLECTION. E.g. the same problem occurs if the initial input is > empty and the user types `alpha C-n`. That has been my assessment as well. It is not a problem of INITIAL-VALUE, but a problem in the cycling mechanism. =20 > > You do actually get that the consecutive entries appearing in the > > minibuffer have direct correspondence to the order found in COLLECTION. >=20 > For that form of cycling, apparently so, yes. I don't categorize it as > "completion" so I haven't looked very closely at that code :-) > There are other ways to do cycling which use a different ordering. Correct, it is not categorised as completion. =20 > The cycling through completions via `next-line-or-history-element` is > not very configurable, AFAICT. >=20 > > Once INITIAL is inserted, I cannot instruct completing-read to continue > > sequentially starting from a particular element. >=20 > Indeed. >=20 > > For instance, I cannot get the following result when using simple cycli= ng > > through collection options when repeatedly hitting the key. > >=20 > > To achieve > >=20 > > alpha epsilon zeta eta alpha beta gamma delta epsilon and-so-on >=20 > Could you give a bit more context about why/where you'd want to do that > so I can better imagine how to attack the problem? >=20 > Hopefully it would explain why you want "alpha epsilon ..." first but > "alpha beta .." later.=20 In such instance one considers collection as a cyclic list for the case of= =20 simple cycling. But with possibility of starting from a particular index. > Also for such uses of `completing-read` we usually recommend against a=20 > non-nil value for INITIAL-INPUT, so that context should try to explain=20 > why you use "alpha" as INITIAL-INPUT. - Stefan Because using INITIAL is the only way available to pre-insert a value in=20 the minibuffer. Hence, if I want a pre-insertion candidate for the first element in collect= ion I get 'alpha' repeated twice. First from the insertion via INITIAL, and th= en=20 again through the simple cycling of collection (that starts from 'alpha'). = =20 If one can instruct the starting position in collection and subsequently co= nsider collection as a cyclic list, the problem of ending with the following is so= lved. alpha alpha beta gamma delta epsilon zeta eta alpha and-so-on which means INITIAL COLLECTION(0) COLLECTION(1) and-so-on. -------- Starting from entry 1 of collection, you would get alpha beta gamma delta epsilon zeta eta alpha and-so-on which means INITIAL COLLECTION(1) COLLECTION(2) and-so-on -------- And in general INITIAL COLLECTION(i) COLLECTION(i+1) ... COLLECTION(0) COLLECTION(1) and-s= o-on