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 18:12:22 +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="26080"; 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 20:13:32 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 1qYsMG-0006YV-99 for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 23 Aug 2023 20:13:32 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qYsLx-0006mz-Rl; Wed, 23 Aug 2023 14:13:13 -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 1qYsLj-0006mf-Ew for bug-gnu-emacs@gnu.org; Wed, 23 Aug 2023 14:13:00 -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 1qYsLi-0005Q6-W7 for bug-gnu-emacs@gnu.org; Wed, 23 Aug 2023 14:12:59 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qYsLm-0003el-7n for bug-gnu-emacs@gnu.org; Wed, 23 Aug 2023 14:13:02 -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 18:13: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.169281437014033 (code B ref 65459); Wed, 23 Aug 2023 18:13:02 +0000 Original-Received: (at 65459) by debbugs.gnu.org; 23 Aug 2023 18:12:50 +0000 Original-Received: from localhost ([127.0.0.1]:35147 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qYsLZ-0003eH-OV for submit@debbugs.gnu.org; Wed, 23 Aug 2023 14:12:50 -0400 Original-Received: from mail-40130.protonmail.ch ([185.70.40.130]:29753) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qYsLX-0003e1-1c for 65459@debbugs.gnu.org; Wed, 23 Aug 2023 14:12:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1692814357; x=1693073557; bh=vk+mNUF8nSTIaGXQpk/EKK8ZoWTmD0pigHJP55RcNNc=; 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=uTkdqfaoo2R07F+2KO5GvyPAQf7jTxBZHm379cS/Och7VSKMDwB+E3VXpI4Ed6TeH 2l0dIfFC5Tn6Xc40DvVrvaovg2jfAGjso8bd6I6VQQYgwHlHKVrB2+shVwnP5iBDuS CCXH+d5mtW9lJ9y0vHXcjqSh1/BwNt0ipnX0VVZ4ic8Xh0YdRJN56z15eLnUPdv5UJ ZAaF6jPMff8TtwPSr9O+torXtv/EMQM6u+/o5QV1fKZtuVMZfcytXnCntzOnpXe/aP oiiUKck7p6OuAsq7Zly68Yc/zbPg8wDRQGZjiV2rIuL9EfHx8xkn2L9vOrhY+fs8uj TR/cTK33ar2xw== 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:268265 Archived-At: Sent with Proton Mail secure email. ------- Original Message ------- On Thursday, August 24th, 2023 at 4:58 AM, Stefan Monnier wrote: > > > Could you give a bit more context about why/where you'd want to do th= at > > > 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 > > simple cycling. But with possibility of starting from a particular inde= x. >=20 >=20 > So the initial "alpha" is simply not considered, OK, that makes sense, > so given that the ordering of COLLECTION happens to be preserved, you > can get the above behavior if you reorder COLLECTION before the call, as > in: >=20 > (let ((cseq '("epsilon" "zeta" "eta" "alpha" "beta" "gamma" "delta"))) > (completing-read "Grapheme: " cseq nil t "alpha")) =20 > > > Also for such uses of `completing-read` we usually recommend against = a > > > non-nil value for INITIAL-INPUT, so that context should try to explai= n > > > why you use "alpha" as INITIAL-INPUT. - Stefan > > > Because using INITIAL is the only way available to pre-insert a value= in > > > the minibuffer. >=20 > That's a bit tautological. > What I meant is why do you need to preinsert a value? In particular cases, the pre-insertion indicates to the user the kind of input structure of collection that can help him apply a completion strategy for traversing the possibilities. =20 > 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 Correct. The solution involves an unwieldy parameter configurations, and p= ossibly=20 using convoluted workarounds to achieve the desired behavior. This scenari= o implies that using the function as intended requires a level of effort, understandi= ng, and=20 manipulation that goes beyond direct usage.