diff options
| author | Richard M. Stallman | 2007-10-24 08:17:47 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2007-10-24 08:17:47 +0000 |
| commit | 0ade8edb2d4ee782cc5f1628284d273aed6871b7 (patch) | |
| tree | 25e2d07fd68b1ddcfed5aeaa7fc2c48287793754 | |
| parent | 39dc0d57c2940a3a0ac21590827835a1b196713e (diff) | |
| download | emacs-0ade8edb2d4ee782cc5f1628284d273aed6871b7.tar.gz emacs-0ade8edb2d4ee782cc5f1628284d273aed6871b7.zip | |
(Unloading): Document FEATURE-unload-function instead of FEATURE-unload-hook.
| -rw-r--r-- | lispref/loading.texi | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/lispref/loading.texi b/lispref/loading.texi index 058ed9c8984..34f1cff8900 100644 --- a/lispref/loading.texi +++ b/lispref/loading.texi | |||
| @@ -862,24 +862,27 @@ library with @code{defun}, @code{defalias}, @code{defsubst}, | |||
| 862 | It then restores any autoloads formerly associated with those symbols. | 862 | It then restores any autoloads formerly associated with those symbols. |
| 863 | (Loading saves these in the @code{autoload} property of the symbol.) | 863 | (Loading saves these in the @code{autoload} property of the symbol.) |
| 864 | 864 | ||
| 865 | @vindex unload-feature-special-hooks | ||
| 866 | Before restoring the previous definitions, @code{unload-feature} runs | 865 | Before restoring the previous definitions, @code{unload-feature} runs |
| 867 | @code{remove-hook} to remove functions in the library from certain | 866 | @code{remove-hook} to remove functions in the library from certain |
| 868 | hooks. These hooks include variables whose names end in @samp{hook} | 867 | hooks. These hooks include variables whose names end in @samp{hook} |
| 869 | or @samp{-hooks}, plus those listed in | 868 | or @samp{-hooks}, plus those listed in |
| 870 | @code{unload-feature-special-hooks}. This is to prevent Emacs from | 869 | @code{unload-feature-special-hooks}, as well as |
| 871 | ceasing to function because important hooks refer to functions that | 870 | @code{auto-mode-alist}. This is to prevent Emacs from ceasing to |
| 872 | are no longer defined. | 871 | function because important hooks refer to functions that are no longer |
| 872 | defined. | ||
| 873 | 873 | ||
| 874 | @vindex @var{feature}-unload-hook | 874 | Standard unloading activities also undoes ELP profiling of functions |
| 875 | in that library, unprovides any features provided by the library, and | ||
| 876 | cancels timers held in variables defined by the library. | ||
| 877 | |||
| 878 | @vindex @var{feature}-unload-function | ||
| 875 | If these measures are not sufficient to prevent malfunction, a library | 879 | If these measures are not sufficient to prevent malfunction, a library |
| 876 | can define an explicit unload hook. If @code{@var{feature}-unload-hook} | 880 | can define an explicit unloader named @code{@var{feature}-unload-function}. |
| 877 | is defined, it is run as a normal hook before restoring the previous | 881 | If that symbol is defined as a function, @code{unload-feature} calls |
| 878 | definitions, @emph{instead of} the usual hook-removing actions. The | 882 | it with no arguments before doing anything else. It can do whatever |
| 879 | unload hook ought to undo all the global state changes made by the | 883 | is appropriate to unload the library. If it returns @code{nil}, |
| 880 | library that might cease to work once the library is unloaded. | 884 | @code{unload-feature} proceeds to take the normal unload actions. |
| 881 | @code{unload-feature} can cause problems with libraries that fail to do | 885 | Otherwise it considers the job to be done. |
| 882 | this, so it should be used with caution. | ||
| 883 | 886 | ||
| 884 | Ordinarily, @code{unload-feature} refuses to unload a library on which | 887 | Ordinarily, @code{unload-feature} refuses to unload a library on which |
| 885 | other loaded libraries depend. (A library @var{a} depends on library | 888 | other loaded libraries depend. (A library @var{a} depends on library |