Go to the first, previous, next, last section, table of contents.


Load Function

Function: load program &optional no-error no-path no-suffix
This function loads the file containing the program called program; first the file is located then each top-level form contained by the file is read and evaluated in order.

Each directory named by the variable load-path is searched until the file containing program is found. In each directory three different file names are tried,

  1. program with `.jlc' appended to it. Files with a `.jlc' suffix are usually compiled Lisp files. See section Compiled Lisp.
  2. program with `.jl' appended, most uncompiled Lisp programs are stored in files with names like this.
  3. program with no modifications.

If none of these gives a result the next directory is searched in the same way, when all directories in load-path have been exhausted and the file still has not been found an error is signalled.

Next the file is opened for reading and Lisp forms are read from it one at a time, each form is evaluated before the next form is read. When the end of the file is reached the file has been loaded and this function returns t.

The optional arguments to this function are used to modify its behaviour,

no-error
When this argument is non-nil no error is signalled if the file can not be located. Instead the function returns nil.
no-path
The variable load-path is not used, program must point to the file from the current working directory.
no-suffix
When non-nil no `.jlc' or `.jl' suffixes are applied to the program argument when locating the file.

If a version of the program whose name ends in `.jlc' is older than a `.jl' version of the same file (i.e. the source code is newer than the compiled version) a warning is displayed and the `.jl' version is used.

(load "foobar")
    error--> File error: Can't open lisp-file, foobar

(load "foobar" t)
    => nil

Variable: load-path
A list of strings, each element is the name of a directory which is prefixed to the name of a program when Lisp program files are being searched for.

load-path
    => ("" "/usr/local/lib/jade/3.2/lisp/")

The element "" means the current directory, note that directory names should have an ending `/' (or whatever) so that when concatenated with the name of the file they make a meaningful filename.

Variable: lisp-lib-dir
The name of the directory in which the standard Lisp files are stored.

lisp-lib-dir
    => "/usr/local/lib/jade/3.2/lisp/"


Go to the first, previous, next, last section, table of contents.