I’ve been testing this new capf with this module code, and am getting odd behavior, which the author of that package does not see with his non-doom corfu install.
I get the candidate list when in an org buffer, but when I try to select a candidate with RET, it adds a newline to the buffer, rather than inserts the candidate (well, really the result of the :exit-function run on the candidate).
I do not see the same behavior in other major modes (for example, lisp).
Is it possible there’s something in this code that could cause that behavior? Any suggestions on narrowing it down?
I’ve been playing with this module a little bit while doing some eslisp stuff. I find that there is some conflict between doom’s :editor snippets and the TAB completion setup. For example, if I type (set then hit TAB for some corfu goodness, it auto-expands and wrecks the completion. For now I’ve just disabled snippets.
corfu-quit, to [evil-escape] so I can just jk out of the prompt
I think I’ll also disable TAB as a point of entry too. I think C-SPC may be more appropriate, if not auto-completion, which is how doom’s company is set to trigger.
I’ll edit this post to add the actual config when I’m at the computer next.
EDIT: Here’s my remap expression. I don’t know if it’s idiomatic or not, please correct me.
Mostly ignore the code in my last comment. On testing it only worked in elisp mode. I’m still using ‘C-n’ and ‘C-p’ for candidate selection, and ‘jk’ to exit completions.
Also, I think in the config.el of the corfu module, inside the (use-package! cape ... ) expression, we should be adding #'cape-file rather than #'cape-file-capf. This goes for all cape-* capfs in the above-mentioned expression. The latter was giving me errors. I don’t know if minad refactored or something.
I like it. Instead of waiting on Henrik, why not start a draft PR? That way, Henrik can have quick look and/or review comments whenever he wants, and the users get single point of reference on status and pull any new module-specific change?
Ended up solving this by advising +org/return as below, adjust as required
(defadvice! +corfu--org-return (orig) :around '+org/return
(if (and (featurep! :completion corfu) ;; omit if not using via a module
corfu-mode
(>= corfu--index 0)) ;; translates to "there are candidates to select"
(corfu-insert)
(funcall orig)))
Did any of you install corfu-terminal ? It seems that straight doesn’t know of NonGNU ELPA and it seems to bite me because it tries to find a popon package even if I mention the whole rpoe URL for corfu-terminal
It should be okay soon, the issue has been closed and straight can deal with NonGNU ELPA natively. It will needa bump of straight to pull the changes though
I’m experimenting with :completion corfu and I think that there are two keybindings missing. In insert state C-x C-f is bound to find-file, whereas in vim and :completion company it allow to complet the file’s name. So I think C-x C-f should be bound to cape-file in insert state. For same reason C-x C-o should be bound to corfu-next in insert state.
Is there interest in integrating prescient.el with Corfu to improve candidate sorting? It could be put behind a module flag like +prescient in the ivy module.
prescient.el provides a corfu-prescient package that should make integration easy. Its functionality overlaps with corfu-history, so that should be disabled if prescient.el is in use.