GNU Info

Info Node: (elisp)Defining Abbrevs

(elisp)Defining Abbrevs


Next: Abbrev Files Prev: Abbrev Tables Up: Abbrevs
Enter node , (file) or (file)node

Defining Abbrevs
================

   These functions define an abbrev in a specified abbrev table.
`define-abbrev' is the low-level basic function, while `add-abbrev' is
used by commands that ask for information from the user.

 - Function: add-abbrev table type arg
     This function adds an abbreviation to abbrev table TABLE based on
     information from the user.  The argument TYPE is a string
     describing in English the kind of abbrev this will be (typically,
     `"global"' or `"mode-specific"'); this is used in prompting the
     user.  The argument ARG is the number of words in the expansion.

     The return value is the symbol that internally represents the new
     abbrev, or `nil' if the user declines to confirm redefining an
     existing abbrev.

 - Function: define-abbrev table name expansion &optional hook count
     This function defines an abbrev named NAME, in TABLE, to expand to
     EXPANSION and call HOOK.  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 return value
     is a symbol that represents the abbrev inside Emacs; its name is
     NAME.

     The argument NAME should be a string.  The argument EXPANSION is
     normally the desired expansion (a string), or `nil' to undefine
     the abbrev.  If it is anything but a string or `nil', 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-nil symbol whose `no-self-insert' property is
     non-`nil', HOOK can explicitly control whether to insert the
     self-inserting input character that triggered the expansion.  If
     HOOK returns non-`nil' in this case, that inhibits insertion of
     the character.  By contrast, if HOOK returns `nil',
     `expand-abbrev' also returns `nil', as if expansion had not really
     occurred.

 - User Option: only-global-abbrevs
     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.


automatically generated by info2www version 1.2.2.9