spellcheck.el 1.2 KB

123456789101112131415161718192021222324252627282930313233
  1. ;; --- Spellcheck configuration file ---
  2. ;; Set up on-the-fly spell checker.
  3. (require 'package-loader)
  4. (defun flyspell-detect-ispell-args (&optional run-together)
  5. (cond ((string-match "aspell$" ispell-program-name)
  6. (append (list "--sug-mode=ultra" "--lang=en_US")
  7. (if run-together '("--run-together" "--run-together-limit=5" "--run-together-min=2"))))
  8. ((string-match "hunspell$" ispell-program-name)
  9. "-d en_US")))
  10. (use-package flyspell-correct-popup
  11. :bind ("M-s" . ispell-word)
  12. :hook ((text-mode . flyspell-mode)
  13. (prog-mode . flyspell-prog-mode)
  14. ((flyspell-mode flyspell-prog-mode) . flyspell-buffer))
  15. :config
  16. ;; Default to aspell, otherwise try hunspell, then give up.
  17. (cond
  18. ((executable-find "aspell")
  19. (setq ispell-program-name "aspell"))
  20. ((executable-find "hunspell")
  21. (setq ispell-program-name "hunspell")
  22. (setq ispell-local-dictionary "en_US")
  23. (setq ispell-local-dictionary-alist
  24. '(("en_US" "[[:alpha:]]" "[^[:alpha:]]" "[']" nil ("-d" "en_US") nil utf-8))))
  25. (t
  26. (setq ispell-program-name nil)))
  27. (setq-default ispell-extra-args (flyspell-detect-ispell-args t))
  28. (setq-default flyspell-issue-message-flag nil))
  29. (provide 'spellcheck)