GNU bug report logs - #73234
30.0.91; completion-preview-mode doesn't trigger for case-insensitive capf

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Morgan Willcock <morgan@HIDDEN>; dated Fri, 13 Sep 2024 19:24:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 73234 <at> debbugs.gnu.org:


Received: (at 73234) by debbugs.gnu.org; 20 Sep 2024 10:35:11 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Sep 20 06:35:11 2024
Received: from localhost ([127.0.0.1]:34132 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1srayk-00015s-OQ
	for submit <at> debbugs.gnu.org; Fri, 20 Sep 2024 06:35:11 -0400
Received: from mail.eshelyaron.com ([107.175.124.16]:51984 helo=eshelyaron.com)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <me@HIDDEN>) id 1srayi-00015l-T4
 for 73234 <at> debbugs.gnu.org; Fri, 20 Sep 2024 06:35:10 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eshelyaron.com;
 s=mail; t=1726828489;
 bh=GDS5311srYNBnrjYEElb9I5JJmDNdvrGXhtWXjDrGpQ=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=Y00gMNIJXdf6qEoTqRr52sj4NEDXeoIhBQ/K3bcHA7s1N7PLB35O8ZuxNqnJYCw0j
 SWo1v5YMJmSTOrG0k9vuj/NKW7hpb/g+AklvvXdqS1zUtcw3z2K52bUQIhEcwqUaa6
 LpUHl1V494zL0dWhGIzsgPeq4xQAPxIBu1qjvDm0U2faKSsx77a02ocSYncVn+ihTZ
 wbUgwHJao5D3tclbtA3vb8Otphro9JoENDo+3/kL/98YJPuKo0xKXW7WoU1C0J0PSb
 LL4ZrychRX6xmjBNKIPdpeRgeTHzjpW5QzLOufM3atIbUsBeC9xqvYYzq73L5ESV9R
 ddEs4WwiHFnww==
From: Eshel Yaron <me@HIDDEN>
To: Morgan Willcock <morgan@HIDDEN>
Subject: Re: bug#73234: 30.0.91; completion-preview-mode doesn't trigger for
 case-insensitive capf
In-Reply-To: <87ttead4i3.fsf@HIDDEN> (Morgan Willcock's message of "Fri, 
 20 Sep 2024 11:05:40 +0100")
References: <875xqzicit.fsf@HIDDEN> <m1mska7oox.fsf@HIDDEN>
 <871q1m36jw.fsf@HIDDEN> <m134m22oh9.fsf@HIDDEN>
 <87o74q7ylr.fsf@HIDDEN> <m1ttehbet9.fsf@HIDDEN>
 <m1zfo685lz.fsf@HIDDEN> <87cyl04sof.fsf@HIDDEN>
 <m11q1g8amq.fsf@HIDDEN> <877cb7sn96.fsf@HIDDEN>
 <m18qvm7k08.fsf@HIDDEN>
 <87ttead4i3.fsf@HIDDEN>
Date: Fri, 20 Sep 2024 12:34:47 +0200
Message-ID: <m1v7yq62bc.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 73234
Cc: 73234 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Morgan Willcock <morgan@HIDDEN> writes:

> Eshel Yaron <me@HIDDEN> writes:
>
>> If :exit-function doesn't work for your use case, please explain why,
>> and if there's indeed a need for another hook, it's easy to add one :)
>
> My reasons for not using :exit-function would be:

Thanks, these make sense.

> - If the completion was inserted using a different interface then the
>   function would be running unnecessarily.

Right, although this needn't be significant in terms of performance.

> - For completion functions that I didn't write, :exit-function isn't
>   going to be set with the expectation that a particular completion
>   interface and case preference is used to insert the candidate.

The idea is that you use a capf wrapper that adds the :exit-function,
when needed, like cape-capf-case-fold in your example.

> That said, I am just trying to think of an easy mechanism to preserve
> the case of the candidate.  A hook may generally be useful, but adding a
> hook does not solve the underlying problem that I am describing here.
>
> Perhaps it is best to just pause for the moment while you get additional
> feedback from other users.

All right, let me know if you have further thoughts or a potential patch,
and thank you for your engagement!


Best,

Eshel




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#73234; Package emacs. Full text available.

Message received at 73234 <at> debbugs.gnu.org:


Received: (at 73234) by debbugs.gnu.org; 20 Sep 2024 10:06:33 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Sep 20 06:06:33 2024
Received: from localhost ([127.0.0.1]:34110 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sraX3-00084s-0T
	for submit <at> debbugs.gnu.org; Fri, 20 Sep 2024 06:06:33 -0400
Received: from relay1-d.mail.gandi.net ([217.70.183.193]:39057)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <morgan@HIDDEN>) id 1sraWx-00084W-3I
 for 73234 <at> debbugs.gnu.org; Fri, 20 Sep 2024 06:06:31 -0400
Received: by mail.gandi.net (Postfix) with ESMTPSA id 8C38E24000D;
 Fri, 20 Sep 2024 10:05:41 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ice9.digital;
 s=gm1; t=1726826741;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
 in-reply-to:in-reply-to:references:references;
 bh=3DsRobEnHOYOia2IkUatRGmi8hbPbTwBZ19v4eM2Whk=;
 b=BH81zPHrRJ+EsaNZzKuc+EpDEA0tEc2RXFVVhVBKCYC3vxCWn3Hm7NUyJ/MKO5H+ogvGsj
 edHK169yhCExhTUW/BuYv4RPyvNE0KzM/2bwYwxGCemAJ3GMqsHLiRBiyyWbMSWXS6cSZq
 tqBBs7idEKycKww69CB0LP9lojkdqH436txQRTQWsBC1jLqQztBO+GkcGjuSHnWLs2sqFQ
 R6m5PzsW4TIVK2tJadSXNjl75R4hQSD6H7evVOAvAARGU19n9aBvqObK9u4wr5bZWRsF5z
 aCMokRIIP2qS0E2j635ZLWrbsePSzyBKSEeo7WOZ156tY2FiOsEhaZbN+yxVqg==
From: Morgan Willcock <morgan@HIDDEN>
To: Eshel Yaron <me@HIDDEN>
Subject: Re: bug#73234: 30.0.91; completion-preview-mode doesn't trigger for
 case-insensitive capf
In-Reply-To: <m18qvm7k08.fsf@HIDDEN> (Eshel
 Yaron's message of "Fri, 20 Sep 2024 11:27:19 +0200")
References: <875xqzicit.fsf@HIDDEN> <m1mska7oox.fsf@HIDDEN>
 <871q1m36jw.fsf@HIDDEN> <m134m22oh9.fsf@HIDDEN>
 <87o74q7ylr.fsf@HIDDEN> <m1ttehbet9.fsf@HIDDEN>
 <m1zfo685lz.fsf@HIDDEN> <87cyl04sof.fsf@HIDDEN>
 <m11q1g8amq.fsf@HIDDEN> <877cb7sn96.fsf@HIDDEN>
 <m18qvm7k08.fsf@HIDDEN>
Date: Fri, 20 Sep 2024 11:05:40 +0100
Message-ID: <87ttead4i3.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-GND-Sasl: morgan@HIDDEN
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 73234
Cc: 73234 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

Eshel Yaron <me@HIDDEN> writes:

>>>> I've been trying to think of a way to get it to work without disturbing
>>>> the user interface that already exists.  Maybe it would be possible
>>>> fixup the result in a post-insertion hook if one existed - such a hook
>>>> might be generally useful anyway.
>>>
>>> We have the :exit-function (which your capf can provide as an extra
>>> property alongside the completion table it returns), and indeed you
>>> could use that to "fix" the case of your prefix after completing it.
>>
>> I don't think it is the responsibility of the completion function
>> because it is not the completion function that is modifying the buffer.
>>>
>>> That's an interesting solution, I think.  Or do you have some other kind
>>> of hook in mind?
>>
>> Just a hook that runs after it was completion-preview-mode that inserted
>> a completion.
>
> I'm quite not sure what you mean by responsibility, but in terms of
> functionality, :exit-function is the existing interface for doing
> something after a completion is inserted, and Completion Preview mode
> supports this interface.

The hook would be interface specific because it is the interface which
has modified the case of the completion.

> If :exit-function doesn't work for your use case, please explain why,
> and if there's indeed a need for another hook, it's easy to add one :)

My reasons for not using :exit-function would be:

- If the completion was inserted using a different interface then the
  function would be running unnecessarily.

- For completion functions that I didn't write, :exit-function isn't
  going to be set with the expectation that a particular completion
  interface and case preference is used to insert the candidate.

That said, I am just trying to think of an easy mechanism to preserve
the case of the candidate.  A hook may generally be useful, but adding a
hook does not solve the underlying problem that I am describing here.

Perhaps it is best to just pause for the moment while you get additional
feedback from other users.

Thanks,
Morgan

-- 
Morgan Willcock




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#73234; Package emacs. Full text available.

Message received at 73234 <at> debbugs.gnu.org:


Received: (at 73234) by debbugs.gnu.org; 20 Sep 2024 09:27:48 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Sep 20 05:27:48 2024
Received: from localhost ([127.0.0.1]:34070 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1srZvY-0005xV-26
	for submit <at> debbugs.gnu.org; Fri, 20 Sep 2024 05:27:48 -0400
Received: from mail.eshelyaron.com ([107.175.124.16]:46484 helo=eshelyaron.com)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <me@HIDDEN>) id 1srZvU-0005xI-3e
 for 73234 <at> debbugs.gnu.org; Fri, 20 Sep 2024 05:27:46 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eshelyaron.com;
 s=mail; t=1726824441;
 bh=oeE2Zsyii5bwbHCP7W6TkC6vFdBuxqy1GT4Nb4B5PsA=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=XbWc4jhujliXICi5GzhIceas6Ppb0FnwtaY6HiMiQiuKNV3rkzcNSyXz/UEbXrFsJ
 TeeKWT2bPRTX63zcX49i+p/s2WM/p+vMREAfL+0XfBS21Gb9Mvm4sg6jamolVYnceO
 7aUGA3PplBzp6LXmGgDUKJ81WAY6xiv3qJCBLfXrxjfOhLXkch0SoF329OhHlixlKh
 r9LfFka5Vbe4TBWoGWOVTNhoru6FlDPTHkgEc8/pAJy3YCg+CGpf7LbHb1F0XOtKIt
 08mDUMN8nowPNP6XoT7wvikiSdzNsLI1a2y5cmKfd+v2dfoWoHGaPfHVqVDwJSuw53
 1JJxcFOeJ+vRQ==
From: Eshel Yaron <me@HIDDEN>
To: Morgan Willcock <morgan@HIDDEN>
Subject: Re: bug#73234: 30.0.91; completion-preview-mode doesn't trigger for
 case-insensitive capf
In-Reply-To: <877cb7sn96.fsf@HIDDEN> (Morgan Willcock's message of "Thu, 
 19 Sep 2024 15:59:17 +0100")
References: <875xqzicit.fsf@HIDDEN> <m1mska7oox.fsf@HIDDEN>
 <871q1m36jw.fsf@HIDDEN> <m134m22oh9.fsf@HIDDEN>
 <87o74q7ylr.fsf@HIDDEN> <m1ttehbet9.fsf@HIDDEN>
 <m1zfo685lz.fsf@HIDDEN> <87cyl04sof.fsf@HIDDEN>
 <m11q1g8amq.fsf@HIDDEN> <877cb7sn96.fsf@HIDDEN>
Date: Fri, 20 Sep 2024 11:27:19 +0200
Message-ID: <m18qvm7k08.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 73234
Cc: 73234 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hi,

Morgan Willcock <morgan@HIDDEN> writes:

> Eshel Yaron <me@HIDDEN> writes:
>
>>> I've been trying to think of a way to get it to work without disturbing
>>> the user interface that already exists.  Maybe it would be possible
>>> fixup the result in a post-insertion hook if one existed - such a hook
>>> might be generally useful anyway.
>>
>> We have the :exit-function (which your capf can provide as an extra
>> property alongside the completion table it returns), and indeed you
>> could use that to "fix" the case of your prefix after completing it.
>
> I don't think it is the responsibility of the completion function
> because it is not the completion function that is modifying the buffer.
>>
>> That's an interesting solution, I think.  Or do you have some other kind
>> of hook in mind?
>
> Just a hook that runs after it was completion-preview-mode that inserted
> a completion.

I'm quite not sure what you mean by responsibility, but in terms of
functionality, :exit-function is the existing interface for doing
something after a completion is inserted, and Completion Preview mode
supports this interface.

If :exit-function doesn't work for your use case, please explain why,
and if there's indeed a need for another hook, it's easy to add one :)


Thanks,

Eshel




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#73234; Package emacs. Full text available.

Message received at 73234 <at> debbugs.gnu.org:


Received: (at 73234) by debbugs.gnu.org; 19 Sep 2024 15:00:07 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Sep 19 11:00:07 2024
Received: from localhost ([127.0.0.1]:33257 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1srIda-00049K-TB
	for submit <at> debbugs.gnu.org; Thu, 19 Sep 2024 11:00:07 -0400
Received: from relay4-d.mail.gandi.net ([217.70.183.196]:44603)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <morgan@HIDDEN>) id 1srIdY-00048I-2U
 for 73234 <at> debbugs.gnu.org; Thu, 19 Sep 2024 11:00:05 -0400
Received: by mail.gandi.net (Postfix) with ESMTPSA id E7C54E0003;
 Thu, 19 Sep 2024 14:59:18 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ice9.digital;
 s=gm1; t=1726757959;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
 in-reply-to:in-reply-to:references:references;
 bh=dQ4nKv5r9xu7DU29ZLscdFEF1/iT/OB4YSwUiedkE8I=;
 b=iFXTeIqXcqe6QH/Z8ktBylkbHzyNQzS3i5+5Pikrgh1OUickIDsZB+CvfoPw5wJDllirSO
 wSST53ncsGQ8/MaRkpRGM8Zc7367SkNCUGnQS772R0cPAtJ36P6wmYsK41+tb7RX7IT94l
 DmzjMh1bT9erKEXqYopA6NXikPLUSO1cIT/R4pipva5UIMCdTAO1T/wGy7mi926RY1opL/
 ARyUZTtm+1Zhvd9smsf0hB5+/2yVRr5JK+cVgQRYS8caWB0GPdRBpy4ziF30Xmf9i3rJzf
 BNE5Gd7Y/nME15YfCDvmQqR3zGwxJragqKoFtVXr4iEibMUscRwzyFSFJQEjRg==
From: Morgan Willcock <morgan@HIDDEN>
To: Eshel Yaron <me@HIDDEN>
Subject: Re: bug#73234: 30.0.91; completion-preview-mode doesn't trigger for
 case-insensitive capf
In-Reply-To: <m11q1g8amq.fsf@HIDDEN> (Eshel Yaron's message of "Thu,
 19 Sep 2024 07:39:57 +0200")
References: <875xqzicit.fsf@HIDDEN> <m1mska7oox.fsf@HIDDEN>
 <871q1m36jw.fsf@HIDDEN> <m134m22oh9.fsf@HIDDEN>
 <87o74q7ylr.fsf@HIDDEN> <m1ttehbet9.fsf@HIDDEN>
 <m1zfo685lz.fsf@HIDDEN> <87cyl04sof.fsf@HIDDEN>
 <m11q1g8amq.fsf@HIDDEN>
Date: Thu, 19 Sep 2024 15:59:17 +0100
Message-ID: <877cb7sn96.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-GND-Sasl: morgan@HIDDEN
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 73234
Cc: 73234 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

Eshel Yaron <me@HIDDEN> writes:

>> e.g. If a valid completion was "FooBar", and I typed "foo", having the
>> final result as "fooBar" wouldn't be ideal.
>
> Fair enough, although earlier you mentioned that your use case was
> completing symbols in a case-insensitive language, so I wonder what's
> wrong with "fooBar", or "foobar" for that matter.  They are all the same
> as the completion candidate, "FooBar", ignoring case differences, no?

The symbols would technically be valid in the language, but the
completion candidates will be using a particular style of naming.

Fundamentally, if I am meant to be writing using PascalCase then I don't
want the result to be accidentally transformed into camelCase.

>> I've been trying to think of a way to get it to work without disturbing
>> the user interface that already exists.  Maybe it would be possible
>> fixup the result in a post-insertion hook if one existed - such a hook
>> might be generally useful anyway.
>
> We have the :exit-function (which your capf can provide as an extra
> property alongside the completion table it returns), and indeed you
> could use that to "fix" the case of your prefix after completing it.

I don't think it is the responsibility of the completion function
because it is not the completion function that is modifying the buffer.

> That's an interesting solution, I think.  Or do you have some other kind
> of hook in mind?

Just a hook that runs after it was completion-preview-mode that inserted
a completion.

I thought that completion-preview-active-mode-hook might have been
suitable, but it looks like that is being called on every key-press when
typing in the buffer (without the completion preview).

Thanks,
Morgan

-- 
Morgan Willcock




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#73234; Package emacs. Full text available.

Message received at 73234 <at> debbugs.gnu.org:


Received: (at 73234) by debbugs.gnu.org; 19 Sep 2024 05:40:21 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Sep 19 01:40:21 2024
Received: from localhost ([127.0.0.1]:59624 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sr9tt-0006tY-5g
	for submit <at> debbugs.gnu.org; Thu, 19 Sep 2024 01:40:21 -0400
Received: from mail.eshelyaron.com ([107.175.124.16]:41106 helo=eshelyaron.com)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <me@HIDDEN>) id 1sr9tq-0006rM-4H
 for 73234 <at> debbugs.gnu.org; Thu, 19 Sep 2024 01:40:19 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eshelyaron.com;
 s=mail; t=1726724400;
 bh=Ou2XC7KMZ9JSX+/rl1F6N8tJSPQ/X+rf7kE651YlR80=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=bDculHykTrALyPul348Y1//MExG2zKutS/wuLcRbjyPsOQDJI7mdlLyT/bnoUCU37
 AB+wQyPBLJebdZi3EHvbY9owR4hiD13P4jt2eaNPe7XbXIFz+DZZruMRMZfkMiwQmn
 rq6Jtrs1OLPQyrQq1FEtpWRtSJ3EAWKStqotx/cxmEFIHwqAxQkNU7yzKSsegQu3pt
 yxvLcrU1G2ZU45tNaykFFTLwmxJSNEn7SqSO0cIQEvrNYl6RFP2CVTh/SaCb3L6L3L
 ecHYcwf4whBfYhcu+VyGFoBCG8i4frH3+QyCxc5fPGav7CDtdEXSz0ze6jTixGn9c0
 9n3MpzllmYt+w==
From: Eshel Yaron <me@HIDDEN>
To: Morgan Willcock <morgan@HIDDEN>
Subject: Re: bug#73234: 30.0.91; completion-preview-mode doesn't trigger for
 case-insensitive capf
In-Reply-To: <87cyl04sof.fsf@HIDDEN> (Morgan Willcock's message of "Wed, 
 18 Sep 2024 21:23:44 +0100")
References: <875xqzicit.fsf@HIDDEN> <m1mska7oox.fsf@HIDDEN>
 <871q1m36jw.fsf@HIDDEN> <m134m22oh9.fsf@HIDDEN>
 <87o74q7ylr.fsf@HIDDEN> <m1ttehbet9.fsf@HIDDEN>
 <m1zfo685lz.fsf@HIDDEN> <87cyl04sof.fsf@HIDDEN>
Date: Thu, 19 Sep 2024 07:39:57 +0200
Message-ID: <m11q1g8amq.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 73234
Cc: 73234 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hi,

Morgan Willcock <morgan@HIDDEN> writes:

> Eshel Yaron <me@HIDDEN> writes:
>
>> FYI, I've added a new user option completion-preview-ignore-case on the
>> master branch (commit f1794a17b62), which controls case sensitivity for
>> Completion Preview mode specifically.  This is definitely safe to set
>> buffer-locally.  The docstring of this new variable should hopefully
>> also explain exactly what's the expected behavior in this regard.
>
> Thanks for adding the new option.  For my use case I don't think I would
> be able to use it because the case mismatch between the text already
> typed and the completion will effectively be generating a completion
> which may not actually exist.
>
> e.g. If a valid completion was "FooBar", and I typed "foo", having the
> final result as "fooBar" wouldn't be ideal.

Fair enough, although earlier you mentioned that your use case was
completing symbols in a case-insensitive language, so I wonder what's
wrong with "fooBar", or "foobar" for that matter.  They are all the same
as the completion candidate, "FooBar", ignoring case differences, no?

> I've been trying to think of a way to get it to work without disturbing
> the user interface that already exists.  Maybe it would be possible
> fixup the result in a post-insertion hook if one existed - such a hook
> might be generally useful anyway.

We have the :exit-function (which your capf can provide as an extra
property alongside the completion table it returns), and indeed you
could use that to "fix" the case of your prefix after completing it.
That's an interesting solution, I think.  Or do you have some other kind
of hook in mind?


Best,

Eshel




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#73234; Package emacs. Full text available.

Message received at 73234 <at> debbugs.gnu.org:


Received: (at 73234) by debbugs.gnu.org; 18 Sep 2024 20:24:33 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Sep 18 16:24:33 2024
Received: from localhost ([127.0.0.1]:59276 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sr1E0-00029z-RT
	for submit <at> debbugs.gnu.org; Wed, 18 Sep 2024 16:24:33 -0400
Received: from relay4-d.mail.gandi.net ([217.70.183.196]:38865)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <morgan@HIDDEN>) id 1sr1Dw-00029f-MK
 for 73234 <at> debbugs.gnu.org; Wed, 18 Sep 2024 16:24:31 -0400
Received: by mail.gandi.net (Postfix) with ESMTPSA id 93DDCE0002;
 Wed, 18 Sep 2024 20:23:44 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ice9.digital;
 s=gm1; t=1726691025;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
 in-reply-to:in-reply-to:references:references;
 bh=7SN6ysPSxNuWRG055xBb4168Q4Eo/APWKt+SSJHls9c=;
 b=JouYLcyJOHo1oug7qzqeG6yg/2l+EnB7IKWoNBUwo7p94Uwtqix3P6qbdJp340iK0sI5EO
 AGLgey3td38hTiuzr6HeSTrXu/JYCReDtutaIEBvagdybTtTJtd6ekmFr8ZbokZusmeY2A
 71cFEBo8aN7CaXkrfI33hA/00yY8oPmo+7feSwmjtTZsRhO5psNkgyeYakORcEr1BI1SXM
 oDoGJQiW/g+WlioV5QGkbBbVq5UyFLr5kwGEM7Nv5i5AGcehnWOTF7gvK4kJVhfQ+zFhp7
 HVeaH4KhDwHamrxv59s+7fWVaD/dxkNR3qMdCZrA6tNXzMugIoUHq8Tn5/hn+g==
From: Morgan Willcock <morgan@HIDDEN>
To: Eshel Yaron <me@HIDDEN>
Subject: Re: bug#73234: 30.0.91; completion-preview-mode doesn't trigger for
 case-insensitive capf
In-Reply-To: <m1zfo685lz.fsf@HIDDEN> (Eshel Yaron's message of "Tue,
 17 Sep 2024 21:03:52 +0200")
References: <875xqzicit.fsf@HIDDEN> <m1mska7oox.fsf@HIDDEN>
 <871q1m36jw.fsf@HIDDEN> <m134m22oh9.fsf@HIDDEN>
 <87o74q7ylr.fsf@HIDDEN> <m1ttehbet9.fsf@HIDDEN>
 <m1zfo685lz.fsf@HIDDEN>
Date: Wed, 18 Sep 2024 21:23:44 +0100
Message-ID: <87cyl04sof.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-GND-Sasl: morgan@HIDDEN
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 73234
Cc: 73234 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

Eshel Yaron <me@HIDDEN> writes:

> FYI, I've added a new user option completion-preview-ignore-case on the
> master branch (commit f1794a17b62), which controls case sensitivity for
> Completion Preview mode specifically.  This is definitely safe to set
> buffer-locally.  The docstring of this new variable should hopefully
> also explain exactly what's the expected behavior in this regard.

Thanks for adding the new option.  For my use case I don't think I would
be able to use it because the case mismatch between the text already
typed and the completion will effectively be generating a completion
which may not actually exist.

e.g. If a valid completion was "FooBar", and I typed "foo", having the
final result as "fooBar" wouldn't be ideal.

I've been trying to think of a way to get it to work without disturbing
the user interface that already exists.  Maybe it would be possible
fixup the result in a post-insertion hook if one existed - such a hook
might be generally useful anyway.

In the long term though, I really think that the preview should be
allowed to overlap with the text already typed and potentially replace
it when the completion is inserted, but I appreciate that it would be a
big change in the internals to please a minority.

Morgan

-- 
Morgan Willcock




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#73234; Package emacs. Full text available.

Message received at 73234 <at> debbugs.gnu.org:


Received: (at 73234) by debbugs.gnu.org; 17 Sep 2024 19:04:11 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Sep 17 15:04:11 2024
Received: from localhost ([127.0.0.1]:55962 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sqdUh-0006sE-CJ
	for submit <at> debbugs.gnu.org; Tue, 17 Sep 2024 15:04:11 -0400
Received: from mail.eshelyaron.com ([107.175.124.16]:40954 helo=eshelyaron.com)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <me@HIDDEN>) id 1sqdUf-0006s6-Qe
 for 73234 <at> debbugs.gnu.org; Tue, 17 Sep 2024 15:04:10 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eshelyaron.com;
 s=mail; t=1726599834;
 bh=bvwvp8ZknCEOZUfVyN2vHzTiPd2AhR9WycMyqUPxAZc=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=W9cxZX8qgjS2l8+YAU3VEQl077cA8l+3/MNAO65vs4HUzP8h/7Mma9cyoPugE/FJw
 cqkEwkbS/bICH31IKq1I41scSjP5tG3wSz1KCemal3zCig7DgwWH03diFT+Mg35jvj
 uPojbcld0Pc3VJBmP30iO3aK5UCVLNaricRiFsld2v7a37uJnZALhIwDY/sTrAGwsU
 EI9c0RZ/U6aEzj93pKJeYr166jMDV9Aragofh1oO+v/SSGFyfK8GKDiDzmin2aKw5C
 2m2366ZILjjBerMDzDqhbALSkhF+9y039Kuw1qg2y4yJeO1KcQOFKZecGVQC+6cuWK
 VZKz4gkk693eQ==
From: Eshel Yaron <me@HIDDEN>
To: Morgan Willcock <morgan@HIDDEN>
Subject: Re: bug#73234: 30.0.91; completion-preview-mode doesn't trigger for
 case-insensitive capf
In-Reply-To: <m1ttehbet9.fsf@HIDDEN> (Eshel Yaron's message of "Sun,
 15 Sep 2024 08:40:02 +0200")
References: <875xqzicit.fsf@HIDDEN> <m1mska7oox.fsf@HIDDEN>
 <871q1m36jw.fsf@HIDDEN> <m134m22oh9.fsf@HIDDEN>
 <87o74q7ylr.fsf@HIDDEN> <m1ttehbet9.fsf@HIDDEN>
Date: Tue, 17 Sep 2024 21:03:52 +0200
Message-ID: <m1zfo685lz.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 73234
Cc: 73234 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Eshel Yaron <me@HIDDEN> writes:

[...]

>>> 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 :|

FYI, I've added a new user option completion-preview-ignore-case on the
master branch (commit f1794a17b62), which controls case sensitivity for
Completion Preview mode specifically.  This is definitely safe to set
buffer-locally.  The docstring of this new variable should hopefully
also explain exactly what's the expected behavior in this regard.


Cheers,

Eshel




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#73234; Package emacs. Full text available.

Message received at 73234 <at> debbugs.gnu.org:


Received: (at 73234) by debbugs.gnu.org; 15 Sep 2024 06:40:23 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Sep 15 02:40:23 2024
Received: from localhost ([127.0.0.1]:48192 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1spivj-0006dD-3j
	for submit <at> debbugs.gnu.org; Sun, 15 Sep 2024 02:40:23 -0400
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 <me@HIDDEN>) id 1spivg-0006bu-RJ
 for 73234 <at> 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==
From: Eshel Yaron <me@HIDDEN>
To: Morgan Willcock <morgan@HIDDEN>
Subject: Re: bug#73234: 30.0.91; completion-preview-mode doesn't trigger for
 case-insensitive capf
In-Reply-To: <87o74q7ylr.fsf@HIDDEN> (Morgan Willcock's message of "Sat, 
 14 Sep 2024 21:46:08 +0100")
References: <875xqzicit.fsf@HIDDEN> <m1mska7oox.fsf@HIDDEN>
 <871q1m36jw.fsf@HIDDEN> <m134m22oh9.fsf@HIDDEN>
 <87o74q7ylr.fsf@HIDDEN>
Date: Sun, 15 Sep 2024 08:40:02 +0200
Message-ID: <m1ttehbet9.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 73234
Cc: 73234 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hi,

Morgan Willcock <morgan@HIDDEN> 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




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#73234; Package emacs. Full text available.

Message received at 73234 <at> debbugs.gnu.org:


Received: (at 73234) by debbugs.gnu.org; 14 Sep 2024 20:46:35 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Sep 14 16:46:35 2024
Received: from localhost ([127.0.0.1]:47844 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1spZf9-0006hC-39
	for submit <at> debbugs.gnu.org; Sat, 14 Sep 2024 16:46:35 -0400
Received: from relay7-d.mail.gandi.net ([217.70.183.200]:46599)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <morgan@HIDDEN>) id 1spZf2-0006gV-5Z
 for 73234 <at> debbugs.gnu.org; Sat, 14 Sep 2024 16:46:34 -0400
Received: by mail.gandi.net (Postfix) with ESMTPSA id 4F21120003;
 Sat, 14 Sep 2024 20:46:09 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ice9.digital;
 s=gm1; t=1726346770;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
 in-reply-to:in-reply-to:references:references;
 bh=FXWw0xC5YOUS01Zmm8cOimZR4tGyCUE7UPLCYV/uBOA=;
 b=Ti+hRST2eltOGjIbR2TuqCu0tlksLmcllk3PbsSJB6nkACEjN9p49rl/x3+fNS2Cjdqqe8
 pD/Gk7MytCoMWOsRZj50/Uqxh/RVeBfy4tmej7C7Zt0xDe18eemlzp1M50fIiJhiLaBzOe
 CXTwE74RH0bbTYm0z9ovBWewmcKUh8BkZAVMVPXngWk8hVBnHRaWTOvEq16e6m5GKXuYmj
 0f6FVTuIoklriKlo2dqBGlJQlaI7iPYq5geuwbcksvw3mm/og5a/W+47HDsAzJYmY57x/D
 Y6JC5R3NEZhEdKMNVZ5PjIac0gsUtDAKro37YvURj8mcYFeGBb860Yq+SNSLdw==
From: Morgan Willcock <morgan@HIDDEN>
To: Eshel Yaron <me@HIDDEN>
Subject: Re: bug#73234: 30.0.91; completion-preview-mode doesn't trigger for
 case-insensitive capf
In-Reply-To: <m134m22oh9.fsf@HIDDEN> (Eshel Yaron's message of "Sat,
 14 Sep 2024 18:23:46 +0200")
References: <875xqzicit.fsf@HIDDEN> <m1mska7oox.fsf@HIDDEN>
 <871q1m36jw.fsf@HIDDEN> <m134m22oh9.fsf@HIDDEN>
Date: Sat, 14 Sep 2024 21:46:08 +0100
Message-ID: <87o74q7ylr.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-GND-Sasl: morgan@HIDDEN
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 73234
Cc: 73234 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

Eshel Yaron <me@HIDDEN> writes:

>>> 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.

It was just the name.  I assumed it to be a preview of the same
completions which are in normal use, rather than a separate mechanism.

>> and would indicate when a completion was available to use.
>
> That it does, for prefix completions.

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?

If the completion at point function is case-insensitive at which point
in the process is that case-insensitivity being lost?

>> 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 :)

Yes, I appreciate that the aim is just to show the preview, but it does
actually function as an entry point if the input produces multiple
matches.

(It works less well with the default completion interface because it is
fairly easy to leave the completion buffer open, but the default
behaviour of Corfu aligns with it quite well because the Corfu frame
automatically closes.)

> 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.

I think my main point is that I wouldn't necessarily know to press C-M-i
because of the lack of preview.

>>> 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.

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.

> 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?

>> 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!)

I don't think there are any restrictions on where cape-capf-case-fold
can be used, but fundamentally the only goal is to insert the completion
in the same form that it was returned from the completion at point
function, but not require the user to match the case.

Or to put it another way, because completion-ignore-case cannot be
buffer-local, cape-capf-case-fold is the only feasible way I've seen to
make a case-insensitive language easier to complete.

> 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.

Thank you for the quick and detailed reply,
Morgan

-- 
Morgan Willcock




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#73234; Package emacs. Full text available.

Message received at 73234 <at> debbugs.gnu.org:


Received: (at 73234) by debbugs.gnu.org; 14 Sep 2024 16:24:11 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Sep 14 12:24:11 2024
Received: from localhost ([127.0.0.1]:47715 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1spVZC-0000Dp-NO
	for submit <at> debbugs.gnu.org; Sat, 14 Sep 2024 12:24:11 -0400
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 <me@HIDDEN>) id 1spVZ9-0000Df-Qy
 for 73234 <at> 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==
From: Eshel Yaron <me@HIDDEN>
To: Morgan Willcock <morgan@HIDDEN>
Subject: Re: bug#73234: 30.0.91; completion-preview-mode doesn't trigger for
 case-insensitive capf
In-Reply-To: <871q1m36jw.fsf@HIDDEN> (Morgan Willcock's message of "Sat, 
 14 Sep 2024 10:53:23 +0100")
References: <875xqzicit.fsf@HIDDEN> <m1mska7oox.fsf@HIDDEN>
 <871q1m36jw.fsf@HIDDEN>
Date: Sat, 14 Sep 2024 18:23:46 +0200
Message-ID: <m134m22oh9.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 73234
Cc: 73234 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Morgan Willcock <morgan@HIDDEN> writes:

> Eshel Yaron <me@HIDDEN> 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




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#73234; Package emacs. Full text available.

Message received at 73234 <at> debbugs.gnu.org:


Received: (at 73234) by debbugs.gnu.org; 14 Sep 2024 09:54:06 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Sep 14 05:54:06 2024
Received: from localhost ([127.0.0.1]:44860 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1spPTh-0002BL-Jz
	for submit <at> debbugs.gnu.org; Sat, 14 Sep 2024 05:54:05 -0400
Received: from relay6-d.mail.gandi.net ([217.70.183.198]:35489)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <morgan@HIDDEN>) id 1spPTe-0002Aj-OK
 for 73234 <at> debbugs.gnu.org; Sat, 14 Sep 2024 05:54:04 -0400
Received: by mail.gandi.net (Postfix) with ESMTPSA id D1227C0002;
 Sat, 14 Sep 2024 09:53:24 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ice9.digital;
 s=gm1; t=1726307605;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
 in-reply-to:in-reply-to:references:references;
 bh=jKLWSA899hdIy8sPjpvZHJFpSsZ4Pz0O2H+K2q1M+G8=;
 b=ctfywMM3N6jlSNqkOGPNk9Gfks1bu3FAn/KC61rzndShqJ0TVcaRISUAB8I+tAz8WWGHBz
 H8TUK8M5wmv+5ZiIRtyG76YpY6FZG+ZdZ0dNe++N9RTUESLL8Rz+oYAsZufuTYQJF77Iuq
 sIMDFdsMz+Ml9uVDo/UROhb6PuB55JoUvYSiYVQOT+J2UAFKYFDe17tBT3lfyzFtScHKdT
 8S2X54OF0YSPMgt42o2dGZ6FuKzfyv6/RJNsmtjnPTUjjqP2fcLsmWtLCCecNIKn5pt+bX
 h+L8/sP+v8EBLK34lz6/ovRNzewG1Erd9XtKmw3xjHLadcpW/3bLXMdhAxnlJw==
From: Morgan Willcock <morgan@HIDDEN>
To: Eshel Yaron <me@HIDDEN>
Subject: Re: bug#73234: 30.0.91; completion-preview-mode doesn't trigger for
 case-insensitive capf
In-Reply-To: <m1mska7oox.fsf@HIDDEN> (Eshel Yaron's message of "Sat,
 14 Sep 2024 08:07:58 +0200")
References: <875xqzicit.fsf@HIDDEN> <m1mska7oox.fsf@HIDDEN>
Date: Sat, 14 Sep 2024 10:53:23 +0100
Message-ID: <871q1m36jw.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-GND-Sasl: morgan@HIDDEN
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 73234
Cc: 73234 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

Eshel Yaron <me@HIDDEN> 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, and would indicate when a
completion was available to use.

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.

> 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.  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,
Morgan

-- 
Morgan Willcock




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#73234; Package emacs. Full text available.

Message received at 73234 <at> debbugs.gnu.org:


Received: (at 73234) by debbugs.gnu.org; 14 Sep 2024 06:08:14 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Sep 14 02:08:14 2024
Received: from localhost ([127.0.0.1]:44540 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1spLx8-0006CK-6t
	for submit <at> debbugs.gnu.org; Sat, 14 Sep 2024 02:08:14 -0400
Received: from mail.eshelyaron.com ([107.175.124.16]:56014 helo=eshelyaron.com)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <me@HIDDEN>) id 1spLx6-0006CC-7m
 for 73234 <at> debbugs.gnu.org; Sat, 14 Sep 2024 02:08:13 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eshelyaron.com;
 s=mail; t=1726294081;
 bh=ZbJUY4JjGmZA7SLvq62jDbg73XcO+WP5jQcptr/2bJA=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=MmeZ6Vlc9Df3AdZ+OxFacct5oCkCIz3Z2+VbRUDZYZEdd6p85sbZ99M0RyAiXVUas
 fFIBud+Icvr5r0IQ5RvWqyO+RSoTnqy09Yq5tQz9qmH+2Zq9ZHAbxmo42C3QZ8dghc
 gLI0iJetU0tDWWtGObyjgO31QShsXMratsWbSpcjCaTpRX8jQ8FXz4fE9OSjo/1znJ
 cXK6rNIRSzUatwIFtQAZbXg2AkzeVMOZYNQ7MdONhiVSCI1irTRZb8lvtswg1noAnR
 dCZCIAsYXbDVQa4SGXL2lZLQzGjOfnY9wgZD8dpckexPB9t/3QDDtF18N2uhf3/ium
 /9QDJjsOyGFIQ==
From: Eshel Yaron <me@HIDDEN>
To: Morgan Willcock <morgan@HIDDEN>
Subject: Re: bug#73234: 30.0.91; completion-preview-mode doesn't trigger for
 case-insensitive capf
In-Reply-To: <875xqzicit.fsf@HIDDEN> (Morgan Willcock's message of "Fri, 
 13 Sep 2024 20:23:06 +0100")
References: <875xqzicit.fsf@HIDDEN>
X-Hashcash: 1:20:240914:73234 <at> debbugs.gnu.org::irau31RTlPE7UdfU:KCk
X-Hashcash: 1:20:240914:morgan@HIDDEN::tG1B6nCuklc68mNS:EJkl
Date: Sat, 14 Sep 2024 08:07:58 +0200
Message-ID: <m1mska7oox.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 73234
Cc: 73234 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hello Morgan,

Morgan Willcock <morgan@HIDDEN> writes:

> I believe there is an issue with completion-preview-mode in that it
> doesn't seem to find all completions for a case-insensitive completion
> at point function.

Thanks for this report.

> Evaluating the code below in `emacs -Q` will put the current buffer into
> fundamental mode with a case-insensitive completion at point function:
>
>   (defun test-completion-at-point-function ()
>     "Complete the symbol at point."
>     (pcase (bounds-of-thing-at-point 'symbol)
>       (`(,beg . ,end)
>        (list beg end
>              (completion-table-case-fold
>               (completion-table-dynamic
>                (lambda (string)
>                  (list "TestSymbol"))))))))
>
>   (fundamental-mode)
>   (remove-hook 'completion-at-point-functions #'tags-completion-at-point-function)
>   (add-hook 'completion-at-point-functions #'test-completion-at-point-function)
>   (completion-preview-mode 1)
>
> Once the code is evaluated:
>
> - Typing "tes" into the buffer will not display the completion preview.
>
> - The default completion mechanism (as initiated with complete-symbol
>   via C-M-i) will work with no problems, and replace "tes" with the
>   completion "TestSymbol".
>
> - Typing "Tes" into the buffer will display the completion preview.
>
> I would expect that the completion preview should be displayed for both
> "tes" and "Tes" since a completion is available to use in both cases.

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.

Do you have, or know of, a concrete use case with a completion table
that behaves like your test-completion-at-point-function?


Best,

Eshel




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#73234; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 13 Sep 2024 19:23:39 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Sep 13 15:23:39 2024
Received: from localhost ([127.0.0.1]:44281 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1spBtK-0003ET-Ks
	for submit <at> debbugs.gnu.org; Fri, 13 Sep 2024 15:23:39 -0400
Received: from lists.gnu.org ([209.51.188.17]:41740)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <morgan@HIDDEN>) id 1spBtI-0003EL-Ih
 for submit <at> debbugs.gnu.org; Fri, 13 Sep 2024 15:23:37 -0400
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 <morgan@HIDDEN>)
 id 1spBt8-0001Lt-BL
 for bug-gnu-emacs@HIDDEN; Fri, 13 Sep 2024 15:23:26 -0400
Received: from relay3-d.mail.gandi.net ([217.70.183.195])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <morgan@HIDDEN>)
 id 1spBt3-0001vr-VS
 for bug-gnu-emacs@HIDDEN; Fri, 13 Sep 2024 15:23:25 -0400
Received: by mail.gandi.net (Postfix) with ESMTPSA id 78BF260003
 for <bug-gnu-emacs@HIDDEN>; Fri, 13 Sep 2024 19:23:14 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ice9.digital;
 s=gm1; t=1726255394;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:mime-version:mime-version:content-type:content-type;
 bh=WwQ3P+/o6oyvBN5rjWhJBkQCQn93L7N6S255tpLU9KA=;
 b=b+EMrkokDM4EjdZMiXUA3pw2pZk0KhGLUfXLi0Ho2HOf715LH4zpirW283PQgReCQnulgL
 MrF2NDxMhz1aDy0W3NDWEgNnO6DON+7Fxuv6nDuI3t6tT7uhgi6LN26LPi0kmX7gwA3cba
 QEPhWdQjmlzZBm4OSkqZCX3cjnl46kGK9TFYecYA1Hru1kj29j9zuusWcc0vsK1X+5qtht
 yA8DM4mZ+5qZDa4EQQCZ6BB1nf6rgJD8xj39oyZ2C0fhK8hCDXBzfGR7LEDrTl834Np4E5
 QuRghkZ4JV5XHWi2cc2I0nXHKrQSUUWnqj+/nPhOZf5dZ546yRAJtkvOY24jqw==
From: Morgan Willcock <morgan@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 30.0.91; completion-preview-mode doesn't trigger for
 case-insensitive capf
X-Debbugs-Cc: me@HIDDEN
Date: Fri, 13 Sep 2024 20:23:06 +0100
Message-ID: <875xqzicit.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-GND-Sasl: morgan@HIDDEN
Received-SPF: pass client-ip=217.70.183.195; envelope-from=morgan@HIDDEN;
 helo=relay3-d.mail.gandi.net
X-Spam_score_int: -27
X-Spam_score: -2.8
X-Spam_bar: --
X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
 RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001,
 SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.7 (-)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.7 (--)



I believe there is an issue with completion-preview-mode in that it
doesn't seem to find all completions for a case-insensitive completion
at point function.

Evaluating the code below in `emacs -Q` will put the current buffer into
fundamental mode with a case-insensitive completion at point function:

  (defun test-completion-at-point-function ()
    "Complete the symbol at point."
    (pcase (bounds-of-thing-at-point 'symbol)
      (`(,beg . ,end)
       (list beg end
             (completion-table-case-fold
              (completion-table-dynamic
               (lambda (string)
                 (list "TestSymbol"))))))))

  (fundamental-mode)
  (remove-hook 'completion-at-point-functions #'tags-completion-at-point-function)
  (add-hook 'completion-at-point-functions #'test-completion-at-point-function)
  (completion-preview-mode 1)

Once the code is evaluated:

- Typing "tes" into the buffer will not display the completion preview.

- The default completion mechanism (as initiated with complete-symbol
  via C-M-i) will work with no problems, and replace "tes" with the
  completion "TestSymbol".

- Typing "Tes" into the buffer will display the completion preview.

I would expect that the completion preview should be displayed for both
"tes" and "Tes" since a completion is available to use in both cases.



In GNU Emacs 30.0.91 (build 2, x86_64-pc-linux-gnu, X toolkit, cairo
 version 1.16.0, Xaw3d scroll bars) of 2024-09-12 built on inspiron
Windowing system distributor 'The X.Org Foundation', version 11.0.12101007
System Description: Debian GNU/Linux 12 (bookworm)

Configured using:
 'configure --with-native-compilation=aot --with-xml2
 --with-x-toolkit=lucid'

Configured features:
CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG
LIBSELINUX LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG
SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS WEBP X11 XAW3D
XDBE XIM XINPUT2 XPM LUCID ZLIB

Important settings:
  value of $LANG: en_GB.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: ELisp/d

Minor modes in effect:
  server-mode: t
  global-corfu-mode: t
  corfu-mode: t
  jabber-activity-mode: t
  etags-regen-mode: t
  which-key-mode: t
  global-devil-mode: t
  devil-mode: t
  erc-ring-mode: t
  erc-netsplit-mode: t
  erc-menu-mode: t
  erc-list-mode: t
  erc-irccontrols-mode: t
  erc-move-to-prompt-mode: t
  erc-readonly-mode: t
  erc-imenu-mode: t
  erc-button-mode: t
  erc-fill-mode: t
  erc-stamp-mode: t
  erc-spelling-mode: t
  erc-track-mode: t
  erc-match-mode: t
  erc-autojoin-mode: t
  erc-networks-mode: t
  savehist-mode: t
  minibuffer-electric-default-mode: t
  minibuffer-depth-indicate-mode: t
  ido-everywhere: t
  recentf-mode: t
  global-display-fill-column-indicator-mode: t
  display-fill-column-indicator-mode: t
  global-hl-line-mode: t
  display-time-mode: t
  flyspell-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  minibuffer-regexp-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
/home/mwillcock/.emacs.d/custom/powershell.el/powershell hides /home/mwillcock/.emacs.d/custom/powershell
/home/mwillcock/.emacs.d/elpa/which-key-3.6.1/which-key hides /usr/local/share/emacs/30.0.91/lisp/which-key
/home/mwillcock/.emacs.d/elpa/modus-themes-4.5.0/theme-loaddefs hides /usr/local/share/emacs/30.0.91/lisp/theme-loaddefs

Features:
(shadow sort ecomplete mail-extr emacsbug cursor-sensor server cal-iso
autorevert face-remap init corfu sly sly-completion sly-buttons
sly-messages sly-common apropos etags fileloop arc-mode archive-mode
hyperspec powershell php-mode mode-local consult-imenu consult php-face
php php-project jabber jabber-ourversion hippie-exp hexrgb fsm sgml-mode
facemenu srv dns starttls tls goto-addr yaml-mode markdown-mode lua-mode
advice edmacro kmacro etags-regen kixtart-docstrings cape kixtart-mode
tempo org-msg let-alist color ox-odt rng-loc rng-uri rng-parse rng-match
rng-dt rng-util rng-pttrn nxml-parse nxml-ns nxml-enc xmltok nxml-util
ox-latex ox-icalendar ox-html table ox-ascii ox-publish ox org-attach
htmlize gnus-msg gnus-icalendar icalendar gnus-dired gnus-cite which-key
devil delight comp comp-cstr ags-mode speedbar ezimage dframe shadowfile
eglot jsonrpc xref flymake diff ert ewoc debug backtrace warnings python
project cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align
cc-engine cc-vars cc-defs erc-ring erc-netsplit erc-menu erc-list
erc-goodies erc-imenu imenu erc-pcomplete erc-button erc-fill erc-stamp
erc-sasl erc-sasl-ecdsa-nist256p-challenge erc-sasl-scram-sha-512
erc-sasl-scram-sha-256 erc-sasl-scram-sha-1 erc-sasl-external
erc-sasl-plain sasl-scram-sha256 sasl-scram-rfc sasl-scram-sha-1 rfc2104
hex-util sasl sasl-anonymous sasl-login sasl-plain erc-spelling
erc-track erc-match erc-join erc erc-backend erc-networks erc-common
erc-compat compat erc-loaddefs ediff ediff-merg ediff-mult ediff-wind
ediff-diff ediff-help ediff-init ediff-util vc-git diff-mode
track-changes vc-dispatcher org-indent oc-basic cl-extra ol-eww eww
url-queue mm-url ol-rmail ol-mhe ol-irc ol-info ol-gnus nnselect
gnus-art mm-uu mml2015 gnus-sum ol-docview doc-view filenotify jka-compr
image-mode exif ol-bibtex bibtex ol-bbdb ol-w3m ol-doi org-link-doi appt
diary-lib diary-loaddefs org-capture ob-shell ob-plantuml ob-dot
org-goto org-clock comp-run comp-common org-duration org-agenda
org-element org-persist org-id org-element-ast inline avl-tree generator
org-refile org ob ob-tangle ob-ref ob-lob ob-table ob-exp org-macro
org-src sh-script smie treesit executable ob-comint org-pcomplete
org-list org-footnote org-faces org-entities noutline outline
ob-emacs-lisp ob-core ob-eval org-version org-cycle org-table ol
org-fold org-fold-core org-keys oc org-loaddefs thingatpt org-compat
org-macs autoinsert compile bookmark savehist crm minibuf-eldef mb-depth
ido tramp-cache time-stamp tramp-sh tramp rx trampver tramp-integration
files-x tramp-message tramp-compat xdg format-spec tramp-loaddefs
recentf tree-widget shell pcomplete comint ansi-osc ansi-color ring
easy-mmode display-fill-column-indicator hl-line time gnus-group
gnus-undo gnus-start gnus-dbus dbus gnus-cloud nnimap nnmail mail-source
utf7 nnoo parse-time iso8601 gnus-spec gnus-int gnus-range gnus-win gnus
nnheader range cus-edit pp cus-load wid-edit dictionary
external-completion dictionary-connection flyspell ispell shr pixel-fill
kinsoku url-file svg xml dom modus-vivendi-theme modus-themes mm-view
mml-smime smime gnutls dig smtpmail message sendmail yank-media puny
dired dired-loaddefs rfc822 mml mml-sec epa derived epg rfc6068
gnus-util text-property-search time-date mm-decode mm-bodies mm-encode
mail-parse rfc2231 rfc2047 rfc2045 mm-util ietf-drums mail-prsvr
mailabbrev mail-utils gmm-utils mailheader epg-config help-mode dabbrev
find-func cal-menu calendar cal-loaddefs desktop frameset pcase
cape-autoloads consult-autoloads corfu-autoloads delight-autoloads
do-at-point-autoloads fsm-autoloads htmlize-autoloads lua-mode-autoloads
markdown-mode-autoloads modus-themes-autoloads package-lint-autoloads
php-mode-autoloads rainbow-mode-autoloads renpy-mode-autoloads
sly-autoloads totp-auth-autoloads base32-autoloads info
vertico-autoloads wgrep-autoloads which-key-autoloads
yaml-mode-autoloads package browse-url url url-proxy url-privacy
url-expand url-methods url-history url-cookie generate-lisp-file
url-domsuf url-util mailcap url-handlers url-parse auth-source cl-seq
eieio eieio-core cl-macs icons password-cache json subr-x map byte-opt
gv bytecomp byte-compile url-vars cl-loaddefs cl-lib rmc iso-transl
tooltip cconv eldoc paren electric uniquify ediff-hook vc-hooks
lisp-float-type elisp-mode mwheel term/x-win x-win term/common-win x-dnd
touch-screen tool-bar dnd fontset image regexp-opt fringe tabulated-list
replace newcomment text-mode lisp-mode prog-mode register page tab-bar
menu-bar rfn-eshadow isearch easymenu timer select scroll-bar mouse
jit-lock font-lock syntax font-core term/tty-colors frame minibuffer
nadvice seq simple cl-generic indonesian philippine cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese composite emoji-zwj charscript charprop
case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure
cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp
files window text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget keymap hashtable-print-readable backquote
threads dbusbind inotify dynamic-setting system-font-setting
font-render-setting cairo x-toolkit xinput2 x multi-tty move-toolbar
make-network-process native-compile emacs)

Memory information:
((conses 16 1662552 108846) (symbols 48 50603 5)
 (strings 32 260961 5577) (string-bytes 1 7128489) (vectors 16 148988)
 (vector-slots 8 2543291 190764) (floats 8 781 818)
 (intervals 56 123265 150) (buffers 984 21))




Acknowledgement sent to Morgan Willcock <morgan@HIDDEN>:
New bug report received and forwarded. Copy sent to me@HIDDEN, bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to me@HIDDEN, bug-gnu-emacs@HIDDEN:
bug#73234; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sun, 12 Jan 2025 05:45:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.