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: Sun, 15 Sep 2024 08:40:02 +0200 Message-ID: References: <875xqzicit.fsf@ice9.digital> <871q1m36jw.fsf@ice9.digital> <87o74q7ylr.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="8238"; 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 Sun Sep 15 08:41:03 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 1spiwR-0001xf-B0 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 15 Sep 2024 08:41:03 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1spiwJ-0001Vm-4j; Sun, 15 Sep 2024 02:40:55 -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 1spiwG-0001VW-7D for bug-gnu-emacs@gnu.org; Sun, 15 Sep 2024 02:40:52 -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 1spiwE-0008TW-5X for bug-gnu-emacs@gnu.org; Sun, 15 Sep 2024 02:40:51 -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=LQWklmGiPbZFU2q6KxxB+H/HZfdeprW4isUFRTPKngY=; b=jOmarwOQLLKU3M8mAwE42/7gUDdRMBp9GgQa0uDz4veN6MkiUReCNPQD06GtY6/0sDH7nrqCzFM055R7QJd9QO5gg20JIKOvSiXSCQh/UzBL1hHh5xweGSS6Gd2O2u9OiOj4KZVA3SaVoCI0yE6pTMEJO4cOGpkoWq2Jy1+TaR3UoHw3OjkOPTsfYOFYMhUAR37oSLrkVjG3pap8K1XRqwga/fVUc/K8WpXa7UsJRseNaEiGkJOhq0Xp5z8eRrC5iNztgZPyGcYHxRYkL6/+0FhKiqXbsLBIyAoYEhWHD3uZ6QTFzvDxh4pwOiIWlIsbhCAHKsmXEShUT8tUjFptdA==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1spiwP-0006jS-LI for bug-gnu-emacs@gnu.org; Sun, 15 Sep 2024 02:41:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eshel Yaron Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 15 Sep 2024 06:41:01 +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.172638242325791 (code B ref 73234); Sun, 15 Sep 2024 06:41:01 +0000 Original-Received: (at 73234) by debbugs.gnu.org; 15 Sep 2024 06:40:23 +0000 Original-Received: from localhost ([127.0.0.1]:48192 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1spivj-0006dD-3j for submit@debbugs.gnu.org; Sun, 15 Sep 2024 02:40:23 -0400 Original-Received: from mail.eshelyaron.com ([107.175.124.16]:48564 helo=eshelyaron.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1spivg-0006bu-RJ for 73234@debbugs.gnu.org; Sun, 15 Sep 2024 02:40:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eshelyaron.com; s=mail; t=1726382404; bh=h9r4aSC3ZGRqpmggC9ycC1x2z/7rUTcOxQjcl0FncOc=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=Na3yqRC9Ea5yBE4wwZDgxesonOHfnSOftI/hSpNbPsb/7b5wQNpaTdxLM8YZ1Bgtc 1m9iMALYTTEKHElC5CrP3s17vXz9an06OvES9MyLbBn83GSQMrSGzuwh2iEeuw3gLV rfoIRF6kj4QHnyqzKQv5VN/6LDGkIM4FR1J5A4nYD0stYRPziXT8wY0n8HtLn1YUe3 XlNNcOm5JJIv8Hv+Gv2m/H51h7v3SkwVSGBKB1PhqReS/lSLKnbRaIbPAJH20noB0p CklhWmG/4rfbXIh7BTRsN0RDwDkJYJZchYws8Iimis33pxWPp4ypX3kLmnNz2Sd+8e /mWHNQIZjVbFw== In-Reply-To: <87o74q7ylr.fsf@ice9.digital> (Morgan Willcock's message of "Sat, 14 Sep 2024 21:46:08 +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:291824 Archived-At: Hi, Morgan Willcock writes: > There are gaps in my knowledge here, but is there something about a > prefix completion which means that it has to force a case-sensitive > match, or is there something else about the preview interface which > imposes the restriction? Prefix completion does not force case-sensitivity. However, in Completion Preview mode we only show (preview) the suffix. Since we only suggest a suffix, the completion preview cannot convey to you, the user, suggested alternations for the prefix, such as case alternations. This is in contrast with e.g. the *Completions* buffer where you see a list of whole completion candidates. So the preview is inherently all about adding text, not changing existing text. We can conceive of a way to indicate suggested changes to the existing prefix, probably with an overlay. I think that's an interesting idea to explore, but it would make Completion Preview mode more complex (both in terms of implementation, and more importantly, from a user's perspective). So we'll only do it if enables an important use case. > If the completion at point function is case-insensitive at which point > in the process is that case-insensitivity being lost? completion-preview--try-table is where we first filter appropriate completion candidates. [...] >> 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. > > I found out the hard way that completion-ignore-case isn't something > that can be set as buffer-local: > > https://lists.gnu.org/archive/html/emacs-devel/2024-03/msg00302.html > > I wouldn't want to set case-insensitivity globally. I'll take a closer look at that discussion, but I'm pretty sure you can in fact set completion-ignore-case buffer-locally. It works as expected in my quick tests, and it's done in other places in Emacs already :| >> 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. > > Do you mean this would need changes to the completion at point function > rather than to completion-preview-mode? Yes. Basically, use a different wrapper instead of completion-table-case-fold. [...] >> If my suggestions above don't help with your use case, would you like to >> try and propose a patch that does? > > I would be willing to give it a go, but I think I am missing some fairly > critical knowledge about why the same completion at point function is in > use but the match result is different. Great. The "matches" (the return value of the completion functions) are the same. We post-process them, including filtering them, differently, since we present them differently (we only display the suffix, etc.). Check out completion-preview--try-table in particular, and feel free to ask if you find anything unclear. Admittedly, the documentation of some of these internal functions could be a bit more detailed :) Best, Eshel