;; --- Spellcheck configuration file --- ;; Set up on-the-fly spell checker. (require 'package-loader) (defun flyspell-detect-ispell-args (&optional run-together) (cond ((string-match "aspell$" ispell-program-name) (append (list "--sug-mode=ultra" "--lang=en_US") (if run-together '("--run-together" "--run-together-limit=5" "--run-together-min=2") ))) ((string-match "hunspell$" ispell-program-name) "-d en_US"))) (use-package flyspell-correct-popup :bind ("M-s" . ispell-word) :hook ((text-mode . flyspell-mode) (prog-mode . flyspell-prog-mode) ((flyspell-mode flyspell-prog-mode) . flyspell-buffer)) :config ;; Default to aspell, otherwise try hunspell, then give up. (cond ((executable-find "aspell") (setq ispell-program-name "aspell")) ((executable-find "hunspell") (setq ispell-program-name "hunspell") (setq ispell-local-dictionary "en_US") (setq ispell-local-dictionary-alist '(("en_US" "[[:alpha:]]" "[^[:alpha:]]" "[']" nil ("-d" "en_US") nil utf-8)))) (t (setq ispell-program-name nil))) (setq-default ispell-extra-args (flyspell-detect-ispell-args t)) (setq-default flyspell-issue-message-flag nil)) (provide 'spellcheck)