From 754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sun, 7 Apr 2024 13:41:34 -0500 Subject: new repository --- devdocs/elisp/unloading.html | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 devdocs/elisp/unloading.html (limited to 'devdocs/elisp/unloading.html') diff --git a/devdocs/elisp/unloading.html b/devdocs/elisp/unloading.html new file mode 100644 index 00000000..53caedff --- /dev/null +++ b/devdocs/elisp/unloading.html @@ -0,0 +1,12 @@ +

Unloading

You can discard the functions and variables loaded by a library to reclaim memory for other Lisp objects. To do this, use the function unload-feature:

Command: unload-feature feature &optional force +
+

This command unloads the library that provided feature feature. It undefines all functions, macros, and variables defined in that library with defun, defalias, defsubst, defmacro, defconst, defvar, and defcustom. It then restores any autoloads formerly associated with those symbols. (Loading saves these in the autoload property of the symbol.)

Before restoring the previous definitions, unload-feature runs remove-hook to remove functions defined by the library from certain hooks. These hooks include variables whose names end in ‘-hook’ (or the deprecated suffix ‘-hooks’), plus those listed in unload-feature-special-hooks, as well as auto-mode-alist. This is to prevent Emacs from ceasing to function because important hooks refer to functions that are no longer defined.

Standard unloading activities also undo ELP profiling of functions in that library, unprovides any features provided by the library, and cancels timers held in variables defined by the library.

If these measures are not sufficient to prevent malfunction, a library can define an explicit unloader named feature-unload-function. If that symbol is defined as a function, unload-feature calls it with no arguments before doing anything else. It can do whatever is appropriate to unload the library. If it returns nil, unload-feature proceeds to take the normal unload actions. Otherwise it considers the job to be done.

Ordinarily, unload-feature refuses to unload a library on which other loaded libraries depend. (A library a depends on library b if a contains a require for b.) If the optional argument force is non-nil, dependencies are ignored and you can unload any library.

+
+

The unload-feature function is written in Lisp; its actions are based on the variable load-history.

Variable: unload-feature-special-hooks +

This variable holds a list of hooks to be scanned before unloading a library, to remove functions defined in the library.

+
+

+ Copyright © 1990-1996, 1998-2022 Free Software Foundation, Inc.
Licensed under the GNU GPL license.
+ https://www.gnu.org/software/emacs/manual/html_node/elisp/Unloading.html +

+
-- cgit v1.2.3