GNU Info

Info Node: (librep.info)Autoloading

(librep.info)Autoloading


Next: Features Prev: Load Function Up: Loading
Enter node , (file) or (file)node

Autoloading
-----------

   Obviously, not all features of the `librep' environment are always
used. "Autoloading" allows libraries to only be loaded when they are
first required. This speeds up the initialisation process and may save
memory.

   Functions which may be autoloaded have a special form in their
symbol's function cell--an "autoload form". This is a special kind of
closure. When the function call dispatcher finds one of these forms it
loads the program file specified in the form then re-evaluates the
function call. The true function definition will then have been loaded
and therefore the call may proceed as normal.

   Autoload stubs may be created through the `autoload' function.

 - Function: autoload symbol file #!optional is-command
     Installs an autoload form into the symbol SYMBOL. It marks that
     when SYMBOL is called as a function the lisp library FILE should
     be loaded to provided the actual definition of SYMBOL.

   It is not necessary to call the `autoload' function manually.
Simply prefix the definitions of all the functions that may be
autoloaded (i.e. the entry points to your module; _not_ all the
internal functions.) with the magic comment `;;;###autoload'. Then load
the file into the Jade editor and invoke the `add-autoloads' command,
creating all the necessary calls to the autoload function in the
`autoloads.jl' Lisp file (this file which lives in the Lisp library
directory is loaded when the environment is initialised).

`Meta-x add-autoloads'
     Scans the current buffer for any autoload definitions. Functions
     with the comment `;;;###autoload' preceding them have autoload
     forms inserted into the `autoloads.jl' file. Simply save this
     file's buffer and the new autoloads will be used the next time
     Jade is initialised.

     It is also possible to mark arbitrary forms for inclusion in the
     `autoloads.jl' file: put them on a single line which starts with
     the comment `;;;###autoload' call the command.

     The unsaved `autoloads.jl' buffer will become the current buffer.

          ;;;###autoload
          (defun foo (bar)                ;`foo' is to be autoloaded
            ...
          
          ;;;###autoload (setq x y)       ;Form to eval on initialisation

`Meta-x remove-autoloads'
     Remove all autoload forms from the `autoloads.jl' file which are
     marked by the `;;;###autoload' comment in the current buffer.

     The unsaved `autoloads.jl' buffer will become the current buffer.

   XXX these editor commands don't really belong here, but they'll do
for now...


automatically generated by info2www version 1.2.2.9