2 * Very simple sample module. Illustrates most of the salient features
3 * of Emacs dynamic modules.
4 * (C) Copyright 1998, 1999 J. Kean Johnston. All rights reserved.
10 * This sample introduces three new Lisp objects to the Lisp reader.
11 * The first, a simple boolean value, and the second a string. The
12 * Third is a sample function that simply prints a message.
15 Lisp_Object Vsample_string;
17 DEFUN ("sample-function", Fsample_function, 0, 0, "", /*
18 This is a sample function loaded dynamically.
20 You will notice in the source code for this module that the
21 declaration is identical to internal Emacs functions. This
22 makes it possible to use the exact same code in a dumped
27 message ("Eureka! It worked");
32 * Each dynamically loaded Emacs module is given a name at compile
33 * time. This is a short name, and must be a valid part of a C
34 * identifier. This name is used to contruct the name of several
35 * functions which must appear in the module source code.
36 * The first such function, modules_of_XXXX, should load in any dependant
37 * modules. This function is optional, and the module will still load if
38 * it is not present in the module.
40 * The second function, which is NOT optional, is syms_of_XXXX, in which
41 * all functions that the module will be provided are declared. This
42 * function will contain calls to DEFSUBR().
44 * The third function, which is also NOT optional, is vars_of_XXXX, in
45 * which you declare all variables that the module provides. This
46 * function will contain calls to DEFVAR_LISP(), DEFVAR_BOOL() etc.
48 * When declaring functions and variables in the syms_of_XXXX and
49 * vars_of_XXXX functions, you use the exact same syntax that you
50 * would as if this module were being compiled into the pure Emacs.
52 * All three of these functions are declared as void functions,
53 * taking no parameters. Since this sample module is called 'sample',
54 * the functions will be named 'modules_of_sample', 'syms_of_sample'
55 * and 'vars_of_sample'.
62 * This function isn't actually required as we will not be loading
63 * in any dependant modules, but if we were, we would do something like:
64 * emodules_load ("dependant.ell", "sample2", "1.0.0");
71 DEFSUBR(Fsample_function);
77 DEFVAR_LISP ("sample-string", &Vsample_string /*
78 This is a sample string, declared in a dynamic module.
80 The syntax and conventions used for all normal Emacs variables
81 apply equally to modules, using an identical syntax.
84 DEFVAR_BOOL ("sample-boolean", &sample_bool /*
85 *Sample boolean value, in a dynamic module.
87 This is a user-settable variable, as indicated by the *
88 as the first character of the description. Declared in
89 a module exactly as it would be internally in Emacs.