2017-06-08 11:47:56 +02:00
|
|
|
;;; feature/spellcheck/config.el -*- lexical-binding: t; -*-
|
2017-02-13 05:51:29 -05:00
|
|
|
|
2018-05-07 22:36:28 +02:00
|
|
|
(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:
|
|
|
|
|
2018-08-02 16:46:04 +02:00
|
|
|
(setq-hook! 'TeX-mode-hook +spellcheck-immediately nil)")
|
2018-05-07 22:36:28 +02:00
|
|
|
|
2018-06-01 02:25:38 +02:00
|
|
|
;; `ispell'
|
2018-08-02 16:40:47 +02:00
|
|
|
(setq ispell-dictionary "english"
|
|
|
|
ispell-list-command "--list"
|
|
|
|
ispell-extr-args '("--dont-tex-check-comments"))
|
2018-06-01 02:25:38 +02:00
|
|
|
|
2018-08-02 21:44:09 +02:00
|
|
|
(after! ispell
|
2018-08-10 23:41:55 +02:00
|
|
|
(when (equal (file-name-base ispell-program-name) "aspell")
|
|
|
|
(add-to-list 'ispell-extra-args "--sug-mode=ultra")))
|
2018-08-02 21:44:09 +02:00
|
|
|
|
|
|
|
|
2017-02-23 00:06:12 -05:00
|
|
|
(def-package! flyspell ; built-in
|
2018-05-25 00:46:11 +02:00
|
|
|
:defer t
|
2018-08-02 16:40:47 +02:00
|
|
|
:init (add-hook 'flyspell-mode-hook #'+spellcheck|immediately)
|
2017-02-19 18:32:26 -05:00
|
|
|
:config
|
2018-05-07 22:36:28 +02:00
|
|
|
(defun +spellcheck|immediately ()
|
2018-01-16 01:55:06 -05:00
|
|
|
"Spellcheck the buffer when `flyspell-mode' is enabled."
|
2018-05-07 22:36:28 +02:00
|
|
|
(when (and flyspell-mode +spellcheck-immediately)
|
|
|
|
(flyspell-buffer))))
|
2017-02-13 05:51:29 -05:00
|
|
|
|
|
|
|
|
2017-02-23 00:06:12 -05:00
|
|
|
(def-package! flyspell-correct
|
2017-02-13 05:51:29 -05:00
|
|
|
:commands (flyspell-correct-word-generic
|
2017-03-19 22:47:50 -04:00
|
|
|
flyspell-correct-previous-word-generic)
|
2017-02-13 05:51:29 -05:00
|
|
|
:config
|
2017-03-19 22:47:50 -04:00
|
|
|
(cond ((featurep! :completion helm)
|
|
|
|
(require 'flyspell-correct-helm))
|
|
|
|
((featurep! :completion ivy)
|
|
|
|
(require 'flyspell-correct-ivy))
|
2018-05-30 01:44:56 +02:00
|
|
|
((require 'flyspell-correct-popup)
|
2017-03-19 22:47:50 -04:00
|
|
|
(setq flyspell-popup-correct-delay 0.8)
|
2017-04-17 02:17:10 -04:00
|
|
|
(define-key popup-menu-keymap [escape] #'keyboard-quit))))
|