Next: , Previous: , Up: Top   [Contents][Index]


23 Abbrevs

An abbrev is a word which expands into some different text. Abbrevs are defined by the user to expand in specific ways. For example, you might define ‘foo’ as an abbrev expanding to ‘find outer otter’. With this abbrev defined, you would be able to get ‘find outer otter ’ into the buffer by typing f o o SPC.

Abbrevs expand only when Abbrev mode (a minor mode) is enabled. Disabling Abbrev mode does not cause abbrev definitions to be discarded, 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. See Minor Modes. 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.

You can define Abbrevs interactively during an editing session. You can also save lists of abbrev definitions in files and reload them in later sessions. Some users keep extensive lists of abbrevs that they load in every session.

A second kind of abbreviation facility is called the dynamic expansion. Dynamic abbrev expansion happens only when you give an explicit command and the result of the expansion depends only on the current contents of the buffer. See Dynamic Abbrevs.


Next: , Previous: , Up: Top   [Contents][Index]