Subject: bug#67514: 30.0.50; completion preview symbol length calculation should use point

From: Eshel Yaron <[email-masked]>
Date: Tue, 28 Nov 2023 22:46:32 +0100

Géza Herman <[email-masked]> writes:

> I checked out completion-preview, and so far I like it.

Great.

> There is a thing which maybe can be improved (so this is not a bug
> report, just a suggestion): it's how
> completion-preview-require-minimum-symbol-length calculates the
> length.  Currently it just returns the length of the symbol under the
> cursor.  I think it would be better to use the length of the part that
> actually will be used for completion, because if the point is inside a
> word, then it should only consider the part between the symbol start
> end the point.

Could you please explain why you consider that preferable?  The current
behavior is intentional and, unless I'm missing something, correct.
`completion-at-point-functions` take into account text that follows
point as well as the text that precedes point, and Completion Preview
mode works also when you're typing in the middle of a symbol.  For
example, consider the following text in an Elisp buffer:

--8<---------------cut here---------------start------------->8---
(minor
--8<---------------cut here---------------end--------------->8---

With point between the opening parenthesis and the letter "m", type
"define-".  The completion preview displays "-mode" just after "minor",
suggesting that you complete to "define-minor-mode".  That's because the
text after point ("minor", in this case) plays a role too.

Best,

Eshel