feature/spellcheck: conditionally spellcheck on load
This commit is contained in:
parent
878b413885
commit
fe2ed9b6f7
1 changed files with 12 additions and 4 deletions
|
@ -1,17 +1,25 @@
|
||||||
;;; feature/spellcheck/config.el -*- lexical-binding: t; -*-
|
;;; feature/spellcheck/config.el -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
|
(defvar-local +spellcheck-immediately t
|
||||||
|
"If non-nil, spellcheck the current buffer upon starting `flyspell-mode'.
|
||||||
|
|
||||||
|
Since spellchecking can be slow in some buffers, this can be disabled with:
|
||||||
|
|
||||||
|
(setq-hook! 'LaTeX-mode-hook +spellcheck-immediately nil)")
|
||||||
|
|
||||||
(def-package! flyspell ; built-in
|
(def-package! flyspell ; built-in
|
||||||
:commands flyspell-mode
|
:commands flyspell-mode
|
||||||
|
:init
|
||||||
|
(add-hook 'flyspell-mode-hook #'+spellcheck|immediately)
|
||||||
:config
|
:config
|
||||||
(setq ispell-program-name (executable-find "aspell")
|
(setq ispell-program-name (executable-find "aspell")
|
||||||
ispell-list-command "--list"
|
ispell-list-command "--list"
|
||||||
ispell-extr-args '("--dont-tex-check-comments"))
|
ispell-extr-args '("--dont-tex-check-comments"))
|
||||||
|
|
||||||
(defun +spellcheck|automatically ()
|
(defun +spellcheck|immediately ()
|
||||||
"Spellcheck the buffer when `flyspell-mode' is enabled."
|
"Spellcheck the buffer when `flyspell-mode' is enabled."
|
||||||
(when flyspell-mode
|
(when (and flyspell-mode +spellcheck-immediately)
|
||||||
(flyspell-buffer)))
|
(flyspell-buffer))))
|
||||||
(add-hook 'flyspell-mode-hook #'+spellcheck|automatically))
|
|
||||||
|
|
||||||
|
|
||||||
(def-package! flyspell-correct
|
(def-package! flyspell-correct
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue