From 6582d61ec5292f45f391af9a2c55054ef2bfab7f Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Fri, 26 Jun 1998 20:10:57 +0000 Subject: *** empty log message *** --- lispref/loading.texi | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'lispref') diff --git a/lispref/loading.texi b/lispref/loading.texi index fb2e3014b85..093644354e7 100644 --- a/lispref/loading.texi +++ b/lispref/loading.texi @@ -687,6 +687,21 @@ library with @code{defun}, @code{defalias}, @code{defsubst}, 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 @@ The value of @code{load-history} may have one element whose @sc{car} is 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 -- cgit v1.2.1