Skip to content

Latest commit

 

History

History
55 lines (45 loc) · 2.47 KB

README-FLYCHECK.md

File metadata and controls

55 lines (45 loc) · 2.47 KB

flycheck-aspell

GitHub License GitHub Workflow Status flycheck-aspell on MELPA

Basic usage

For natively supported modes, register your preferred checkers with Flycheck and then start flycheck-mode in the buffer you would like to spell-check.

;; Ensure `flycheck-aspell' is available
(require 'flycheck-aspell)
;; If you want to check TeX/LaTeX/ConTeXt buffers
(add-to-list 'flycheck-checkers 'tex-aspell-dynamic)
;; If you want to check Markdown/GFM buffers
(add-to-list 'flycheck-checkers 'markdown-aspell-dynamic)
;; If you want to check HTML buffers
(add-to-list 'flycheck-checkers 'html-aspell-dynamic)
;; If you want to check XML/SGML buffers
(add-to-list 'flycheck-checkers 'xml-aspell-dynamic)
;; If you want to check Nroff/Troff/Groff buffers
(add-to-list 'flycheck-checkers 'nroff-aspell-dynamic)
;; If you want to check Texinfo buffers
(add-to-list 'flycheck-checkers 'texinfo-aspell-dynamic)
;; If you want to check comments and strings for C-like languages
(add-to-list 'flycheck-checkers 'c-aspell-dynamic)
;; If you want to check message buffers
(add-to-list 'flycheck-checkers 'mail-aspell-dynamic)

If you want to enable spell checking for a mode that is not in the above list, you should define and register an additional checker for that mode as seen below.

;; Because Aspell does not support Org syntax, the user has
;; to define a checker with the desired flags themselves.
(flycheck-aspell-define-checker "org"
  "Org" ("--add-filter" "url")
  (org-mode))
(add-to-list 'flycheck-checkers 'org-aspell-dynamic)

It might be wise to skim the Flycheck docs to learn how to best use and configure Flycheck.

Other configuration snippets

You may also want to advice ispell-pdict-save to refresh flycheck when inserting new entries into your local dictionary. This way highlighting instantly updates when you add a previously unknown word.

(advice-add #'ispell-pdict-save :after #'flycheck-maybe-recheck)
(defun flycheck-maybe-recheck (_)
  (when (bound-and-true-p flycheck-mode)
   (flycheck-buffer)))