Using Vale With Emacs for Prose Linting

After looking into linting prose in Emacs, I found a way to roll your own prose linter setup using vale (an extensible prose linter), efm-langserver (a generic language server), and eglot (a language server mode for Emacs).

Configure efm-langserver

In /${HOME}/.config/efm-langserver/config.yaml add the following setup for linting with vale. (This was difficult to figure out because of the non-existent documentation, but I found someone else’s efm-langserver config for vale).

version: 2
root-markers:
  - .git/
log-file: /{SOME PATH FOR LOGS}/efm.log
log-level: 1
tools:
  vale: &vale-lint
    prefix: vale
    lint-command: 'vale --output line ${INPUT}'
    lint-stdin: false
    lint-ignore-exit-code: true
    lint-formats:
      - '%f:%l:%c:%m'

languages:
  org:
    - <<: *vale-lint

Configure Emacs

In your Emacs init.el, configure eglot to use efm-langserver when using org-mode. Vale has support for org-mode files as of v2.2.

(add-hook 'org-mode-hook #'eglot-ensure)
(add-to-list 'eglot-server-programs '((org-mode) "efm-langserver"))

Now when you open an org-mode file in Emacs you’ll see all your prose linting issues!

See also:

  • Linting Prose in Emacs

    There are a few ways to get linting of prose (grammar and style, not just spellcheck) in Emacs. Unfortunately, there is no good language server implementation for the popular open-source command line tools. The best option right now is probably proselint, but vale gives better suggestions.

  • Turn Emacs into a Focused Writing Tool

    Emacs can be customized to create a beautiful, focused writing environment akin to Ulysses, iA Writer, Bear, or other minimalist markdown editors.