Flymake support for Vale
Vale is a natural language linter.
So with flymake-vale
you get on-the-fly natural language linting.
The instruction to use this plugin.
Install Vale with package manager or download from Releases and place in your $PATH.
Configure Vale following its documentation Vale Config
Install flymake-vale
. Until it is submitted to Elpa and/or Melpa,
you can install it with
Straight.el:
(straight-use-package
'(flymake-vale :type git :host github :repo "tpeacock19/flymake-vale"))
or cloning this repository:
cd path/to/custom/lisp
git clone https://github.com/tpeacock19/flymake-vale
(add-to-list 'load-path "path/to/custom/lisp/flymake-vale")
You can add flymake-vale
as a backend to specific modes by adding
flymake-vale-load
to the relevant hook:
(add-hook 'text-mode-hook #'flymake-vale-load)
(add-hook 'latex-mode-hook #'flymake-vale-load)
(add-hook 'org-mode-hook #'flymake-vale-load)
(add-hook 'markdown-mode-hook #'flymake-vale-load)
(add-hook 'message-mode-hook #'flymake-vale-load)
You can also have flymake-vale
load automatically upon opening a
file when that file's major mode is in flymake-vale-modes
:
(add-hook 'find-file-hook 'flymake-vale-maybe-load)
;; flymake-vale-modes defaults to:
;; => (text-mode latex-mode org-mode markdown-mode message-mode)
(add-to-list 'flymake-vale-modes 'adoc-mode)
Now open a text file and enable flymake (M-x flymake-mode
).
Vale has support for text markup formats (including org-mode support), but it needs to know the file extension so it can parse the content of the file, while ignoring the parts we don't want to check. The current logic is to use in order of preference:
The buffer-local variable flymake-vale-file-ext
if it is non nil.
This can be used to override and send your preferred extension.
(add-hook 'org-msg-mode-hook (lambda ()
(setq flymake-vale-file-ext "org")
(flymake-vale-load)))
If the buffer is visiting a file, use that file's extension.
If the buffer's major-mode
is in the
flymake-vale-mode-file-exts
alist then use its corresponding
extension. This currently includes all built-in scoping formats and
can be customized to include new modes like this:
(add-to-list 'flymake-vale-mode-file-exts '(rust-mode . "rs"))