Next: Inserting Pairs, Previous: Skeletons as Abbrevs, Up: Top
Skeletons are an shorthand extension to the Lisp language, where various
atoms directly perform either actions on the current buffer or rudimentary
flow control mechanisms. Skeletons are interpreted by the function
skeleton-insert.
A skeleton is a list starting with an interactor, which is usually a
prompt-string, or nil when not needed, but can also be a Lisp
expression for complex read functions or for returning some calculated value.
The rest of the list are any number of elements as described in the following
table:
"string", ?c, ?\cskeleton-transformation when that is non-nil.
?\n?\n to prevent alignment.
__ where nothing is wrapped.
>_, and
there is a interregion that will be wrapped here, indent that interregion.
&|-numberskeleton-untabify.
() or nilstrv1, v2'expressionstr in the subskeleton. They can also be used non-interactively, when
prompt is a lisp-expression that returns successive list-elements.
resume:quitnil when the resume: section was entered
because the user quit.
Some modes also use other skeleton elements they themselves defined. For
example in shell script mode's skeletons you will find < which does a
rigid indentation backwards, or in CC mode's skeletons you find the
self-inserting elements { and }. These are defined by the
buffer-local variable skeleton-further-elements which is a list of
variables bound while interpreting a skeleton.
The macro define-skeleton defines a command for interpreting a
skeleton. The first argument is the command name, the second is a
documentation string, and the rest is an interactor and any number of skeleton
elements together forming a skeleton. This skeleton is assigned to a variable
of the same name as the command and can thus be overridden from your
~/.emacs file (see Init File).