Next: , Up: Loading   [Index]


11.1 Load Functions

Function: load filename &optional missing-ok nomessage nosuffix must-suffix

This function finds and opens a file of Lisp code, evaluates all the forms in it, and closes the file. If the option load-prefer-newer is non-nil, then when searching suffixes, load selects whichever version of a file (‘.elc’, ‘.el’, etc.) has been modified most recently.

If filename is a relative file name, load searches for the file using the variable load-path. The current default directory is tried only if it is specified in load-path, where nil stands for the default directory.

When found, Emacs sets the value of the variable load-file-name to that file’s name.

FILENAME

Execute a file of Lisp code named FILENAME. Append ‘.elc’, ‘.el’, system-dependent suffix of dynamic modules, unmodified. See load-suffixes. Env vars are replaced with their values by calling substitute-in-file-name.

MISSING-OK

If non-nil, don’t report error if FILE doesn’t exist.

NOMESSAGE

Print messages at start and end of loading unless this is non-nil.

NOSUFFIX

If non-nil, don’t add suffixes.

MUST-SUFFIX

If non-nil, insist on the suffix ‘.elc’ or ‘.el’ or the module suffix.

RETURN

Returns ’t’ if the file exists and loads successfully.