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 13:19:55 +0000 Message-ID: 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="8253"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , 65459@debbugs.gnu.org, Stefan Monnier To: Gregory Heytings Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Aug 24 15:21: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 1qZAGo-0001tz-6s for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 24 Aug 2023 15:21:06 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qZAGi-0002mW-UL; Thu, 24 Aug 2023 09:21: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 1qZAGg-0002ll-Nj for bug-gnu-emacs@gnu.org; Thu, 24 Aug 2023 09:20: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 1qZAGg-0003PD-FE for bug-gnu-emacs@gnu.org; Thu, 24 Aug 2023 09:20:58 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qZAGk-0005aP-DN for bug-gnu-emacs@gnu.org; Thu, 24 Aug 2023 09:21: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 13:21: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.169288321221399 (code B ref 65459); Thu, 24 Aug 2023 13:21:02 +0000 Original-Received: (at 65459) by debbugs.gnu.org; 24 Aug 2023 13:20:12 +0000 Original-Received: from localhost ([127.0.0.1]:36365 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qZAFw-0005Z5-DP for submit@debbugs.gnu.org; Thu, 24 Aug 2023 09:20:12 -0400 Original-Received: from mail-40132.protonmail.ch ([185.70.40.132]:51823) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qZAFu-0005Yo-4u for 65459@debbugs.gnu.org; Thu, 24 Aug 2023 09:20:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1692883199; x=1693142399; bh=EDfIxJG7QqcGKKQ5w/0M1P770ARR4m778oVj36irrsQ=; 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=ik8iYlreOCEJevnnnn+JlRGLkxdQx5gPEeSGNiw7bT8kdK/JLDro6P8cM6PlgzpVk D2ZaZ8ZB2sGCe+rrcc4H23xc7d12SVQdHkBKF3WiuVYDQDHWTz6t89aqQ/tQr89cV0 8WoZD9nVv5hLEmGBRcekHNdHaXOywWUI5gqcUdTTo8qWOMzjxUn5UvIXAIKqNeQIb3 MWEjyY6zC5XgxkuJzBjHQPyzgqBXDCJLR3mVKFH1ZH5QyaY0oVmgjwtrjqBs2eUq7I B283/TCcnGzDgZr18kCA90UI69OLCbKy9bI5T2aU4O8O6RCHqEK+Jf2ozAY50UNAVz 0tXXcRVVWrvug== 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:268336 Archived-At: ------- Original Message ------- On Friday, August 25th, 2023 at 12:30 AM, Gregory Heytings wrote: > > > (defun my-completing-read (prompt collection start) > > > (minibuffer-with-setup-hook > > > (:append > > > (lambda () > > > (setq-local actual-minibuffer-default-add-function > > > minibuffer-default-add-function) > > > (setq-local minibuffer-default-add-function > > > '(lambda () (setq minibuffer-default-add-done nil) > > > (funcall actual-minibuffer-default-add-function))) > >=20 > > Why use ' on `lambda`? >=20 >=20 > I think my finger slipped. >=20 > > BTW, rather than the above two `setq-local`s, I think you can write: > >=20 > > (add-function :before (local 'minibuffer-default-add-function) > > (lambda () (setq minibuffer-default-add-done nil))) >=20 >=20 > Right. I was writing that function as it if were for minibuffer.el, and > was therefore avoiding advices. But now I see that there are a couple of > add-function in core anyway (it's not clear to me where the dividing line > is). So here's the final version: >=20 > (defun my-completing-read (prompt collection start) > (minibuffer-with-setup-hook > (:append > (lambda () > (add-function :before (local 'minibuffer-default-add-function) > (lambda () (setq minibuffer-default-add-done nil))) > (next-history-element start) > (move-end-of-line nil))) > (completing-read (format-prompt prompt nil) collection nil t))) >=20 > (my-completing-read "Grapheme" '("alpha" "beta" "gamma" "delta" "epsilon"= "zeta" "eta") 1) >=20 > Heime, can you try that and tell us if it solves your problem? The behaviour is as it should be. Although we should keep 'start' to corre= spond to=20 collection index which customarily starts from value 0.=20 Although I can use the function provided, I rather have all this incorporat= ed in 'completing-read'. Because 'completing-read' would benefit from it. Parti= cularly now that its use is being extended. This taking into account that my use c= ase is more aligned with its original operation, except that certain aspects wh= ich I have shown to be important were not recognised at the time. After some focused = attention, Stefan concurred how I have been making sense, particularly after seeing ho= w `completing-read`=20 actually behaves during the form of cycling I discussed at some length.