Previous: , Up: Defining Functions   [Contents][Index]


4.2 Declaring Functions

Simply writing the code for a function is not enough to make it available to the Lisp reader. You should use the specially treated init function in your emodule to let the lisp reader know about all the great subroutines you have coded, See Recognised Functions.

This is done by calling DEFSUBR with the name of the function (its C name, ya know?) as its only argument. Using the example function above, your body of the init function would look like:

void init(void)
{
        DEFSUBR(Fmy_function);
}

This call will instruct SXEmacs to make the function visible to the Lisp reader and will prepare for the insertion of the documentation into the right place. Once this is done, the user can call the Lisp function my-function.

Basically, that is all you need to define and proclaim new functional lisp bindings. The rules for what goes inside the functions, and how to write good emodules, is beyond the scope of this document. Please consult the SXEmacs internals manual for more details.