Eshel Yaron [Wed, 1 Nov 2023 21:47:02 +0000 (22:47 +0100)]
Only keep the ':exit-function' completion property
Avoid passing on properties such as ':predicate', whose value may be a
function that assume a certain structure of completion candidate,
which may no longer hold.
* completion-preview.el (completion-preview-show): Only keep the
':exit-function' property.
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.