The usual way to define an abbrev is to enter the text you want the
abbrev to expand to, position point after it, and type C-x a g
add-global-abbrev). This reads the abbrev itself using the
minibuffer, and then defines it as an abbrev for one or more words before
point. Use a numeric argument to say how many words before point should be
taken as the expansion. For example, to define the abbrev ‘foo’ as
mentioned above, insert the text ‘find outer otter’ and then type
C-u 3 C-x a g f o o <RET>.
An argument of zero to C-x a g means to use the contents of the region as the expansion of the abbrev being defined.
The command C-x a l (
add-mode-abbrev) is similar, but
defines a mode-specific abbrev. Mode-specific abbrevs are active only in a
particular major mode. C-x a l defines an abbrev for the major mode
in effect at the time C-x a l is typed. The arguments work the same
as for C-x a g.
If the abbrev text itself is already in the buffer, you can use the
commands C-x a i g (
C-x a i l (
inverse-add-mode-abbrev) to define it as an
abbrev by specify the expansion in the minibuffer. These commands are
called “inverse” because they invert the meaning of the two text
strings they use (one from the buffer and one read with the
You can define an abbrev without inserting either the abbrev or its
expansion in the buffer using the command
It reads two arguments—the abbrev, and its expansion. The command
define-mode-abbrev does likewise for a mode-specific abbrev.
To change the definition of an abbrev, just define a new definition. When the abbrev has a prior definition, the abbrev definition commands ask for confirmation before replacing it.
To remove an abbrev definition, give a negative argument to the abbrev definition command: C-u - C-x a g or C-u - C-x a l. The former removes a global definition, while the latter removes a mode-specific definition. M-x kill-all-abbrevs removes all abbrev definitions, both global and local.blog comments powered by Disqus