Subject: Re: bug#74410: 31.0.50; completion-at-point doesn't work in custom buffers

From: Juri Linkov <[email-masked]>
Date: Wed, 20 Nov 2024 09:57:59 +0200

> For example:
>
>     src/emacs -Q --eval '(customize-face `fixed-pitch)'
>     ... move point to the font family field ...
>     ... delete the "space" from "Monospace" then do:
>     M-x completion-at-point RET
>
> This will presumably do nothing at all.
> `widget-complete` completes it back to "Monospace" (at least on
> `master` where I installed a patch for that).
>
> The problem is that cus-edit doesn't setup
> `completion-at-point-functions`.  Instead it sets up a special keymap to
> remap M-TAB to `widget-complete` instead of relying on the
> global binding.
>
> It works OK for a default config, but it doesn't interact well with
> setups that use different keybindings or different completion UIs based
> on `completion-at-point-functions`.  E.g. `corfu-mode` partly works but
> not fully (e.g. `corfu-auto` doesn't have any effect).
>
> The patch below leaves the key remapping for now, but adds an
> appropriate function to `completion-at-point-functions` so that
> other UIs such as `completion-at-point` can do their job properly.
>
> Comments/objection?

Now finally it's possible to select a completion using arrow keys
like for in-buffer completions, thanks.

Currently this works only when typing 'M-x completion-at-point RET',
not by 'M-C-i' that is bound to 'widget-complete'.  Maybe
'M-C-i' should be rebound to 'completion-at-point' in widgets?