Skip to content

Commit aab027c

Browse files
committed
Fix corfu config
- Turn off eglot in Python shell, due to dummy completion bugs - Other minor fixes, and features from corfu docs.
1 parent cd4e686 commit aab027c

File tree

1 file changed

+34
-2
lines changed

1 file changed

+34
-2
lines changed

lisp/init-completion.el

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,35 @@
2020
;; `global-corfu-modes' to exclude certain modes.
2121
(global-corfu-mode)
2222

23-
:custom
23+
:config
2424
;; disable popup in eshell mode
2525
(add-hook 'eshell-mode-hook
2626
(lambda ()
2727
(setq-local corfu-auto nil)
28-
(corfu-mode)))
28+
(setq-local completion-styles '(basic))))
29+
30+
;; Only useful in elisp, but it's global ... test if breaks anything?
31+
;; (corfu-echo-mode)
32+
33+
;; corfu+eglot seems to be broken in python shell
34+
;; returning broken candidates __0_dummy_completion__, inserted by python-mode
35+
(add-hook 'inferior-python-mode-hook
36+
(lambda ()
37+
(setq-local completion-styles '(basic))))
38+
39+
;; Option to move completion to minibuffer when corfu is active
40+
;; https://github.com/minad/corfu#transfer-completion-to-the-minibuffer
41+
(defun corfu-move-to-minibuffer ()
42+
(interactive)
43+
(pcase completion-in-region--data
44+
(`(,beg ,end ,table ,pred ,extras)
45+
(let ((completion-extra-properties extras)
46+
completion-cycle-threshold completion-cycling)
47+
(consult-completion-in-region beg end table pred)))))
48+
(keymap-set corfu-map "M-m" #'corfu-move-to-minibuffer)
49+
(add-to-list 'corfu-continue-commands #'corfu-move-to-minibuffer)
2950

51+
:custom
3052
;; Disable indentation+completion using the TAB key.
3153
(tab-always-indent t)
3254

@@ -40,6 +62,16 @@
4062
(read-extended-command-predicate #'command-completion-default-include-p)
4163
)
4264

65+
;; Emacs 30 and newer: Disable Ispell completion function.
66+
;; Try `cape-dict' as an alternative.
67+
(setq text-mode-ispell-word-completion nil)
68+
69+
;; New inline preview in emacs 30
70+
;; https://www.masteringemacs.org/article/whats-new-in-emacs-301
71+
(use-package completion-preview
72+
:ensure nil
73+
)
74+
4375

4476
(use-package hippie-exp
4577
:ensure nil

0 commit comments

Comments
 (0)