• Stars
    star
    328
  • Rank 128,352 (Top 3 %)
  • Language
    Emacs Lisp
  • License
    GNU General Publi...
  • Created over 1 year ago
  • Updated 8 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

๐Ÿช„ Enchanted Spell Checker

jinx.el - Enchanted Spell Checker

GNU Emacs GNU ELPA GNU-devel ELPA MELPA MELPA Stable

Jinx is a fast just-in-time spell-checker for Emacs. Jinx highlights misspelled words in the text of the visible portion of the buffer. For efficiency, Jinx highlights misspellings lazily, recognizes window boundaries and text folding, if any. For example, when unfolding or scrolling, only the newly visible part of the text is checked if it has not been checked before. Each misspelling can be corrected from a list of dictionary words presented as a completion menu.

Installing Jinx is straight-forward and configuring should not need much intervention. Jinx can be used completely on its own, but can also safely co-exist with Emacsโ€™s built-in spell-checker Ispell.

Jinxโ€™s high performance and low resource usage comes from directly calling the widely-used API of the Enchant library (see libenchant). Jinx automatically compiles jinx-mod.c and loads the dynamic module at startup. By binding directly to the native Enchant API, Jinx avoids the slower backend process communication with Aspell. Enchant is widely used by other text editors and supports Nuspell, Hunspell, Aspell and a few language-specific backends.

Jinx supports spell-checking multiple languages in the same buffer. See the jinx-languages variable to customize for multiple languages. Jinx can flexibly 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 Emacs major modes. Modes like Java, Ruby or Rust are listed in jinx-camel-modes. For these modes composite words in camelCase and PascalCase are accepted.

Installation

Jinx can be installed from GNU ELPA or MELPA directly with package-install.

Jinx requires libenchant. Enchant library is a required dependency for Jinx to compile its module at install time. If pkgconf or pkg-config is available when installing Jinx, Jinx will use it to locate libenchant. Depending on your operating system and Linux distribution you have to install different packages:

  • Debian, Ubuntu: libenchant-2-dev, pkgconf
  • Arch, Gentoo: enchant, pkgconf
  • Guix: emacs-jinx or enchant, pkgconf
  • Void, Fedora: enchant2-devel, pkgconf
  • FreeBSD, OpenBSD, Mac: enchant2, pkgconf

Configuration

Jinx has two modes: the command, global-jinx-mode activates globally; and the command, jinx-mode, for activating for specific modes.

;; Alternative 1: Enable Jinx globally
(add-hook 'emacs-startup-hook #'global-jinx-mode)

;; Alternative 2: Enable Jinx per mode
(dolist (hook '(text-mode-hook prog-mode-hook conf-mode-hook))
  (add-hook hook #'jinx-mode))

The commands jinx-correct and jinx-languages are marked as autoloads. Invoking jinx-correct corrects the misspellings. Binding jinx-correct to M-$ takes over that key from the default assignment to ispell-word. Since Jinx is independent of the Ispell package, M-$ can be re-used.

(keymap-global-set "M-$" #'jinx-correct)
(keymap-global-set "C-M-$" #'jinx-languages)
  • M-$ triggers correction for the misspelled word before point.
  • C-u M-$ triggers correction for the entire buffer.
  • C-u C-u M-$ forces correction of the word at point, even if it is not misspelled.

A sample configuration with the popular use-package macro is shown here:

(use-package jinx
  :hook (emacs-startup . global-jinx-mode)
  :bind (("M-$" . jinx-correct)
         ("C-M-$" . jinx-languages)))

See also the Jinx Wiki for additional configuration tips. The wiki documents configurations to save misspellings as global abbreviations and support for Ispell LocalWords.

Correcting misspellings

After invoking the command jinx-correct, suggested corrections are displayed as a completion menu. You can press the displayed digit keys to quickly select a suggestion. Furthermore the menu offers options to save the word temporarily for the current session, in the personal dictionary or in the file-local variables.

Note that you can enter arbitrary input at the correction prompt in order to make the correction or to store a modified word in the personal dictionary. For example if you typed alotriomorpc, the prompt offers you the option @alotriomorpc which would add this word to your personal dictionary upon selection. You can then correct the option to @allotriomorphic and add it to the dictionary.

While inside the jinx-correct prompt, the keys M-n and M-p are bound to jinx-next and jinx-previous respectively and allow you to move the next and previous misspelled word.

The completion menu is compatible with all popular completion UIs: Vertico, Mct, Icomplete, Ivy, Helm and the default completions buffer. In case you use Vertico I suggest that you tweak the completion display via vertico-multiform-mode for the completion category jinx. You can for example use the grid display such that more suggestions fit on the screen and enable annotations.

(add-to-list 'vertico-multiform-categories
             '(jinx grid (vertico-grid-annotate . 20)))
(vertico-multiform-mode 1)

Navigating between misspellings

As mentioned before, when correcting a word with jinx-correct, the movement commands jinx-next and jinx-previous are available on the keys M-n and M-p to navigate to the next and previous misspelling respectively. The movement commands work from within the minibuffer during jinx-correct and also globally outside the minibuffer context.

While the commands are not bound globally by default, they are available as M-n and M-p if point is placed on top of a misspelled word overlay. If you want you can add them and other commands to the jinx-mode-map, such that they are always available independent of point placement. If repeat-mode from Emacs 28 is enabled, the movement can be repeated with the keys n and p.

Enchant backends and personal dictionaries

Enchant uses different backends for different languages. The backends are ordered as specified in the personal configuration file ~/.config/enchant/enchant.ordering and the system-wide configuration file /usr/share/enchant-2/enchant.ordering. Enchant uses Hunspell as default backend for most languages. There are a few exceptions. For English Enchant prefers Aspell and for Finnish and Turkish special backends called Voikko and Zemberek are used. On non-Linux operating systems Enchant may also integrate with the spell-checker provided by the operating system.

Depending on the backend the personal dictionary will be taken from different locations, e.g., ~/.aspell.LANG.pws or ~/.config/enchant/LANG.dic. It is possible to symlink different personal dictionaries such that they are shared by different spell checkers. See the Enchant manual for details.

Alternative spell-checking packages

There exist multiple alternative spell-checking packages for Emacs, most famously the builtin ispell.el and flyspell.el packages. The main advantages of Jinx are its automatic checking of the visible text, its sharp focus on performance and the ability to easily use multiple dictionaries at once. The following three alternative packages come closest to the behavior of Jinx.

  • jit-spell: Jinx UI borrows ideas from Augusto Stoffelโ€™s Jit-spell. Jit-spell uses the less efficient Ispell process communication instead of Jinxโ€™s calling a native API. Since Jit-spell does not restrict spell checking to the visible text only, it may enqueue the entire buffer too eagerly for checking. This happens when scrolling around or when stealth font locking is enabled. For this reason, Jit-spell affected load and latency in my tests (issue on Github).
  • spell-fu: The idea to check words just in the visible text came from Campbell Bartonโ€™s spell-fu package. Spell-fu is fast but incurs high memory overhead on account of its dictionary in a hash table. For languages with compound words and inflected word forms, this overhead magnifies (issue on Codeberg). By accessing the Enchant API directly, Jinx avoids any overhead. Jinx also benefits from the advanced spell-checker algorithms of Enchant (affixation, compound words, etc.).
  • flyspell: Flyspell is a built-in package. Flyspell highlights misspellings while typing. Only the word under the cursor is spell-checked. Jinx, on the other hand, is more effective because it automatically checks for misspellings in the entire visible text of the buffer at once. Flyspell can check the entire buffer but must be instructed to do so via the command flyspell-buffer.

Contributions

Since this package is part of GNU ELPA contributions require a copyright assignment to the FSF.

More Repositories

1

org-modern

๐Ÿฆ„ Modern Org Style
Emacs Lisp
1,344
star
2

vertico

๐Ÿ’ซ vertico.el - VERTical Interactive COmpletion
Emacs Lisp
1,344
star
3

consult

๐Ÿ” consult.el - Consulting completing-read
Emacs Lisp
1,088
star
4

corfu

๐Ÿ๏ธ corfu.el - COmpletion in Region FUnction
Emacs Lisp
1,000
star
5

marginalia

๐Ÿ“œ marginalia.el - Marginalia in the minibuffer
Emacs Lisp
762
star
6

cape

๐Ÿฆธcape.el - Completion At Point Extensions
Emacs Lisp
533
star
7

osm

๐ŸŒ osm.el - OpenStreetMap viewer for Emacs
Emacs Lisp
496
star
8

tempel

๐Ÿ›๏ธ TempEl - Simple templates for Emacs
Emacs Lisp
464
star
9

affe

๐Ÿ’ affe.el - Asynchronous Fuzzy Finder for Emacs
Emacs Lisp
202
star
10

lmdb

Ruby bindings for the OpenLDAP's Lightning Memory-Mapped Database (LMDB)
C
105
star
11

goggles

goggles.el - Pulse modified region
Emacs Lisp
92
star
12

bibsync

BibSync is a tool to synchronize scientific papers and bibtex bibliography files
Ruby
60
star
13

paripari

Fast parser combinator library for Haskell with two strategies (Fast acceptor and slower reporter with decent error messages)
Haskell
56
star
14

hasklig-mode

hasklig-mode.el - Hasklig ligatures for emacs
Emacs Lisp
39
star
15

gridslides

LaTeX package to create free form slides with blocks placed on a grid
TeX
38
star
16

3delta

Host software especially suited for delta 3d printers
Tcl
36
star
17

pacgem

Gem installer for Arch Linux
Ruby
34
star
18

bookmark-view

bookmark-view.el - Use bookmarks to persist the current view
Emacs Lisp
34
star
19

osm2shp

Convert large OpenStreetMap files to shapefiles (Uses sqlite3 db as temporary storage)
C++
29
star
20

consult-flycheck

Consult integration for Flycheck
Emacs Lisp
28
star
21

chasm

Java Bytecode Assembler and Disassembler which uses S-expressions
Java
26
star
22

tab-bookmark

Persist Emacs Tabs as Bookmarks
Emacs Lisp
25
star
23

unit

Unit support for numbers
Ruby
24
star
24

mini-popup

Emacs Lisp
22
star
25

gitrb

Unmaintained: Simple git implementation in ruby similar to grit, based on git_store
Ruby
21
star
26

recursion-indicator

Recursion indicator for the mode-line
Emacs Lisp
20
star
27

henk

pure type system language - henk 2000 ported to megaparsec, pretty
Haskell
20
star
28

persist

Minimal binary serialization library with focus on performance
Haskell
17
star
29

rack-embed

Rack middleware which embeds small images as base64 data-url in css/html files if the browser supports it
Ruby
16
star
30

polyp

Emacs Lisp
12
star
31

writer-cps-mtl

Stricter drop in replacements for WriterT and RWST
Haskell
11
star
32

intro

Safe and minimal Haskell Prelude
Haskell
10
star
33

writer-cps-transformers

Compatibility package for old transformers: Stricter drop in replacements for WriterT and RWST
Haskell
10
star
34

wl-pprint-annotated

Wadler/Leijen pretty printer with annotations and API conforming to modern Haskell
Haskell
7
star
35

uchronia

uchronia.el - Rewrite the minibuffer history
Emacs Lisp
7
star
36

tasty-stats

Collect statistics of your Tasty testsuite
Haskell
7
star
37

tasty-auto

Deprecated: Auto discovery for the Tasty test framework, use tasty-discover instead
Haskell
6
star
38

quickcheck-special

Edge cases and special values for QuickCheck Arbitrary instances
Haskell
5
star
39

thinkpad-tools

Unmaintained: Some scripts used on my Thinkpad X60t
Python
5
star
40

typohero

TypoHero enhances your typography
Ruby
5
star
41

diascope

Unmaintained: S5: A Simple Standards-Based Slide Show System. Alternative implementation using jquery
JavaScript
5
star
42

colorful-monoids

colorful-monoids: Styled console text output using ANSI escape sequences
Haskell
4
star
43

9mount

Unmaintained fork of http://sqweek.dnsdojo.org/hg/9mount
C
4
star
44

omega

Haskell
4
star
45

distcc

distcc scripts
4
star
46

evaluator

Mathematical expression evaluator for infix notation. Supports variables and functions.
Ruby
3
star
47

xosdbar

show osd on X11, similar to osd_cat but with update support
C
3
star
48

wl-pprint-console

Wadler/Leijen pretty printer with annotations and support for colorful console output
Haskell
3
star
49

andromeda.hs

This is a direct port of Andrej Bauer's dependent type theory implementation from OCaml to Haskell
Haskell
3
star
50

mapgen

XCSoar Map Generator
Python
3
star
51

vle

Verilog Experiments
Verilog
3
star
52

console-style

Styled console text output using ANSI escape sequences
Haskell
3
star
53

analyzer

Some tools for physics calculations
C++
3
star
54

doxygen2adoc

Doxygen import for Asciidoc using XSLT and the Doxygen XML output
XSLT
3
star
55

ihs

Interpolated Haskell
LLVM
3
star
56

bigint-unboxed

JavaScript big integers with support for ES6 BigInt and unboxed small integers
JavaScript
2
star
57

special-values

Haskell
2
star
58

hashtable

Hashtable in C with open addressing and specialization via macros
C
2
star
59

i3-config

qubes i3 configuration
Shell
2
star
60

TaskList

Mediawiki plugin which implements a task tracker
PHP
2
star
61

implant

Linux from scratch package manager using symlinks - similar to GoboLinux (2008)
Shell
2
star
62

hexns

Nameserver for IPv6 which resolves Hexspeak subdomains
C
2
star
63

emacs-theme

Emacs Lisp
2
star
64

arch-packages

My arch pkbuilds
Shell
2
star
65

temple-mustache

Temple-based implementation of Mustache (Just a finger exercises to test temple)
Ruby
2
star
66

encode-string

String encoding and decoding in Haskell
Haskell
2
star
67

writer-cps-monads-tf

Stricter drop in replacements for WriterT and RWST
Haskell
2
star
68

slim-examples

http://slim-lang.com/
Ruby
2
star
69

imaginator

Unmaintained: Image generator for LaTex/graphviz source
Ruby
1
star
70

safe-convert

Safe type conversions in Haskell
Haskell
1
star
71

echoxul

echo2 java web app + xul (2006)
Java
1
star
72

persist-state

Haskell
1
star
73

strict-base

Strict versions of some standard Haskell data types
Haskell
1
star
74

writer-cps-full

Stricter drop in replacements for WriterT and RWST
Haskell
1
star
75

writer-cps-exceptions

Control.Monad.Catch instances for CPS WriterT and RWST monad transformers
Haskell
1
star
76

grouptsp

Travelling salesman (2004)
Java
1
star
77

pasty

easy to deploy, single file, under 50 line, command line pastebin
PHP
1
star
78

arduino-pi-gefrickel

Arduino/Rasberry Pi Gefrickel - Arduino/Rasberry Pi Fiddling
JavaScript
1
star
79

intro-prelude

Reexport Intro as Prelude
Haskell
1
star
80

os-experiment

simple i386 os with console and multithreading (2005)
C
1
star