diff options
author | Franck Cuny <franck@fcuny.net> | 2022-11-15 07:46:48 -0800 |
---|---|---|
committer | Franck Cuny <franck@fcuny.net> | 2022-11-15 07:46:48 -0800 |
commit | 41b8419997a0ef73538c0473b6989bfb8cde09fc (patch) | |
tree | fb2e1da27893ca4be8034c560147a1f497e71548 | |
parent | fix(eshell): don't set the foreground color (diff) | |
download | emacs.d-41b8419997a0ef73538c0473b6989bfb8cde09fc.tar.gz |
fix(completion): follow the documentation for eshell integration
Change-Id: Id92adf55cc75467b4ea7f98709cf8769f1ad6c2f
-rw-r--r-- | emacs/custom/my-completion.el | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/emacs/custom/my-completion.el b/emacs/custom/my-completion.el index a8629c8..fb6ce66 100644 --- a/emacs/custom/my-completion.el +++ b/emacs/custom/my-completion.el @@ -25,6 +25,23 @@ (setq corfu-auto t) ;; Enable auto completion (setq corfu-max-width 80) ;; Default is 100 and is too wide +(defun corfu-send-shell (&rest _) + "Send completion candidate when inside comint/eshell." + (cond + ((and (derived-mode-p 'eshell-mode) (fboundp 'eshell-send-input)) + (eshell-send-input)) + ((and (derived-mode-p 'comint-mode) (fboundp 'comint-send-input)) + (comint-send-input)))) + +(advice-add #'corfu-insert :after #'corfu-send-shell) + +;; Silence the pcomplete capf, no errors or messages! +(advice-add 'pcomplete-completions-at-point :around #'cape-wrap-silent) + +;; Ensure that pcomplete does not write to the buffer +;; and behaves as a pure `completion-at-point-function'. +(advice-add 'pcomplete-completions-at-point :around #'cape-wrap-purify) + (vertico-mode t) ;; Enable vertico globally (marginalia-mode t) ;; Enable marginalia globally (global-corfu-mode) ;; Enable corfu globally |