Next: , Previous: Wrapping Skeletons, Up: Top


3 Skeletons as Abbrev Expansions

Rather than use a key binding for every skeleton command, you can also define an abbreviation (see (emacs)Defining Abbrevs) that will expand (see (emacs)Expanding Abbrevs) 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)
     "if"	       0    ""	       c-if

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