# HG changeset patch # User Richard M. Stallman # Date 898891857 0 # Node ID ccc1f8081ef18237878e51ce2fee74d05c9ba180 # Parent 63c2279a26c4bf6111df9c3272a52cba4bc15231 *** empty log message *** diff -r 63c2279a26c4 -r ccc1f8081ef1 lispref/loading.texi --- a/lispref/loading.texi Fri Jun 26 07:32:11 1998 +0000 +++ b/lispref/loading.texi Fri Jun 26 20:10:57 1998 +0000 @@ -687,6 +687,21 @@ It then restores any autoloads formerly associated with those symbols. (Loading saves these in the @code{autoload} property of the symbol.) +Before restoring the previous definitions, @code{unload-feature} runs +@code{remove-hook} to remove functions in the library from certain +hooks. These hooks include variables whose names end in @samp{hook} or +@samp{-hooks}, plus those listed in @code{loadhist-special-hooks}. This +is to prevent Emacs from ceasing to function because important hooks +refer to functions that are no longer defined. + +@vindex @var{feature}-unload-hook +If these measures are not sufficient to prevent malfunction, a library +can define an explicit unload hook. If @code{@var{feature}-unload-hook} +is defined, it is run as a normal hook before restoring the previous +definitions, @emph{instead of} the usual hook-removing actions. The +unload hook ought to undo all the global state changes made by the +library that might cease to work once the library is unloaded. + Ordinarily, @code{unload-feature} refuses to unload a library on which other loaded libraries depend. (A library @var{a} depends on library @var{b} if @var{a} contains a @code{require} for @var{b}.) If the @@ -726,6 +741,14 @@ by adding the symbols defined to the element for the file being visited, rather than replacing that element. @xref{Eval}. + Preloaded libraries don't contribute to @code{load-history}. + +@tindex loadhist-special-hooks +@defvar loadhist-special-hooks +This variable holds a list of hooks to be scanned before unloading a +library, to remove functions defined in the library. +@end defvar + @node Hooks for Loading @section Hooks for Loading @cindex loading hooks