Eshel Yaron [Wed, 1 Nov 2023 11:35:36 +0000 (12:35 +0100)]
Use a dedicated capf instead of rebinding 'C-M-i'
Instead of rebinding 'C-M-i' to a command that inserts the suggested
completion, we make 'completion-at-point' do the right thing when the
preview is active by temporarily adding a prioritized capf.
Thanks to João Távora for suggesting this approach.
* completion-preview.el (completion-preview-active-mode-map): Remove.
(completion-preview--insert):
(completion-preview-insert-function): New functions.
(completion-preview-active-mode): Adjust.
Eshel Yaron [Tue, 31 Oct 2023 18:15:41 +0000 (19:15 +0100)]
Use a dedicated keymap for when the preview active
* completion-preview.el (completion-preview-hide): New function.
(completion-preview-active-mode-map): New keymap.
(completion-preview-active-mode): New minor mode.
(completion-preview--post-command)
(completion-preview-mode)
(completion-preview-show): Adjust.
(completion-preview-insert-or-complete): Remove.
(completion-preview-insert): New command.