Set up Vale prose linter on Emacs

Published on Mar 5, 2022, by Junji Zhi

Most of my writing happens in Emacs Org-mode. One natural thinking is to let Emacs help me with my writing. This post documents my attempt to set up Vale on Emacs, which lints prose based on the configured writing styles.

First, you need to install Vale. If you are in Mac OS X, brew install vale should do the trick.

Next is to set up .vale.ini file in your home directory, and set up the styles folder. To save time, you can clone the vale-boilerplate repo, which comes with Microsoft styles. Personally, I use proselint.

Your $HOME/.vale.ini should look like:

StylesPath = styles

Vocab = Blog

[*.org]
BasedOnStyles = Microsoft

Then set up flycheck + Vale. I found the setup from Duncan's post that works for me:

(flycheck-define-checker vale
  "A checker for prose"
  :command ("vale" "--output" "line"
            source)
  :standard-input nil
  :error-patterns
  ((error line-start (file-name) ":" line ":" column ":" (id (one-or-more (not (any ":")))) ":" (message) line-end))
  :modes (markdown-mode org-mode text-mode)
  )
(add-to-list 'flycheck-checkers 'vale 'append)

Add the snippet to your Emacs setup, reload, and voila!

Running Vale linter on Emacs and display linting errors.

P.S. I tried following the post Using Vale With Emacs for Prose Linting, but didn't get it to work.

I also tried flycheck-vale package, but it didn't work either.




 Share: