Properly lazy load flyspell

Package was eagerly loaded at startup, so we must pretend it hasn't to
defer it and future configuration.

And generalize defer-feature! macro.
This commit is contained in:
Henrik Lissner 2020-06-05 01:41:49 -04:00
parent 85883facf5
commit 5b8b04f0c8
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
2 changed files with 21 additions and 9 deletions

View file

@ -46,6 +46,13 @@
;; messages for every word when checking the entire buffer
flyspell-issue-message-flag nil)
(use-package! flyspell ; built-in
:defer t
:preface
;; `flyspell' is loaded at startup. In order to lazy load its config we need
;; to pretend it isn't loaded.
(defer-feature! flyspell flyspell-mode flyspell-prog-mode)
:init
(add-hook! '(org-mode-hook
markdown-mode-hook
TeX-mode-hook
@ -61,6 +68,12 @@
prog-mode-hook)
#'flyspell-prog-mode))
:config
(setq flyspell-issue-welcome-flag nil
;; Significantly speeds up flyspell, which would otherwise print
;; messages for every word when checking the entire buffer
flyspell-issue-message-flag nil)
(add-hook! 'flyspell-mode-hook
(defun +spell-inhibit-duplicate-detection-maybe-h ()
"Don't mark duplicates when style/grammar linters are present.