26.1. Abbrev Concepts

An abbrev is a word which has been defined to expand into a specified expansion. When you insert a word-separator character following the abbrev, that expands the abbrev--replacing the abbrev with its expansion. For example, if foo is defined as an abbrev expanding to find outer otter, then you can insert find outer otter. into the buffer by typing f o o ..

Abbrevs expand only when Abbrev mode (a minor mode) is enabled. Disabling Abbrev mode does not cause abbrev definitions to be forgotten, but they do not expand until Abbrev mode is enabled again. The command M-x abbrev-mode toggles Abbrev mode; with a numeric argument, it turns Abbrev mode on if the argument is positive, off otherwise. Section 32.1. abbrev-mode is also a variable; Abbrev mode is on when the variable is non-nil. The variable abbrev-mode automatically becomes local to the current buffer when it is set.

Abbrev definitions can be mode-specific--active only in one major mode. Abbrevs can also have global definitions that are active in all major modes. The same abbrev can have a global definition and various mode-specific definitions for different major modes. A mode-specific definition for the current major mode overrides a global definition.

Abbrevs can be defined interactively during the editing session. Lists of abbrev definitions can also be saved in files and reloaded in later sessions. Some users keep extensive lists of abbrevs that they load in every session.