Skip to content

Instantly share code, notes, and snippets.

@abrochard
Created January 4, 2019 15:51
Show Gist options
  • Save abrochard/f9dc0084290509af7f1ea371c62450b1 to your computer and use it in GitHub Desktop.
Save abrochard/f9dc0084290509af7f1ea371c62450b1 to your computer and use it in GitHub Desktop.
(require 'flycheck)
;; checkout https://www.macs.hw.ac.uk/~rs46/posts/2018-12-29-textlint-flycheck.html
;;
;; sudo npm install -g textlint write-good textlint-plugin-latex textlint-rule-write-good textlint-rule-no-start-duplicated-conjunction textlint-rule-max-comma textlint-rule-terminology textlint-rule-period-in-list-item textlint-rule-unexpanded-acronym textlint-rule-abbr-within-parentheses textlint-rule-alex textlint-rule-common-misspellings textlint-rule-en-max-word-count textlint-rule-diacritics textlint-rule-stop-words
(flycheck-define-checker textlint
"A linter for textlint."
:command ("textlint"
;; "--config" "/home/abrochard/.emacs.d/.textlintrc"
"--format" "unix"
"--rule" "write-good"
"--rule" "no-start-duplicated-conjunction"
"--rule" "max-comma"
"--rule" "terminology"
"--rule" "period-in-list-item"
"--rule" "abbr-within-parentheses"
"--rule" "alex"
"--rule" "common-misspellings"
"--rule" "en-max-word-count"
"--rule" "diacritics"
"--rule" "stop-words"
"--plugin"
(eval
(if (string= "tex" (file-name-extension buffer-file-name))
"latex"
"@textlint/text"))
source-inplace)
:error-patterns
((warning line-start (file-name) ":" line ":" column ": "
(message (one-or-more not-newline)
(zero-or-more "\n" (any " ") (one-or-more not-newline)))
line-end))
:modes (text-mode latex-mode org-mode markdown-mode)
)
(add-to-list 'flycheck-checkers 'textlint)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment