Useful snip classes are defined by instantiating derived subclasses of
. A class derived from snip-class%
serves as a kind of “meta-class” for snips; each snip is associated
with an instance of snip-class%
as its snip class.
In deriving a new snip-class% class, override the
read method. Then, for each instance of the
derived class (where each instance corresponds to a single snip
Set the classname using set-classname.
Set the version using
Install the class into the list returned by
get-the-snip-class-list using the
add method. Note that if the same
name is inserted into the same class list multiple times, all
but the first insertion is ignored.
See also Snip Classes.
Creates a (useless) snip class.
Returns the class’s name, a string uniquely designating this snip
class. For example, the standard text snip classname is
"wxtext". Names beginning with wx are reserved.
A snip class name should usually have the form "((lib ...)\n(lib ...))" to enable on-demand loading of the class. See
Snip Classes for details.
Returns the version of this snip class. When attempting to load a file
containing a snip with the same class name but a different version,
the user is warned.
Reads a snip from a given stream, returning a newly created snip as
the result or #f if there is an error.
Called to read header information that may be useful for every snip
read in this class. This method is only called once per editor read
session, and only if the stream contains header information for this
The return value is #f if a read error occurs or anything else
See also write-header.
Returns the version number specified for this snip class for snips
currently being read from the given stream.
Called to write header information that may be useful for every snip
written for this class. This method is only called once per editor
write session, and only if the editor contains snips in this class.
When reading the snips back in, read-header will
only be called if write-header writes some data
to the stream.
The return value is #f if a write error occurs or anything else