doomemacs/modules/feature/spellcheck/config.el
Henrik Lissner 4856217c84
Set default ispell-dictionary
Prevents wrong-type-argument stringp errors when starting flyspell-mode.
2018-06-15 21:25:32 +02:00

38 lines
1.2 KiB
EmacsLisp

;;; 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)")
;; `ispell'
(setq ispell-dictionary "english")
(def-package! flyspell ; built-in
:defer t
:init
(add-hook 'flyspell-mode-hook #'+spellcheck|immediately)
:config
(setq ispell-list-command "--list"
ispell-extr-args '("--dont-tex-check-comments"))
(defun +spellcheck|immediately ()
"Spellcheck the buffer when `flyspell-mode' is enabled."
(when (and flyspell-mode +spellcheck-immediately)
(flyspell-buffer))))
(def-package! flyspell-correct
:commands (flyspell-correct-word-generic
flyspell-correct-previous-word-generic)
:config
(cond ((featurep! :completion helm)
(require 'flyspell-correct-helm))
((featurep! :completion ivy)
(require 'flyspell-correct-ivy))
((require 'flyspell-correct-popup)
(setq flyspell-popup-correct-delay 0.8)
(define-key popup-menu-keymap [escape] #'keyboard-quit))))