Jinx provides just-in-time spell-checking via libenchant. The package aims to achieve high performance and low resource usage, without impacting your editing experience. Overall Jinx should just work out of the box without much intervention.
Jinx highlights misspellings lazily only in the visible part of the text. The
window boundaries and text folding are taken into account. Jinx binds directly
to the native libenchant API, such that process communication with a backend
Aspell process can be avoided. Libenchant is widely used as spell-checking API
by text editors and supports Nuspell, Hunspell, Aspell and a few lesser known
backends. Jinx automatically compiles jinx-mod.c and loads the dynamic module at
startup.
Jinx supports multiple languages in a buffer at the same time via the
jinx-languages customization variable. It offers flexible settings to ignore
misspellings via faces (jinx-exclude-faces and jinx-include-faces), regular
expressions (jinx-exclude-regexps) and programmable predicates. Jinx comes
preconfigured for the most important major modes.
The package is available on GNU ELPA and MELPA and can be installed with
package-install. Libenchant must be installed on your system for compilation. If
pkg-config is available it will be used to locate libenchant. On Debian or
Ubuntu, install the packages libenchant-2-2, libenchant-2-dev and pkg-config.
Jinx offers two modes global-jinx-mode and jinx-mode. You can either enable
global-jinx-mode or add jinx-mode to the hooks of the modes.
(add-hook 'emacs-startup-hook #'global-jinx-mode)
(dolist (hook '(text-mode-hook prog-mode-hook conf-mode-hook))
(add-hook hook #'jinx-mode))Furthermore Jinx brings two auto-loaded commands jinx-correct and
jinx-languages. In order to correct misspellings bind jinx-correct to a
convenient key in your configuration. Jinx is independent of the Ispell package,
so you can reuse the binding M-$ which is bound to ispell-word by default. When
pressing M-$, Jinx offers correction suggestions for the misspelling next to
point. If the prefix key C-u is pressed, the entire buffer is spell-checked.
(keymap-global-set "<remap> <ispell-word>" #'jinx-correct)Enchant uses different backends depending on the language. The ordering of the
backends is configured by the file ~/.config/enchant/enchant.ordering. For most
languages Hunspell is used by default. Depending on the backend the personal
dictionary will be taken from different locations, e.g., ~/.aspell.LANG.pws or
~/.config/enchant/. It is possible to symlink different personal dictionaries
such that they are shared by different spell checkers. See the Enchant manual
for more details.
- jit-spell: Jinx offers a similar UI as Augusto Stoffel’s jit-spell package and
borrows ideas from it. Jit-spell uses Ispell process communication instead of
a native API. It does not restrict the highlighting to the visible text. In my
setup I observed an increase in load and latency as a consequence, in
particular in combination with stealth locking and commands which trigger
fontification eagerly like
consult-linefrom my Consult package. - spell-fu: The technique to spell-check only the visible text was inspired by Campbell Barton’s spell-fu package. Spell-fu maintains the dictionary itself via a hash table, which results in high memory usage for languages with compound words or inflected word forms. In Jinx we avoid the complexity of managing the dictionary and access the advanced spell-checker algorithms directly via libenchant (affixation, compound words, etc.).
- flyspell: Flyspell is a builtin package which highlight misspellings while typing and when you move the cursor to a word. Jinx uses a different mode of operation, where the entire visible text of the buffer is checked always.
Since this package is part of GNU ELPA contributions require a copyright assignment to the FSF.