aboutsummaryrefslogtreecommitdiff
path: root/emacs
diff options
context:
space:
mode:
authorYuchen Pei <id@ypei.org>2024-10-12 11:46:09 +1100
committerYuchen Pei <id@ypei.org>2024-10-12 11:46:09 +1100
commita6a381db15ad5a2134746c92c5847c2808dbfc21 (patch)
tree18562f398058aeec3fccc8857d4d0358c3539b1e /emacs
parent86e5ceb873a498d6cd7853c7db669399bbbe718a (diff)
[emacs] Fix company hang and multiple completion dropdowns in message mode
Diffstat (limited to 'emacs')
-rw-r--r--emacs/.emacs.d/init/ycp-complete.el23
1 files changed, 21 insertions, 2 deletions
diff --git a/emacs/.emacs.d/init/ycp-complete.el b/emacs/.emacs.d/init/ycp-complete.el
index c088356..d123989 100644
--- a/emacs/.emacs.d/init/ycp-complete.el
+++ b/emacs/.emacs.d/init/ycp-complete.el
@@ -156,7 +156,10 @@
;;; corfu does not work well in gud as it "flushes" completion
;;; suggestions to the buffer
;;; https://github.com/minad/corfu/issues/157
- (setq global-corfu-modes '((not gud-mode) t))
+ ;; Only company modes works with bbdb email completion in
+ ;; message-mode, so we remove corfu from message-mode to avoid
+ ;; overlapping multiple completion dropdowns
+ (setq global-corfu-modes '((not gud-mode) (not message-mode) t))
)
;;; We still need company mode because corfu does not work well in
@@ -164,7 +167,16 @@
(my-package company
(:install t)
(:delay 5)
+ ;; corfu does not complete email fields using bbdb
(add-hook 'message-mode-hook #'company-mode)
+ ;; for some reason, having a t in the completion-at-point-functions
+ ;; causes company to hang in message-mode
+ (add-hook 'message-mode-hook
+ (lambda ()
+ (setq-local completion-at-point-functions
+ (delq t
+ completion-at-point-functions))
+ ))
(setq company-idle-delay .1
company-minimum-prefix-length 3
company-selection-wrap-around t
@@ -192,7 +204,14 @@
(message-mode ?' ?')))
(dolist (backend '(cape-elisp-symbol cape-keyword cape-file cape-history
cape-dabbrev))
- (add-to-list 'completion-at-point-functions backend)))
+ (add-to-list 'completion-at-point-functions backend))
+ ;; for some reason, cape-dabbrev causes message-mode to hang with
+ ;; company mode as well
+ ;; (add-hook 'message-mode-hook
+ ;; (lambda ()
+ ;; (add-to-list 'completion-at-point-functions
+ ;; 'cape-dabbrev)))
+ )
(my-package imenu
(:delay 5)