aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman2004-12-27 16:52:33 +0000
committerRichard M. Stallman2004-12-27 16:52:33 +0000
commit82c59a6b1cf57c9facaa0c726560898da01ae216 (patch)
tree2e895736cf5166292a0919e2c5e87fb219f4e513
parent5d8d3a34e511f31561f031abc804645e6eb7dcd7 (diff)
downloademacs-82c59a6b1cf57c9facaa0c726560898da01ae216.tar.gz
emacs-82c59a6b1cf57c9facaa0c726560898da01ae216.zip
(Where Defined): New node.
(Unloading): load-history moved to Where Defined.
-rw-r--r--lispref/loading.texi91
1 files changed, 55 insertions, 36 deletions
diff --git a/lispref/loading.texi b/lispref/loading.texi
index 1b90ef5f2dd..183e706ddb4 100644
--- a/lispref/loading.texi
+++ b/lispref/loading.texi
@@ -42,6 +42,7 @@ containing Lisp code.
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* Where Defined:: Finding which file defined a certain symbol.
45* Unloading:: How to ``unload'' a library that was loaded. 46* Unloading:: How to ``unload'' a library that was loaded.
46* Hooks for Loading:: Providing code to be run when 47* Hooks for Loading:: Providing code to be run when
47 particular libraries are loaded. 48 particular libraries are loaded.
@@ -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.