Next: , Previous: Abbrev Mode, Up: Abbrevs


36.2 Abbrev Tables

This section describes how to create and manipulate abbrev tables.

— Function: make-abbrev-table

This function creates and returns a new, empty abbrev table—an obarray containing no symbols. It is a vector filled with zeros.

— Function: clear-abbrev-table table

This function undefines all the abbrevs in abbrev table table, leaving it empty. It always returns nil.

— Function: copy-abbrev-table table

This function returns a copy of abbrev table table—a new abbrev table that contains the same abbrev definitions. The only difference between table and the returned copy is that this function sets the property lists of all copied abbrevs to 0.

— Function: define-abbrev-table tabname definitions

This function defines tabname (a symbol) as an abbrev table name, i.e., as a variable whose value is an abbrev table. It defines abbrevs in the table according to definitions, a list of elements of the form (abbrevname expansion hook usecount system-flag). If an element of definitions has length less than five, omitted elements default to nil. A value of nil for usecount is equivalent to zero. The return value is always nil.

If this function is called more than once for the same tabname, subsequent calls add the definitions in definitions to tabname, rather than overriding the entire original contents. (A subsequent call only overrides abbrevs explicitly redefined or undefined in definitions.)

— Variable: abbrev-table-name-list

This is a list of symbols whose values are abbrev tables. define-abbrev-table adds the new abbrev table name to this list.

— Function: insert-abbrev-table-description name &optional human

This function inserts before point a description of the abbrev table named name. The argument name is a symbol whose value is an abbrev table. The return value is always nil.

If human is non-nil, the description is human-oriented. System abbrevs are listed and identified as such. Otherwise the description is a Lisp expression—a call to define-abbrev-table that would define name as it is currently defined, but without the system abbrevs. (The mode or package using name is supposed to add these to name separately.)