Next: Abbrev Files, Previous: Abbrev Tables, Up: Abbrevs
define-abbrev is the low-level basic function for defining an
abbrev in a specified abbrev table. When major modes predefine
standard abbrevs, they should call define-abbrev and specify
t for system-flag.
This function defines an abbrev named name, in table, to expand to expansion and call hook. The return value is name.
The value of count, if specified, initializes the abbrev's usage-count. If count is not specified or
nil, the use count is initialized to zero.The argument name should be a string. The argument expansion is normally the desired expansion (a string), or
nilto undefine the abbrev. If it is anything but a string ornil, then the abbreviation “expands” solely by running hook.The argument hook is a function or
nil. If hook is non-nil, then it is called with no arguments after the abbrev is replaced with expansion; point is located at the end of expansion when hook is called.If hook is a non-
nilsymbol whoseno-self-insertproperty is non-nil, hook can explicitly control whether to insert the self-inserting input character that triggered the expansion. If hook returns non-nilin this case, that inhibits insertion of the character. By contrast, if hook returnsnil,expand-abbrevalso returnsnil, as if expansion had not really occurred.If system-flag is non-
nil, that marks the abbrev as a “system” abbrev with thesystem-typeproperty.Normally the function
define-abbrevsets the variableabbrevs-changedtot, if it actually changes the abbrev. (This is so that some commands will offer to save the abbrevs.) It does not do this for a “system” abbrev, since those won't be saved anyway.
If this variable is non-
nil, it means that the user plans to use global abbrevs only. This tells the commands that define mode-specific abbrevs to define global ones instead. This variable does not alter the behavior of the functions in this section; it is examined by their callers.