From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eshel Yaron via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#73234: 30.0.91; completion-preview-mode doesn't trigger for case-insensitive capf Date: Sat, 14 Sep 2024 18:23:46 +0200 Message-ID: References: <875xqzicit.fsf@ice9.digital> <871q1m36jw.fsf@ice9.digital> Reply-To: Eshel Yaron Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="28446"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 73234@debbugs.gnu.org To: Morgan Willcock Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Sep 14 18:25:07 2024 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 1spVa6-0007C4-Oq for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 14 Sep 2024 18:25:07 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1spVa1-0001HM-3y; Sat, 14 Sep 2024 12:25: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 1spVZs-0001Gm-AJ for bug-gnu-emacs@gnu.org; Sat, 14 Sep 2024 12:24:53 -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 1spVZr-0000Yk-QY for bug-gnu-emacs@gnu.org; Sat, 14 Sep 2024 12:24:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=oiBz+si/WgmwPW6G4R/4B5CkEIsa783WuLZyIQOneBg=; b=TWiEBCShLbNdbBChYaDQKYDjLbvtT89uVpVte6lb1NVpBGU9+SpbqARdyE/qvKLIsILtLMONfeKbDXaCDpxZIv5FVCnyBn51/itVdfCfNM9mF81zWqGPoCSf86oqz2lsTV7BLyLoabJuBZoEfteTmW5GJcv4hGW/Nt73qClPG3fxizDPsL/csnvoRoOdoGB7SUYZ1cic9mH/u8yd5y/4lyYO4eFt7aHPV1CfCCU9QdAbYr98lk5RoW8ch0hHY7amvAPHgRvHt9yVbQpGexU9qWL4Kotaez3++4N1me3PhVIxkunS7Jwd3hZVeOViseyekJgzMQ8YnErSpjUWeWeYvQ==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1spVa2-0000Ff-F4 for bug-gnu-emacs@gnu.org; Sat, 14 Sep 2024 12:25:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eshel Yaron Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 14 Sep 2024 16:25:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73234 X-GNU-PR-Package: emacs Original-Received: via spool by 73234-submit@debbugs.gnu.org id=B73234.1726331051861 (code B ref 73234); Sat, 14 Sep 2024 16:25:02 +0000 Original-Received: (at 73234) by debbugs.gnu.org; 14 Sep 2024 16:24:11 +0000 Original-Received: from localhost ([127.0.0.1]:47715 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1spVZC-0000Dp-NO for submit@debbugs.gnu.org; Sat, 14 Sep 2024 12:24:11 -0400 Original-Received: from mail.eshelyaron.com ([107.175.124.16]:52910 helo=eshelyaron.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1spVZ9-0000Df-Qy for 73234@debbugs.gnu.org; Sat, 14 Sep 2024 12:24:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eshelyaron.com; s=mail; t=1726331036; bh=Gulhjvk7m3zlHNDk0789KyPZd4CiJFAhSJuK7iRN3E4=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=Wh0R4pJ1N3NsN6kuQ+W4wfoQu0EA7j2QvbLpopIA0ldd6ie5uREa08GxOkPTXaLfT 9JmdIfn96V9zL85470L2ZpjUY1/p8d2UkoT/8lzyjJZiRvLiKzdp9E8BxNU4/xv96R yZ+on2BdnnB46DG6d3bm3CYUOR+ncbmY57yh9l0tvFT4viQXPP+IW9PNqkdpo4huEQ GFqEd9OOYn8rVOUxLLvNjU3a8SplEL91Gnrka1yjAvtu0DsyTJeyIRh55nutVNuo3j 083sf1OwnDSAYyJD/Gsd24zcZTqN8B1Kw9w+W1vXjwlGS+Ldo44e13kVuJPf/QHEfH nzfWj3PP2ePCQ== In-Reply-To: <871q1m36jw.fsf@ice9.digital> (Morgan Willcock's message of "Sat, 14 Sep 2024 10:53:23 +0100") 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:291789 Archived-At: Morgan Willcock writes: > Eshel Yaron writes: > > Hi Eshel, > >> We could display the completion preview also when you type a prefix that >> differs from a candidate prefix only in case (and in fact we already do, >> when completion-ignore-case is non-nil), but the question is what to do >> when you accept/insert this completion. Namely, changing the prefix >> from "tes" to "Tes" when you accept the completion suggestion adds >> complications both in terms of implementation and in terms of UX, and >> I'm not sure that this added complexity would be justified. > > My expectation was that a "completion preview" is using exactly the same > criteria as the default completion mechanism, This expectation is (at least presently) not warranted. Completion Preview mode draws from the same pool of completions as completion-at-point (it uses the same completion-at-point-functions), but as a different frontend it makes different use of these completions. Namely, Completion Preview mode is for prefix completion. This is the purpose of this feature. We can discuss generalizing Completion Preview mode to incorporate other kinds (or styles) of completion, that does require some non-trivial considerations, though. In the benefit of other users, could you please share what led you to have this expectation? Perhaps we can improve the documentation to avoid such confusions. > and would indicate when a completion was available to use. That it does, for prefix completions. > The difference in the behaviour also means completion-preview-mode > cannot reliably be used as the entry-point (by repeatedly calling > completion-preview-complete) for the completion interface. That's not the goal of this command, so that's OK, I think :) Completion Preview mode is not intended to replace completion-at-point, you can use C-M-i with the preview enabled, and get the same results that would without it. >> Do you have, or know of, a concrete use case with a completion table >> that behaves like your test-completion-at-point-function? > > I think it would be rare to see one explicitly set to be > case-insensitive, but I found the issue because I use a Cape capf > transformer to wrap an existing capf backend: > > https://elpa.gnu.org/packages/doc/cape.html#Capf-transformers > > It is feasible to do that for any language where the syntax is > case-insensitive. If case is not important, and you're fine with completing "tes" in your example to "testSymbol", then setting completion-ignore-case to non-nil should get you there, IIUC. Another option, if case is insignificant, is to use a completion table that adopts the case of the input and returns completion candidates adjusted accordingly, instead of ignoring the case of the input and returning candidates that match up to case differences. We do something like that in ispell-completion-at-point, for example, and it works well with Completion Preview mode. > Here is an example of it being done: > > https://git.sr.ht/~mew/kixtart-mode/tree/v1.3.2/item/doc/kixtart-mode.texi#L804 > > (I wrote this mode and its manual, but anyone using cape-capf-case-fold > is likely to see the same problem.) Thanks, but this points to example code in the documentation of a package I'm not familiar with, so it's hard to discern its significance. (The manual looks really nice BTW!) If my suggestions above don't help with your use case, would you like to try and propose a patch that does? Eshel