Lugaru's Epsilon
Programmer's
Editor 14.04

Context:
Epsilon User's Manual and Reference
   Commands by Topic
      . . .
      Moving Around
         Simple Movement Commands
         Moving in Larger Units
         Searching
         . . .
         Comparing Many Files
      Changing Text
         . . .
         Aligning
         Automatically Generated Text
         Spell Checking
         Hex Mode
      Language Modes
         Asm Mode
         Batch Mode
         C Mode
         . . .
         Visual Basic Mode
      . . .

Previous   Up    Next
Automatically Generated Text  Commands by Topic   Hex Mode


Epsilon User's Manual and Reference > Commands by Topic > Changing Text >

Spell Checking

The Spell minor mode makes Epsilon highlight misspelled words as you edit.

First configure spell checking by running the spell-configure command. The first time you run it, it will download and install a set of dictionary files into the "spell" subdirectory of your customization directory. (See https://www.lugaru.com/spell.html if you need to download it manually.) Then it will ask your region (American, Canadian, British, or British with -ize spellings preferred) and other questions like dictionary size. (A larger dictionary means rarer words won't be marked as potential misspellings, but it will miss those misspellings that happen to result in rare words.) To start, just choose default options for each question.

Use the spell-mode command to make Epsilon highlight misspelled words in the current mode. The command toggles highlighting; a numeric prefix argument forces it on (if nonzero) or off (if zero). "Sp" in the mode line indicates Spell minor mode is on. Use the buffer-spell-mode command instead if you want Epsilon to only highlight misspelled words in the current buffer.

Epsilon remembers whether you want spell checking in a particular mode using a variable like html-spell-options, whose name is derived from the mode name. If a mode has no associated variable, Epsilon uses the default-spell-options variable. Each variable contains bits to further customize spelling rules for that mode. The 0x1 bit says whether misspelled words should be highlighted at all; spell-mode toggles it. The following table shows the meaning of the other bits in each variable.

 Bit  Meaning
 0x1  Highlight misspelled words.
 0x2  Skip words containing an underscore.
 0x4  Skip MixedCaseWords (those with internal capitalization).
 0x8  Skip uppercase words (those with no lowercase letters).
 0x10  Skip words following a digit, like 14th.
 0x20  Skip words before a digit, like gr8.
 0x200  Don't remove 's when checking words.
 0x1000  Provide faster but less accurate built-in suggestions.
 0x2000  Don't copy the case of the original in built-in suggestions.
 0x4000  Add globally ignored words to spell helper's list.

The spell-correct command can suggest replacements for a misspelled word. It can also record a word in an ignore list so Epsilon no longer highlights it as a misspelling. Epsilon maintains a global ignore list named ignore.lst in your customizations directory. That directory also contains its main word list dictionary espell.lst (which is ordered so that more common words appear closer to the top of the file) and espell.srt, a (case-sensitively) sorted version of espell.lst.

Epsilon also checks directory-specific, file-specific, and mode-specific ignore lists. When checking a file named file.html, for example, Epsilon looks for an ignore list file named .file.html.espell in that same directory, and a directory-specific ignore list file in that directory named .directory.espell. A mode-specific ignore list file is named ignore.modename.mode.lst, where modename is the current mode name, and appears in your customization directory.

All these files contain one word per line. Epsilon automatically sorts ignore list files when it uses them. (Epsilon can optionally use extension-specific ignore lists too. By default this is disabled for simplicity. See the global-spell-options variable.)

The spell-buffer-or-region command performs spell checking for the current buffer, going to each misspelled word in turn and asking if you want to correct it or ignore it. With a highlighted region it checks just that region.

The spell-grep command writes a copy of all lines with spelling errors to the grep buffer, where you can use the usual grep commands to navigate among them. See Searching Multiple Files for details.

Making Suggestions

The spell-correct command presents a list of suggestions. Epsilon can generate these in several different ways. The default method uses the installed dictionary files. A faster, less accurate, but still self-contained method is available by setting a bit in the current -spell-options variable.

Epsilon can also run an external program to provide suggestions; this is generally very fast and produces the best suggestions. The spell-configure command configures this. It sets up Epsilon to use aspell or the older ispell, two free command line spelling programs often installed on Unix systems. It can also set up Epsilon to use MicroSpell, a commercial spell checking program for Windows systems available from http://www.microspell.com, by installing a helper program mspellcmd.exe into its directory. In Epsilon for macOS, it can also use the Mac's native spelling engine, though this is not available when you run Epsilon for macOS over a network connection from another computer.

Customizing Spell Checking

Epsilon looks for words to be checked using a regular expression pattern. In modes without syntax highlighting, it uses the pattern in the default-spell-word-pattern variable. In modes with syntax highlighting, it uses default-color-spell-word-pattern.

This latter pattern makes Epsilon ignore words based on their syntax highlighting color class, so that it skips over language keywords, variable names, and so forth. It checks words only if the mode colors them using a color class whose name ends in -text, -comment, or -string. It uses a color class assertion (see Regular Expression Assertions) to do this.

You can define a replacement spell check pattern for any mode by creating a variable whose name is the mode name followed by -spell-word-pattern. Then Epsilon will use that variable instead of one of the default variables. For instance, if you want XML mode to check attributes as well as text but not comments, you could define a variable xml-spell-word-pattern and copy its value from the default-color-spell-word-pattern variable, changing the color class assertion to <c:*-text|*-attributes>.

A mode can make the speller ignore words based on adjacent text, in addition to using color class assertions. Create a variable whose name is the mode's name followed by -spell-ignore-pattern-prefix. If it exists, and the regular expression pattern it contains matches the text just before a word, the speller will skip it. For instance, if in Sample mode a # at the start of a line indicates a comment, define a variable sample-spell-ignore-pattern-prefix and set it to ^#.*. Similarly, a variable ending in -spell-ignore-pattern-suffix that matches just after a word will make the speller ignore the word.

A mode can define an alternative set of dictionaries and ignore files by setting the buffer-specific spell_language_prefix variable. Set it to a suffix like "-fr" and Epsilon will look for alternative files, which the mode must supply, ending with that suffix.

Standard bindings:

    spell-mode
   buffer-spell-mode
   spell-configure
   spell-buffer-or-region
   spell-grep
 Ctrl-c Ctrl-o  spell-correct
 



Previous   Up    Next
Automatically Generated Text  Commands by Topic   Hex Mode


Lugaru Epsilon Programmer's Editor 14.04 manual. Copyright (C) 1984, 2021 by Lugaru Software Ltd. All rights reserved.