1 |
@c -*-texinfo-*- |
@c -*-texinfo-*- |
2 |
@c This is part of the GNU Emacs Lisp Reference Manual. |
@c This is part of the GNU Emacs Lisp Reference Manual. |
3 |
@c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999 |
@c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999 |
4 |
@c Free Software Foundation, Inc. |
@c Free Software Foundation, Inc. |
5 |
@c See the file elisp.texi for copying conditions. |
@c See the file elisp.texi for copying conditions. |
6 |
@setfilename ../info/loading |
@setfilename ../info/loading |
7 |
@node Loading, Byte Compilation, Customization, Top |
@node Loading, Byte Compilation, Customization, Top |
391 |
(autoload @var{filename} @var{docstring} @var{interactive} @var{type}) |
(autoload @var{filename} @var{docstring} @var{interactive} @var{type}) |
392 |
@end example |
@end example |
393 |
|
|
394 |
For example, |
For example, |
395 |
|
|
396 |
@example |
@example |
397 |
@group |
@group |
580 |
@code{features}; if it fails to do so, @code{require} signals an error. |
@code{features}; if it fails to do so, @code{require} signals an error. |
581 |
@cindex load error with require |
@cindex load error with require |
582 |
|
|
583 |
For example, in @file{emacs/lisp/prolog.el}, |
For example, in @file{emacs/lisp/prolog.el}, |
584 |
the definition for @code{run-prolog} includes the following code: |
the definition for @code{run-prolog} includes the following code: |
585 |
|
|
586 |
@smallexample |
@smallexample |
637 |
execute the @code{provide} call, so the subsequent @code{require} call |
execute the @code{provide} call, so the subsequent @code{require} call |
638 |
does nothing when the file is loaded. |
does nothing when the file is loaded. |
639 |
|
|
640 |
@defun provide feature |
@defun provide feature &optional subfeatures |
641 |
This function announces that @var{feature} is now loaded, or being |
This function announces that @var{feature} is now loaded, or being |
642 |
loaded, into the current Emacs session. This means that the facilities |
loaded, into the current Emacs session. This means that the facilities |
643 |
associated with @var{feature} are or will be available for other Lisp |
associated with @var{feature} are or will be available for other Lisp |
648 |
The argument @var{feature} must be a symbol. @code{provide} returns |
The argument @var{feature} must be a symbol. @code{provide} returns |
649 |
@var{feature}. |
@var{feature}. |
650 |
|
|
651 |
|
If provided, @var{subfeatures} should be a list of symbols indicating |
652 |
|
a set of specific subfeatures provided by this version of @var{feature}. |
653 |
|
|
654 |
@smallexample |
@smallexample |
655 |
features |
features |
656 |
@result{} (bar bish) |
@result{} (bar bish) |
684 |
provided}, unless @var{noerror} is non-@code{nil}. |
provided}, unless @var{noerror} is non-@code{nil}. |
685 |
@end defun |
@end defun |
686 |
|
|
687 |
@defun featurep feature |
@defun featurep feature &optional subfeature |
688 |
This function returns @code{t} if @var{feature} has been provided in the |
This function returns @code{t} if @var{feature} has been provided in the |
689 |
current Emacs session (i.e., if @var{feature} is a member of |
current Emacs session (i.e.@:, if @var{feature} is a member of |
690 |
@code{features}.) |
@code{features}.) If @var{subfeature} is non-nil, then the function |
691 |
|
returns @code{t} only if that subfeature is provided as well (i.e.@: |
692 |
|
if @var{subfeature} is a member of the @code{subfeature} property |
693 |
|
of the @var{feature} symbol.) |
694 |
@end defun |
@end defun |
695 |
|
|
696 |
@defvar features |
@defvar features |
750 |
and the features they require. |
and the features they require. |
751 |
|
|
752 |
Each element is a list and describes one library. The @sc{car} of the |
Each element is a list and describes one library. The @sc{car} of the |
753 |
list is the name of the library, as a string. The rest of the list is |
list is the name of the library, as a string. The rest of the list |
754 |
composed of these kinds of objects: |
elements have these forms: |
755 |
|
|
756 |
@itemize @bullet |
@table @code |
757 |
@item |
@item @var{fun} |
758 |
Symbols that were defined by this library. |
The function @var{fun} was defined by this library. |
759 |
@item |
@item (t . @var{fun}) |
760 |
Cons cells of the form @code{(require . @var{feature})} indicating |
The function @var{fun} was previously an autoload before this library |
761 |
features that were required. |
redefined it as a function. The following element is always the |
762 |
@item |
symbol @var{fun}, which signifies that the library defined @var{fun} |
763 |
Cons cells of the form @code{(provide . @var{feature})} indicating |
as a function. |
764 |
features that were provided. |
@item (autoload . @var{fun}) |
765 |
@end itemize |
The function @var{fun} was defined as an autoload. |
766 |
|
@item (defvar . @var{var}) |
767 |
|
The symbol @var{var} was defined as a variable. |
768 |
|
@item (require . @var{feature}) |
769 |
|
The feature @var{feature} was required. |
770 |
|
@item (provide . @var{feature}) |
771 |
|
The feature @var{feature} was provided. |
772 |
|
@end table |
773 |
|
|
774 |
The value of @code{load-history} may have one element whose @sc{car} is |
The value of @code{load-history} may have one element whose @sc{car} is |
775 |
@code{nil}. This element describes definitions made with |
@code{nil}. This element describes definitions made with |
809 |
library @var{library}, if and when @var{library} is loaded. If |
library @var{library}, if and when @var{library} is loaded. If |
810 |
@var{library} is already loaded, it evaluates @var{form} right away. |
@var{library} is already loaded, it evaluates @var{form} right away. |
811 |
|
|
812 |
The library name @var{library} must exactly match the argument of |
If @var{library} is a string, it must exactly match the argument of |
813 |
@code{load}. To get the proper results when an installed library is |
@code{load} used to load the library. To get the proper results when an |
814 |
found by searching @code{load-path}, you should not include any |
installed library is found by searching @code{load-path}, you should not |
815 |
directory names in @var{library}. |
include any directory names in @var{library}. |
816 |
|
|
817 |
|
@var{library} can also be a feature (i.e.@: a symbol), in which case |
818 |
|
@var{form} is evaluated when @code{(provide @var{library})} is called. |
819 |
|
|
820 |
An error in @var{form} does not undo the load, but does prevent |
An error in @var{form} does not undo the load, but does prevent |
821 |
execution of the rest of @var{form}. |
execution of the rest of @var{form}. |