Skip to content

Instantly share code, notes, and snippets.

@eht16
Created April 22, 2019 22:33
Show Gist options
  • Save eht16/d2bfcb69a2d095fe6f5c3d427f8455fe to your computer and use it in GitHub Desktop.
Save eht16/d2bfcb69a2d095fe6f5c3d427f8455fe to your computer and use it in GitHub Desktop.

Spell Check Plugin

This plugin checks the content of the current document in Geany with the spell check library Enchant. You can also select a certain text passage, then the plugin will only check the selected text. All lines with misspelled words are highlighted with a red squiggly underline and the wrong words are printed in the messages window at the bottom of Geany together with available suggestions. For the plugin to work at all, you need to have the Enchant library installed together with at least one backend (Aspell, Myspell, Hunspell, ...). The plugin's configure dialog lists all available languages/dictionaries which can be used for the spell check.

  • Check spelling while typing
  • Highlight spelling mistakes
  • Editor-menu integration

After installed successfully, load the plugin in Geany's plugin manager and a new menu item in the Tools menu will appear. Alternatively, you can assign a keyboard shortcut in Geany's preferences dialog to perform a spell check.

Especially Windows, you might need to install the dictionaries (the files containing the information for spell checking) manually. First, you need to download the dictionary files for the languages you want, e.g. from https://cgit.freedesktop.org/libreoffice/dictionaries/tree/ or https://addons.mozilla.org/en-US/firefox/language-tools/. The downloaded archives should contain one or more .dic and .aff files.

Instructions:

  1. Download the archive you want to use
  2. The downloaded archive with extensions like .xpi or .oxt is actually a ZIP archive, so extract it as usual (e.g. with 7-Zip or another ZIP unpacker). Extract the contents into a folder of your choice, e.g. C:\dictionaries
  3. If the extracted dictionary files contain hyphens ("-"), replace them with underscores
  4. Then open to the Spell Check plugin preferences dialog in Geany and choose the folder you just created. You may need to restart Geany and then the installed dictionaries should be available

Note: if you are using Enchant 2.0 or later (the library used by the SpellCheck plugin), you need to move the dictionaries into a subfolder called "hunspell" in the directory you created above. The directory to be configured in the plugin's configuration dialog still is the directory above that folder. To check which Enchant version you are using, check "Help->Debug Messages" in Geany and find the appropriate log message telling about the Enchant version.

Example:

C:\
├── dictionaries
│   └── hunspell
│       ├── ca_ES.aff
│       ├── ca_ES.dic
│       ├── cs.dic
│       ├── cs.dic
│       ├── de_DE_frami.aff
│       ├── de_DE_frami.dic
│       ├── en_GB.aff
│       └── en_GB.dic
└── ...

Then in the plugin configuration dialog set the dictionary for dictionary files to: C:\dictionaries.

  • Spell checking with some languages like Hindi might be incorrect, i.e. some words are incorrectly marked as correctly spelled or marked incorrectly as misspelled.

  • Crashes of Geany when loading the Spell Check plugin after it was unloaded. This can happen when you are using a dictionary from the Zemberek provider of Enchant (mostly Turkish dictionaries). It can also happen when you tried to use a non-existing dictionary and the Zemberek provider is installed on your system. To avoid these crashes you have the following options:

    • Do not load the plugin after it was unloaded, restart Geany first
    • Do not use any of the dictionaries provided by the Zemberek provider
    • Update your Enchant version at least to 1.4.3 (once it is released)
    • Uninstall the Zemberek provider
    Background:

    These crashes are all related to the Zemberek provider in Enchant. In version 1.4.2 and prior of Enchant, this provider/backend always claimed to support any given invalid dictionary name and so it was active and caused these crashes on load after unload of the plugin. This provider is DBus-based and uses the GObject type registration system which is not really capable of being unloaded and loaded again.

  • GTK >= 2.8.0
  • Geany >= 0.21

Send it to me at enrico(dot)troeger(at)uvena(dot)de or report them at https://github.com/geany/geany-plugins/issues.

diff --git a/spellcheck/README b/spellcheck/README
index bdf6f8f4..85c0faa0 100644
--- a/spellcheck/README
+++ b/spellcheck/README
@@ -50,17 +50,38 @@ Instructions:
2. The downloaded archive with extensions like .xpi or .oxt is actually a ZIP
archive, so extract it as usual (e.g. with 7-Zip or another ZIP
unpacker). Extract the contents into a folder of your choice,
- e.g. C:\dictionaries
-3. Then open to the Spell Check plugin preferences dialog in Geany and
+ e.g. `C:\\dictionaries`
+3. If the extracted dictionary files contain hyphens ("-"), replace them
+ with underscores
+4. Then open to the Spell Check plugin preferences dialog in Geany and
choose the folder you just created. You may need to restart Geany
and then the installed dictionaries should be available
Note: if you are using Enchant 2.0 or later (the library used by the SpellCheck
plugin), you need to move the dictionaries into a subfolder called "hunspell"
-in the directory you created above.
+in the directory you created above. The directory to be configured in the
+plugin's configuration dialog still is the directory above that folder.
To check which Enchant version you are using, check "Help->Debug Messages" in
Geany and find the appropriate log message telling about the Enchant version.
+Example::
+
+ C:\
+ ├── dictionaries
+ │ └── hunspell
+ │ ├── ca_ES.aff
+ │ ├── ca_ES.dic
+ │ ├── cs.dic
+ │ ├── cs.dic
+ │ ├── de_DE_frami.aff
+ │ ├── de_DE_frami.dic
+ │ ├── en_GB.aff
+ │ └── en_GB.dic
+ └── ...
+
+Then in the plugin configuration dialog set the dictionary for
+dictionary files to: `C:\\dictionaries`.
+
Known issues
------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment