From a4fc16d36f8a2e719a490524382f0c0801b093c4 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Fri, 5 Apr 2024 11:57:25 -0400 Subject: [PATCH] refactor(corfu): use hook symbols in add-hook! calls A common challenge for beginners is distinguishing packages, modes, and hooks, and since Doom's source code is meant to second as another layer of documentation, I prefer to be explicit with hook symbols in `add-hook!` calls (at least, for internal/module use). --- modules/completion/corfu/config.el | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/modules/completion/corfu/config.el b/modules/completion/corfu/config.el index 442ce2d52..a00c41749 100644 --- a/modules/completion/corfu/config.el +++ b/modules/completion/corfu/config.el @@ -102,10 +102,10 @@ use the minibuffer such as `query-replace'.") (use-package! cape :defer t :init - (add-hook! prog-mode + (add-hook! 'prog-mode-hook (defun +corfu-add-cape-file-h () (add-hook 'completion-at-point-functions #'cape-file -10 t))) - (add-hook! (org-mode markdown-mode) + (add-hook! '(org-mode-hook markdown-mode-hook) (defun +corfu-add-cape-elisp-block-h () (add-hook 'completion-at-point-functions #'cape-elisp-block 0 t))) ;; Enable Dabbrev completion basically everywhere as a fallback. @@ -114,8 +114,12 @@ use the minibuffer such as `query-replace'.") ;; Set up `cape-dabbrev' options. (defun +dabbrev-friend-buffer-p (other-buffer) (< (buffer-size other-buffer) +corfu-buffer-scanning-size-limit)) - (add-hook! (prog-mode text-mode conf-mode comint-mode minibuffer-setup - eshell-mode) + (add-hook! '(prog-mode-hook + text-mode-hook + conf-mode-hook + comint-mode-hook + minibuffer-setup-hook + eshell-mode-hook) (defun +corfu-add-cape-dabbrev-h () (add-hook 'completion-at-point-functions #'cape-dabbrev 20 t))) (after! dabbrev