[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#70381: [PATCH] New command 'completion-preview-complete'
From: |
Eshel Yaron |
Subject: |
bug#70381: [PATCH] New command 'completion-preview-complete' |
Date: |
Sun, 14 Apr 2024 13:21:54 +0200 |
Tags: patch
Following a recent discussion on emacs-devel[0], this patch adds a new
command for Completion Preview mode that completes the symbol at point up
to the longest common prefix of all completion candidates. This patch
also adds a visual indication for the longest common prefix when showing
it as part of the completion preview, so the user can tell how far the new
'completion-preview-complete' will complete before invoking this command.
For example, if the symbol at point is "foo", and the completion
candidates are "foobar" and "foobaz", then the preview shows "bar" with
the common prefix "ba" highlighted in face 'completion-preview-common'.
To provide this feature efficiently, this patch modifies the way we store
the completion candidates while the preview is visible. This amounts to
quite a few changes, so I added some tests to make sure nothing breaks,
and a bunch of comments to clarify what each part is doing.
One thing I'm not sure about is the keybinding for the new command. In
Company, the command that inserts the common part (like the new
'completion-preview-complete' does) is bound to TAB, but we already use
TAB for 'completion-preview-insert', which inserts the entire candidate.
(Note that these bindings are only in effect when the preview is visible.)
The analogous command to 'completion-preview-insert' in Company is bound
to RET, but I feel that binding RET may be too intrusive to do by default.
For demonstration purposes, 'completion-preview-complete' is bound to M-i
in this patch. Suggestions for a better choice of keybinding, and any
other comments, would be most welcome :)
Thanks,
Eshel
[0] https://lists.gnu.org/archive/html/emacs-devel/2024-04/msg00154.html
0001-New-command-completion-preview-complete.patch
Description: Text Data
- bug#70381: [PATCH] New command 'completion-preview-complete',
Eshel Yaron <=