19.11. Using Word-Abbreviation Mode
Like vi, Emacs provides an
"abbreviation" facility. Its
traditional usage lets you define abbreviations for long words or
phrases so you don't have to type them in their
entirety. For example, let's say you are writing a
contract that repeatedly references the National Institute of
Standards and Technology. Rather than typing the full name, you can
define the abbreviation nist. Emacs inserts the
full name whenever you type nist, followed by a
space or punctuation mark. Emacs watches for you to type an
abbreviation, then expands it automatically as soon as you press the
spacebar or type a punctuation mark (such as .,
,, !, ?,
;, or :).
One use for word-abbreviation mode is to correct misspellings as you
type. Almost everyone has a dozen or so words that he habitually
types incorrectly, due to some worn neural pathways. You can simply
tell Emacs that these misspellings are
"abbreviations" for the correct
versions, and Emacs fixes the misspellings every time you type them.
If you take time to define your common typos as abbreviations,
you'll never be bothered with
teh, adn, and
recieve when you run the spellchecker. Emacs
sweeps up after your typos and corrects them. For example,
let's say that you define teh as
an abbreviation for the. When you press the
spacebar after you type teh, Emacs fixes it
immediately, and you continue happily typing. You may not even notice
that you typed the word wrong before Emacs fixes it.
19.11.1. Trying Word Abbreviations for One Session
Usually, if you go to the trouble of defining a word abbreviation,
you will use it in more than one Emacs session. But if
you'd like to try out abbreviation mode to see if
you want to make it part of your startup, use the following procedure
to define word abbreviations for this session:
-
Enter word-abbreviation mode by typing ESC-x
abbrev-mode. abbrev appears on
the mode line.
-
Type the abbreviation you want to use, and press CTRL-x
a. Emacs then asks you for the expansion.
-
Type the definition for the abbreviation, and press RETURN. Emacs
then expands the abbreviation; it will do so each time you type it
followed by a space or punctuation mark. The abbreviations
you've defined will work only during this Emacs
session.
If you find that you like using word-abbreviation mode, you may want
to make it part of your startup, as described in the following
section.
 |  |  | 19.10. Inserting Binary Characters into Files |  | 19.12. Directories for Emacs Hacks |
Copyright © 2003 O'Reilly & Associates. All rights reserved.
|
|