aboutsummaryrefslogtreecommitdiffstats
path: root/lispref/loading.texi
diff options
context:
space:
mode:
Diffstat (limited to 'lispref/loading.texi')
-rw-r--r--lispref/loading.texi109
1 files changed, 64 insertions, 45 deletions
diff --git a/lispref/loading.texi b/lispref/loading.texi
index 1b90ef5f2dd..221376f017a 100644
--- a/lispref/loading.texi
+++ b/lispref/loading.texi
@@ -36,15 +36,16 @@ Similarly, a ``Lisp library directory'' is a directory of files
36containing Lisp code. 36containing Lisp code.
37 37
38@menu 38@menu
39* How Programs Do Loading:: The @code{load} function and others. 39* How Programs Do Loading:: The @code{load} function and others.
40* Library Search:: Finding a library to load. 40* Library Search:: Finding a library to load.
41* Loading Non-ASCII:: Non-@acronym{ASCII} characters in Emacs Lisp files. 41* Loading Non-ASCII:: Non-@acronym{ASCII} characters in Emacs Lisp files.
42* Autoload:: Setting up a function to autoload. 42* Autoload:: Setting up a function to autoload.
43* Repeated Loading:: Precautions about loading a file twice. 43* Repeated Loading:: Precautions about loading a file twice.
44* Named Features:: Loading a library if it isn't already loaded. 44* Named Features:: Loading a library if it isn't already loaded.
45* Unloading:: How to ``unload'' a library that was loaded. 45* Where Defined:: Finding which file defined a certain symbol.
46* Hooks for Loading:: Providing code to be run when 46* Unloading:: to ``unload'' a library that was loaded.
47 particular libraries are loaded. 47* Hooks for Loading:: Providing code to be run when
48 particular libraries are loaded.
48@end menu 49@end menu
49 50
50@node How Programs Do Loading 51@node How Programs Do Loading
@@ -714,6 +715,60 @@ with a call to @code{provide}. The order of the elements in the
714@code{features} list is not significant. 715@code{features} list is not significant.
715@end defvar 716@end defvar
716 717
718@node Where Defined
719@section Which File Defined a Certain Symbol
720
721@defun symbol-file symbol &optional type
722This function returns the name of the file that defined @var{symbol}.
723If @var{type} is @code{nil}, then any kind of definition is
724acceptable. If @var{type} is @code{defun} or @code{defvar}, that
725specifies function definition only or variable definition only.
726
727The value is the file name as it was specified to @code{load}:
728either an absolute file name, or a library name
729(with no directory name and no @samp{.el} or @samp{.elc} at the end).
730It can also be @code{nil}, if the definition is not associated with any file.
731@end defun
732
733 The basis for @code{symbol-file} is the data in the variable
734@code{load-history}.
735
736@defvar load-history
737This variable's value is an alist connecting library names with the
738names of functions and variables they define, the features they provide,
739and the features they require.
740
741Each element is a list and describes one library. The @sc{car} of the
742list is the name of the library, as a string. The rest of the list
743elements have these forms:
744
745@table @code
746@item @var{var}
747The symbol @var{var} was defined as a variable.
748@item (defun . @var{fun})
749The @var{fun} was defined by this library.
750@item (t . @var{fun})
751The function @var{fun} was previously an autoload before this library
752redefined it as a function. The following element is always the
753symbol @var{fun}, which signifies that the library defined @var{fun}
754as a function.
755@item (autoload . @var{fun})
756The function @var{fun} was defined as an autoload.
757@item (require . @var{feature})
758The feature @var{feature} was required.
759@item (provide . @var{feature})
760The feature @var{feature} was provided.
761@end table
762
763The value of @code{load-history} may have one element whose @sc{car} is
764@code{nil}. This element describes definitions made with
765@code{eval-buffer} on a buffer that is not visiting a file.
766@end defvar
767
768 The command @code{eval-region} updates @code{load-history}, but does so
769by adding the symbols defined to the element for the file being visited,
770rather than replacing that element. @xref{Eval}.
771
717@node Unloading 772@node Unloading
718@section Unloading 773@section Unloading
719@cindex unloading 774@cindex unloading
@@ -760,42 +815,6 @@ ignored and you can unload any library.
760 The @code{unload-feature} function is written in Lisp; its actions are 815 The @code{unload-feature} function is written in Lisp; its actions are
761based on the variable @code{load-history}. 816based on the variable @code{load-history}.
762 817
763@defvar load-history
764This variable's value is an alist connecting library names with the
765names of functions and variables they define, the features they provide,
766and the features they require.
767
768Each element is a list and describes one library. The @sc{car} of the
769list is the name of the library, as a string. The rest of the list
770elements have these forms:
771
772@table @code
773@item @var{fun}
774The function @var{fun} was defined by this library.
775@item (t . @var{fun})
776The function @var{fun} was previously an autoload before this library
777redefined it as a function. The following element is always the
778symbol @var{fun}, which signifies that the library defined @var{fun}
779as a function.
780@item (autoload . @var{fun})
781The function @var{fun} was defined as an autoload.
782@item (defvar . @var{var})
783The symbol @var{var} was defined as a variable.
784@item (require . @var{feature})
785The feature @var{feature} was required.
786@item (provide . @var{feature})
787The feature @var{feature} was provided.
788@end table
789
790The value of @code{load-history} may have one element whose @sc{car} is
791@code{nil}. This element describes definitions made with
792@code{eval-buffer} on a buffer that is not visiting a file.
793@end defvar
794
795 The command @code{eval-region} updates @code{load-history}, but does so
796by adding the symbols defined to the element for the file being visited,
797rather than replacing that element. @xref{Eval}.
798
799@defvar unload-feature-special-hooks 818@defvar unload-feature-special-hooks
800This variable holds a list of hooks to be scanned before unloading a 819This variable holds a list of hooks to be scanned before unloading a
801library, to remove functions defined in the library. 820library, to remove functions defined in the library.