all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eshel Yaron via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Morgan Willcock <morgan@ice9.digital>
Cc: 73234@debbugs.gnu.org
Subject: bug#73234: 30.0.91; completion-preview-mode doesn't trigger for case-insensitive capf
Date: Sat, 14 Sep 2024 08:07:58 +0200	[thread overview]
Message-ID: <m1mska7oox.fsf@dazzs-mbp.home> (raw)
In-Reply-To: <875xqzicit.fsf@ice9.digital> (Morgan Willcock's message of "Fri,  13 Sep 2024 20:23:06 +0100")

Hello Morgan,

Morgan Willcock <morgan@ice9.digital> 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





  reply	other threads:[~2024-09-14  6:07 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-13 19:23 bug#73234: 30.0.91; completion-preview-mode doesn't trigger for case-insensitive capf Morgan Willcock
2024-09-14  6:07 ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2024-09-14  9:53   ` Morgan Willcock
2024-09-14 16:23     ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-14 20:46       ` Morgan Willcock
2024-09-15  6:40         ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-17 19:03           ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-18 20:23             ` Morgan Willcock
2024-09-19  5:39               ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-19 14:59                 ` Morgan Willcock

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m1mska7oox.fsf@dazzs-mbp.home \
    --to=bug-gnu-emacs@gnu.org \
    --cc=73234@debbugs.gnu.org \
    --cc=me@eshelyaron.com \
    --cc=morgan@ice9.digital \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.