(lemacs.info)Defining Abbrevs

Next: Expanding Abbrevs Prev: Abbrevs Up: Abbrevs

Defining Abbrevs

`C-x a g'
     Define an abbrev to expand into some text before point

`C-x a l'
     Similar, but define an abbrev available only in the current major
     mode (`add-mode-abbrev').

`C-x a i g'
     Define a word in the buffer as an abbrev

`C-x a i l'
     Define a word in the buffer as a mode-specific abbrev

`M-x kill-all-abbrevs'
     After this command, no abbrev definitions remain in effect.

   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 in the example above, insert the text `find outer otter', then
`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
way they do for `C-x a g'.

   If the text of an abbrev you want is already in the buffer instead of
the expansion, use command `C-x a i g' (`inverse-add-global-abbrev')
instead of `C-x a g', or use `C-x a i l' (`inverse-add-mode-abbrev')
instead of `C-x a l'.  These commands are called "inverse" because they
invert the meaning of the argument found in the buffer and the argument
read using the minibuffer.

   To change the definition of an abbrev, just add the new definition.
You will be asked to confirm if the abbrev has a prior definition.  To
remove an abbrev definition, give a negative argument to `C-x a g' or
`C-x a l'.  You must choose the command to specify whether to kill a
global definition or a mode-specific definition for the current mode,
since those two definitions are independent for one abbrev.

   `M-x kill-all-abbrevs' removes all existing abbrev definitions.

automatically generated by info2www