bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#66948: [PATCH] Add Completion Preview mode


From: Eshel Yaron
Subject: bug#66948: [PATCH] Add Completion Preview mode
Date: Wed, 08 Nov 2023 10:14:23 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

Hi Juri,

Juri Linkov <juri@linkov.net> writes:

> While testing more, I noticed one strange thing,
> I don't know if it's intended to work this way.

This is not intended, thanks for raising it!  Essentially, this is a
problem with the default `completion-in-region-function` that I wasn't
aware of (:

> Typing in *scratch* e.g.
>
>   (message-f TAB
>
> completes to
>
>   (message-forward
>
> Then typing
>
>   (message-f M-C-i
>

At this point, `completion-in-region-mode` is enabled.  That's fine.

> stops at
>
>   (message-fo
>

For some reason, `completion-in-region-mode` remains active at point!
This means that `completion-in-region-mode-map` stays in effect, and
that binds TAB to `completion-at-point`, overriding the our binding for
`completion-preview-insert` (and any other binding TAB might have, for
that matter).

> Then trying again the same as in the first test case
>
>   (message-f TAB
>
> now stops at the same too
>
>   (message-fo
>
> whereas the overlay suggests the complete name `message-forward`.

Since TAB is bound to `completion-at-point` at this point, you get the
same result as you did when you pressed `C-M-i` beforehand.  If you
would instead say `M-x completion-preview-insert` explicitly, you should
get the expected `message-forward`.

This appears to be a general problem with `completion-in-region-mode`,
that it keeps TAB bound to `completion-at-point` after a partial
completion, so I don't think we should attempt to handle it in
`completion-preview` specifically.

Consider the following scenario, with no `completion-preview-mode` in
play:

--8<---------------cut here---------------start------------->8---
(defun foo ()
bar-!-
--8<---------------cut here---------------end--------------->8---

Here -!- designates point.  If you type TAB right away, `bar` gets
indented as expected.  But if you first say `C-M-i`, the text stays the
same but now TAB is bound to `completion-at-point`, so pressing TAB no
longer indents and just says "No match" instead :(








reply via email to

[Prev in Thread] Current Thread [Next in Thread]