Closed accelbread closed 2 years ago
I would accept a PR which adds a general minimum input capf wrapper. All such general functionality is ideally provided by wrappers since it may be useful in many scenarios.
The wrapper can be used like this:
(setq completion-at-point-functions
(list (cape-capf-prefix-length #'cape-dabbrev 2)))
This looks generally useful, allowing you to enable "rare" CAPFs once prefix lengths are long. But wouldn't corfu-auto-prefix=2
also have worked in this instance?
@jdtsmith I am not sure, but the idea of allowing different prefix lengths per capf has come up before in other Corfu issues.
Thanks! Appreciate the update!
corfu-auto-prefix wasn't sufficient as I wanted the prior capf to work with 1 character; this fixes my issue though.
Hi, I'm having an issue where cape-dabbrev is overriding a prior capf.
I'm using corfu with corfu-auto. In a buffer where cape-dabbrev is after another capf, and the first capf only completes after 2 characters, the first capf does not show. After the first character, I get completions from cape-dabbrev, and additional characters keep narrowing dabbrev results.
In order to fix this I modified cape-dabbrev to use another variable for minimum prefix length. If the prefix length for the completion would be shorter, it just returns nil. By setting it to 2, my completions worked as expected with dabbrev only showing after 2 characters and if the prior capf didn't have completions.
Alternatively, perhaps could add a capf wrapper that only returns results if the prefix is long enough.
If you would be interested in adding such functionality, I'd be willing to make a PR, but wanted to know before I go and try to figure out how to do the copyright assignment.