Electric Corrections Help
Name: | Elec Corrections |
Version: | 1.2 |
Last update: | 2019-11-27 14:12:51 |
This package helps check for and correct spelling mistakes or typos as you
type. Select Alpha ↣ Global Setup ↣ Features
to turn it on (click here to display the Features Preferences dialog).
Introduction
This is not a spell-checking extension -- instead it is more of a
misspell-checker: you must teach Alpha the common misspellings or typos
to correct using the menu items described below.
Whenever you press the return or space key, Alpha will then compare the
previous word to the list of all typos, and correct it if necessary.
This package also includes a Smart i preference, if this has been
turned on then Alpha will automatically change "i" to "I" as you type.
Activating the extension will create four new preferences and insert a
new Alpha ↣ Preferences ↣ Electric Corrections submenu described
below.
Electric Corrections Preferences
Select Alpha ↣ Preferences ↣ Electric Corrections ↣ Corrections Prefs
to change the values of these preferences.
- Smart i
- Automatically convert " i " to " I ".
- Smart i Modes
- Allows you to specify the modes that use the Smart i feature, initially
including only Text TeX Bib HTML. If this list is empty, automatic
correction applies to all modes.
- Turn Corrections On/Off
- Turns automatic corrections of typos on or off. This does not affect the
Smart i preference.
- Correcting Modes
- Allows you to specify the modes that check for misspellings. If this
list is empty (the default value), automatic correction applies to all
modes.
Electric Corrections Menu
- View Corrections
- Open a window with all current typos. The package only supplies one typo
to initially correct, changing "hte" to "the"
- Add Corrections
- Open a dialog to create new typos. Only lower-case typos need to be
entered -- both lower-case and capitalized typos will be corrected
automatically.
- Edit Corrections
- Open a list-pick dialog to edit all typos.
- Remove Corrections
- Open a list-pick dialog to remove all user-defined typos.
- Smart i
- Automatically convert " i " to " I ".
(This is a toggleable menu item, turning the preference on and off.)
- Smart i Modes
- Allows you to specify the modes that use the Smart i preference,
initially including only Text TeX Bib HTML. If this list is empty,
automatic correction applies to all modes.
- Turn Corrections On/Off
- Turns automatic corrections of misspellings or typos on or off. This
does not affect the Smart i preference.
- Correcting Prefs
- Allows you to specify the modes that check for typos. You can select any
subset of the modes currently available, or choose the option for "All"
or "None".
- Corrections Help
- Open this file.
Usage
Following every Space or Return keystroke, the desired whitespace is
inserted into the window, and then the preceding word is checked against
the list of defined typos -- if the word matches, it is deleted and the
correction is inserted. If the Smart i preference is set, then any
lone i will be converted to I. Preceding words are checked even if
followed by an intermediate character such as , . ; etc. -- the
correction is inserted without disturbing the following characters. So
Where was i?
i decided to ask hte, well, obviously oblivious inn-keeper, ...
corrects to
Where was I?
I decided to ask the, well, obviously oblivious inn-keeper, ...
All user-defined misspellings/typos are automatically converted to both
lower case and capitalized words -- both hte → the and Hte → The
work, but only the first must be defined. Note that if you have multiple
misspellings for the same word, you must define each one separately,
such as teh → the. All typos will be corrected in any mode listed in
the "Correcting Modes" preference. It is not possible to define
mode-specific typos.
Here's one way to exploit this feature: I have defined the following
typos, which I generally will not accidentally type:
"sgy → sociology"
"scal → sociological"
"slly → sociologically"
"sc → social capital"
Now whenever I type "sgy" or "Sgy", the correction is automatically
inserted if I follow it with a Space or Return. Suppose that I have the
terms "screaming" and "somethingCruddy" in my file, and I have just typed
"sc". Note the following electric options:
Space or Return: | correct to | "social capital" |
Completion Key: | complete to | "screaming" |
Expansion Key: | expand to | "somethingCruddy" |
If you would like to define Electric Corrections Over-Ride keys, open a
prefs.tcl file and add these lines:
binding create {sv space} {text insert "\ "}
binding create {sv return} {bind::CarriageReturn}
Pressing the Shift (⇧
) key in combination with Space or Return will then over-ride corrections and simply
enter a space or a carriage return.
Possible future directions
- Include a pre-defined set of typos that has something more than simply
"hte". I would just as soon leave it up to the user to create them, but
if somebody has a list that they would like to send along (with common
typos and the corrections, please) I'll include it in future versions.
One concern that I have is that for such a list to be truly useful, it
should be comprehensive, and that will both make it much more difficult
for the user to know what's in there and potentially slow down the
correcting process.
- Procedures have already been written to unset/restore the default list.
It would be possible to come up with several different lists to
accommodate different editing settings, or languages ...
- Allow the creation of mode-specific corrections, similarly to
mode-specific completions. I don't have any objections, but I'm not sure
about the best way to accomplish this.
Acknowledgments
This package was inspired by Electric Completions / Expansions, and
based upon the proc [SQL::electUpper] found in sqlMode.tcl (Joel D. Elkins.) Many thanks to Vince Darley
and Bernard Desgraupes for several bug fixes and suggestions.
Source code can be found in elecCorrections.tcl -- contributions are
certainly welcome.
Known problems
Please report any problem or bug you encounter to
Alpha's Bug Tracker.
License and Disclaimer
Copyright (c) 2000-2019, Craig Barton Upright.
All rights reserved.
The elecCorrections package is free software and distributed under
the terms of the new BSD license:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
- Neither the name of Craig Barton Upright nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CRAIG BARTON UPRIGHT BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.