From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier 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 12:58:40 -0400 Message-ID: References: <83jztmro8z.fsf@gnu.org> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5121"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Eli Zaretskii , 65459@debbugs.gnu.org To: Heime Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Aug 23 18:59:16 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 1qYrCN-00015L-Gj for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 23 Aug 2023 18:59:15 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qYrC7-0008GD-BF; Wed, 23 Aug 2023 12:58:59 -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 1qYrC6-0008G4-KM for bug-gnu-emacs@gnu.org; Wed, 23 Aug 2023 12:58: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 1qYrC6-0008HE-CO for bug-gnu-emacs@gnu.org; Wed, 23 Aug 2023 12:58:58 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qYrC9-0001RT-N1 for bug-gnu-emacs@gnu.org; Wed, 23 Aug 2023 12:59:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 23 Aug 2023 16:59: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.16928099355531 (code B ref 65459); Wed, 23 Aug 2023 16:59:01 +0000 Original-Received: (at 65459) by debbugs.gnu.org; 23 Aug 2023 16:58:55 +0000 Original-Received: from localhost ([127.0.0.1]:35040 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qYrC3-0001R9-Gf for submit@debbugs.gnu.org; Wed, 23 Aug 2023 12:58:55 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:53821) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qYrBz-0001Qu-Jd for 65459@debbugs.gnu.org; Wed, 23 Aug 2023 12:58:54 -0400 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 9056744233C; Wed, 23 Aug 2023 12:58:42 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1692809921; bh=8OaCzKn/+Y6tHhCq+6DFJ0lxSfn670K4cwxAfYwnyUI=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=euUyJVFyiR5ucf37k5XJUWNFVmyTDAvp/+aaCSRfweUfX4Z4+aKh9pTGJt1nKSc3I TmBIxvtMEiYW95IGi4nZCD+b4lhCDPv+wKfu1NzAmVJ3nvafjqFFbNyPFVL7DAwe0+ k582FALsluukmoHRtBUX6L714L7qyJAWgL9bMyRgJIsgYRmQmuA4dG01yj1KySipOU oskli6XQRTZFvvhUdaMMsBuJ57c81WZmTBCa3Bf+hhSyocJTHg654WIcmchuZJaniu 0v5tvsW33HTSOm6PA+ZMhBy9DeCkScydtumn2clnbF0x7CrkuwhitqLlwntfu03ADi RR83fy/sv4nvA== Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 11843442329; Wed, 23 Aug 2023 12:58:41 -0400 (EDT) Original-Received: from alfajor (unknown [23.233.149.155]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id E555B1200DB; Wed, 23 Aug 2023 12:58:40 -0400 (EDT) In-Reply-To: (Heime's message of "Wed, 23 Aug 2023 16:39:52 +0000") 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:268260 Archived-At: >> 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? >> >> Hopefully it would explain why you want "alpha epsilon ..." first but >> "alpha beta .." later. > > In such instance one considers collection as a cyclic list for the case of > simple cycling. But with possibility of starting from a particular index. 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: (let ((cseq '("epsilon" "zeta" "eta" "alpha" "beta" "gamma" "delta"))) (completing-read "Grapheme: " cseq nil t "alpha")) >> Also for such uses of `completing-read` we usually recommend against a >> non-nil value for INITIAL-INPUT, so that context should try to explain >> why you use "alpha" as INITIAL-INPUT. - Stefan > Because using INITIAL is the only way available to pre-insert a value in > the minibuffer. That's a bit tautological. What I meant is why do you need to preinsert a value? The normal/recommended call looks like: (let ((cseq '("alpha" "beta" "gamma" "delta" "epsilon" "zeta" "eta"))) (completing-read (format-prompt "Grapheme" "alpha") cseq nil t nil nil "alpha")) [ Yes, it's a bit cumbersome: hysterical raisins :-( ] Stefan