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).
This commit is contained in:
parent
f91d6beaa1
commit
a4fc16d36f
1 changed files with 8 additions and 4 deletions
|
@ -102,10 +102,10 @@ use the minibuffer such as `query-replace'.")
|
||||||
(use-package! cape
|
(use-package! cape
|
||||||
:defer t
|
:defer t
|
||||||
:init
|
:init
|
||||||
(add-hook! prog-mode
|
(add-hook! 'prog-mode-hook
|
||||||
(defun +corfu-add-cape-file-h ()
|
(defun +corfu-add-cape-file-h ()
|
||||||
(add-hook 'completion-at-point-functions #'cape-file -10 t)))
|
(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 ()
|
(defun +corfu-add-cape-elisp-block-h ()
|
||||||
(add-hook 'completion-at-point-functions #'cape-elisp-block 0 t)))
|
(add-hook 'completion-at-point-functions #'cape-elisp-block 0 t)))
|
||||||
;; Enable Dabbrev completion basically everywhere as a fallback.
|
;; Enable Dabbrev completion basically everywhere as a fallback.
|
||||||
|
@ -114,8 +114,12 @@ use the minibuffer such as `query-replace'.")
|
||||||
;; Set up `cape-dabbrev' options.
|
;; Set up `cape-dabbrev' options.
|
||||||
(defun +dabbrev-friend-buffer-p (other-buffer)
|
(defun +dabbrev-friend-buffer-p (other-buffer)
|
||||||
(< (buffer-size other-buffer) +corfu-buffer-scanning-size-limit))
|
(< (buffer-size other-buffer) +corfu-buffer-scanning-size-limit))
|
||||||
(add-hook! (prog-mode text-mode conf-mode comint-mode minibuffer-setup
|
(add-hook! '(prog-mode-hook
|
||||||
eshell-mode)
|
text-mode-hook
|
||||||
|
conf-mode-hook
|
||||||
|
comint-mode-hook
|
||||||
|
minibuffer-setup-hook
|
||||||
|
eshell-mode-hook)
|
||||||
(defun +corfu-add-cape-dabbrev-h ()
|
(defun +corfu-add-cape-dabbrev-h ()
|
||||||
(add-hook 'completion-at-point-functions #'cape-dabbrev 20 t)))
|
(add-hook 'completion-at-point-functions #'cape-dabbrev 20 t)))
|
||||||
(after! dabbrev
|
(after! dabbrev
|
||||||
|
|
Loading…
Reference in a new issue