spellcheck.el 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  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
  8. '("--run-together" "--run-together-limit=5" "--run-together-min=2")
  9. )))
  10. ((string-match "hunspell$" ispell-program-name)
  11. "-d en_US")))
  12. (use-package flyspell-correct-popup
  13. :bind ("M-s" . ispell-word)
  14. :hook ((text-mode . flyspell-mode)
  15. (prog-mode . flyspell-prog-mode)
  16. ((flyspell-mode flyspell-prog-mode) . flyspell-buffer))
  17. :config
  18. ;; Default to aspell, otherwise try hunspell, then give up.
  19. (cond
  20. ((executable-find "aspell")
  21. (setq ispell-program-name "aspell"))
  22. ((executable-find "hunspell")
  23. (setq ispell-program-name "hunspell")
  24. (setq ispell-local-dictionary "en_US")
  25. (setq ispell-local-dictionary-alist
  26. '(("en_US" "[[:alpha:]]" "[^[:alpha:]]" "[']" nil ("-d" "en_US") nil utf-8))))
  27. (t
  28. (setq ispell-program-name nil)))
  29. (setq-default ispell-extra-args (flyspell-detect-ispell-args t))
  30. (setq-default flyspell-issue-message-flag nil))
  31. (provide 'spellcheck)