comparison lispref/loading.texi @ 22623:ccc1f8081ef1

*** empty log message ***
author Richard M. Stallman <rms@gnu.org>
date Fri, 26 Jun 1998 20:10:57 +0000
parents 3967db186db6
children cbab915f61bb
comparison
equal deleted inserted replaced
22622:63c2279a26c4 22623:ccc1f8081ef1
685 library with @code{defun}, @code{defalias}, @code{defsubst}, 685 library with @code{defun}, @code{defalias}, @code{defsubst},
686 @code{defmacro}, @code{defconst}, @code{defvar}, and @code{defcustom}. 686 @code{defmacro}, @code{defconst}, @code{defvar}, and @code{defcustom}.
687 It then restores any autoloads formerly associated with those symbols. 687 It then restores any autoloads formerly associated with those symbols.
688 (Loading saves these in the @code{autoload} property of the symbol.) 688 (Loading saves these in the @code{autoload} property of the symbol.)
689 689
690 Before restoring the previous definitions, @code{unload-feature} runs
691 @code{remove-hook} to remove functions in the library from certain
692 hooks. These hooks include variables whose names end in @samp{hook} or
693 @samp{-hooks}, plus those listed in @code{loadhist-special-hooks}. This
694 is to prevent Emacs from ceasing to function because important hooks
695 refer to functions that are no longer defined.
696
697 @vindex @var{feature}-unload-hook
698 If these measures are not sufficient to prevent malfunction, a library
699 can define an explicit unload hook. If @code{@var{feature}-unload-hook}
700 is defined, it is run as a normal hook before restoring the previous
701 definitions, @emph{instead of} the usual hook-removing actions. The
702 unload hook ought to undo all the global state changes made by the
703 library that might cease to work once the library is unloaded.
704
690 Ordinarily, @code{unload-feature} refuses to unload a library on which 705 Ordinarily, @code{unload-feature} refuses to unload a library on which
691 other loaded libraries depend. (A library @var{a} depends on library 706 other loaded libraries depend. (A library @var{a} depends on library
692 @var{b} if @var{a} contains a @code{require} for @var{b}.) If the 707 @var{b} if @var{a} contains a @code{require} for @var{b}.) If the
693 optional argument @var{force} is non-@code{nil}, dependencies are 708 optional argument @var{force} is non-@code{nil}, dependencies are
694 ignored and you can unload any library. 709 ignored and you can unload any library.
724 739
725 The command @code{eval-region} updates @code{load-history}, but does so 740 The command @code{eval-region} updates @code{load-history}, but does so
726 by adding the symbols defined to the element for the file being visited, 741 by adding the symbols defined to the element for the file being visited,
727 rather than replacing that element. @xref{Eval}. 742 rather than replacing that element. @xref{Eval}.
728 743
744 Preloaded libraries don't contribute to @code{load-history}.
745
746 @tindex loadhist-special-hooks
747 @defvar loadhist-special-hooks
748 This variable holds a list of hooks to be scanned before unloading a
749 library, to remove functions defined in the library.
750 @end defvar
751
729 @node Hooks for Loading 752 @node Hooks for Loading
730 @section Hooks for Loading 753 @section Hooks for Loading
731 @cindex loading hooks 754 @cindex loading hooks
732 @cindex hooks for loading 755 @cindex hooks for loading
733 756