Next: Skeleton Language, Previous: Wrapping Skeletons, Up: Top [Contents][Index]

## 3 Skeletons as Abbrev Expansions

Rather than use a key binding for every skeleton command, you can also define an abbreviation (see Defining Abbrevs in The GNU Emacs Manual) that will expand (see Expanding Abbrevs in The GNU Emacs Manual) into the skeleton.

Say you want ‘`ifst`’ to be an abbreviation for the C language if statement. You will tell Emacs that ‘`ifst`’ expands to the empty string and then calls the skeleton command. In Emacs Lisp you can say something like `(define-abbrev c-mode-abbrev-table "ifst" "" 'c-if)`. Or you can edit the output from `M-x list-abbrevs` to make it look like this:

    (c-mode-abbrev-table)
    "ifst"           0    ""         c-if

(Some blank lines of no semantic significance, and other abbrev tables, have been omitted.)