jinx Atom Feed

Description
Enchanted Spell Checker
Latest
jinx-1.11.0.20241223.135713.tar (.sig), 2024-Dec-23, 130 KiB
Maintainer
Daniel Mendler <mail@daniel-mendler.de>
Website
https://github.com/minad/jinx
Browse ELPA's repository
CGit or Gitweb
Badge
Manual
jinx

To install this package from Emacs, use package-install or list-packages.

Full description

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 API of the Enchant library. Jinx automatically compiles jinx-mod.c and loads the dynamic module at startup. By binding directly to the native Enchant API, Jinx avoids slower inter-process communication. Enchant is used by other text editors and supports multiple backends like Nuspell, Hunspell and Aspell.

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 JavaScript, TypeScript, Java, Ruby or Rust are listed in jinx-camel-modes. For these modes composite words in camelCase and PascalCase are accepted.

1. Installation

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

Most importantly your Emacs must be compiled with dynamic module support. Jinx requires libenchant, which is needed to compile the native module at install time. If pkgconf or pkg-config is available, Jinx will use it to locate libenchant during installation. Depending on your BSD or Linux distribution you have to install different packages:

  • Debian, Ubuntu: libenchant-2-dev, pkgconf
  • Arch, Gentoo: enchant, pkgconf
  • Guix: emacs-jinx defined in emacs-xyz.scm
  • Nix: jinx defined in elpa-packages.nix
  • Void, Fedora: enchant2-devel, pkgconf
  • OpenSUSE: emacs-jinx or enchant, pkgconf
  • FreeBSD, OpenBSD, Mac: enchant2, pkgconf

On Windows the installation of the native module may require manual intervention.

2. 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.

3. Correcting misspellings

The easiest way to correct a misspelling is to right click on the word, underlined with a wavy line. Then a context menu will open where you can select from suggestions.

If you prefer to use the keyboard, invoke the command jinx-correct. The recommended binding is M-$, see the configuration section. Suggested corrections will be 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.

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)

4. Navigating between misspellings

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.

5. 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. For English Enchant prefers Aspell and for Finnish and Turkish special backends called Voikko and Zemberek are used.

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.

6. Alternatives

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 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.

7. Contributions

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

Old versions

jinx-1.11.0.20241222.154812.tar.lz2024-Dec-2224.1 KiB
jinx-1.11.0.20241222.31216.tar.lz2024-Dec-2224.0 KiB
jinx-1.10.0.20241217.180709.tar.lz2024-Dec-1724.1 KiB
jinx-1.10.0.20241201.134324.tar.lz2024-Dec-0124.0 KiB
jinx-1.10.0.20240926.181428.tar.lz2024-Sep-2624.0 KiB
jinx-1.9.0.20240723.191335.tar.lz2024-Jul-2323.6 KiB
jinx-1.7.0.20240606.90956.tar.lz2024-Jun-0623.3 KiB
jinx-0.9.0.20231124.125024.tar.lz2023-Nov-2421.9 KiB
jinx-0.8.0.20230626.182519.tar.lz2023-Jun-2620.4 KiB
jinx-0.2.0.20230326.205655.tar.lz2023-Mar-2611.7 KiB

News

1. Version 1.11 (2024-12-22)

  • Require Emacs 28.1.
  • Remove special org-fold code. Set org-fold-core-style to overlays if unfolding in Org files does not work for you.
  • jinx-languages: Group dictionaries by dictionary provider.

2. Version 1.10 (2024-07-23)

  • Bump Compat dependency to Compat 30.
  • Add include and linkpaths from FreeBSD for compilation.
  • Add jinx--syntax-overrides to override syntax table.

3. Version 1.9 (2024-06-29)

  • Bugfix: In some rare scenarios, Jinx could hang when checking pending regions.
  • jinx-correct-all: Add ONLY-CHECK prefix argument.

4. Version 1.8 (2024-06-19)

  • Bugfix in jinx-correct: Fix wrong-type-argument error if no Enchant dictionaries are found.

5. Version 1.7 (2024-05-15)

  • jinx--word-valid-p: Do not error on invalid characters.
  • jinx-save-languages: New custom variable.

6. Version 1.6 (2024-04-12)

  • Bugfix (again): Ensure that directory local variables work correctly with Jinx. It is possible to turn Jinx on or off via dir-locals, and also configure the language and local words.

7. Version 1.5 (2024-04-04)

  • Bugfix: Ensure that jinx-next unfolds hidden misspellings.
  • Bugfix: Ensure that directory local variable enabling jinx-mode works.

8. Version 1.4 (2024-03-10)

  • Bugfix: Ensure that jinx-correct saves words without text properties in the file-local variable jinx-local-words.
  • Bugfix: Ensure that eval local variable enabling jinx-mode works.
  • jinx-correct: If a region is marked, call jinx-correct-all and restrict corrections to the marked region.
  • jinx-exclude-faces, jinx-include-faces, jinx-exclude-regexps: Support mode aliases.

9. Version 1.3 (2024-02-23)

  • Fix interaction bug with the newest version of AUCTeX, where the major mode got changed unexpectedly.

10. Version 1.2 (2024-01-22)

  • Fix deadlock on MacOS during Jinx startup.
  • Timer optimizations.

11. Version 1.1 (2023-12-27)

  • Add mouse context menu to correct misspellings. The menu is triggered by a right click on a misspelling.

12. Version 1.0 (2023-12-01)

  • Allow capitalized form of a word if non-capitalized word is stored in the session word list.
  • Replace jinx-excluded-modes with global-jinx-modes, the Emacs 28 convention for globalized minor modes.
  • jinx-correct: Offer session words as suggestions.
  • Add jinx-correct-nearest, jinx-correct-all and jinx-correct-word commands. The command jinx-correct dispatches to one of those commands depending on the prefix argument.
  • Recommend libenchant 2.3.1 or newer. Print a message if Enchant is outdated.
  • Support $LANG=C and $LANG=POSIX environment variable settings.

13. Version 0.9 (2023-07-02)

  • 🪄 Make sure that Emojis are not marked as misspelled 🧙🏼‍♀️.
  • Rename jinx-correct-next/previous to jinx-next/previous. The commands can be used outside the minibuffer.
  • Bind M-n and M-p to jinx-next/previous in jinx-overlay-map.
  • Bind M-$ to jinx-correct in the jinx-overlay-map.
  • Add jinx-repeat-map.
  • Rename category of Jinx overlays to jinx-overlay.
  • Rename jinx-misspelled-map to jinx-overlay-map.
  • Add many more language modes to jinx-camel-modes.

14. Version 0.8 (2023-04-28)

  • jinx-correct: Consistently move backward to the previous misspelling. In order to move backward further, press M-$ again (or M-p). Move forward with M-n.
  • jinx-correct-select: Support more than 10 quick keys.
  • jinx-languages: New argument LANGS.
  • Add jinx-faces customization group.
  • Add configurable save actions via jinx--save-keys.
  • Detect C compiler via $CC or executable-find.

15. Version 0.7 (2023-04-21)

  • Bugfixes
  • jinx-languages: Only ask in file-backed buffers if file-local variable should be saved.
  • Push undo-boundary before correcting a word, such that corrections are not undone in a single step.
  • jinx-correct: Use + as prefix to add word to the current session.

… …