diff options
| author | Eli Zaretskii | 2004-02-16 17:39:38 +0000 |
|---|---|---|
| committer | Eli Zaretskii | 2004-02-16 17:39:38 +0000 |
| commit | 8cb16ad11df1269550867b5f044a5037b0519234 (patch) | |
| tree | 7b5498073facce3f830e23b6c4ed69b70ea67935 /lisp | |
| parent | 7b5368c1a968812e9a82a54402d03cf487c22fad (diff) | |
| download | emacs-8cb16ad11df1269550867b5f044a5037b0519234.tar.gz emacs-8cb16ad11df1269550867b5f044a5037b0519234.zip | |
(unload-feature): Doc fix. Rename flist to unload-hook-features-list.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/loadhist.el | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/lisp/loadhist.el b/lisp/loadhist.el index 733129fc74f..80a59463d79 100644 --- a/lisp/loadhist.el +++ b/lisp/loadhist.el | |||
| @@ -120,7 +120,17 @@ pertinent symbols.") | |||
| 120 | (defun unload-feature (feature &optional force) | 120 | (defun unload-feature (feature &optional force) |
| 121 | "Unload the library that provided FEATURE, restoring all its autoloads. | 121 | "Unload the library that provided FEATURE, restoring all its autoloads. |
| 122 | If the feature is required by any other loaded code, and prefix arg FORCE | 122 | If the feature is required by any other loaded code, and prefix arg FORCE |
| 123 | is nil, raise an error." | 123 | is nil, raise an error. |
| 124 | |||
| 125 | This function tries to undo modifications made by the package to | ||
| 126 | hooks. Packages may define a hook FEATURE-unload-hook that is called | ||
| 127 | instead of the normal heuristics for doing this. Such a hook should | ||
| 128 | undo all the relevant global state changes that may have been made by | ||
| 129 | loading the package or executing functions in it. It has access to | ||
| 130 | the package's feature list (before anything is unbound) in the | ||
| 131 | variable `unload-hook-features-list' and could remove features from it | ||
| 132 | in the event that the package has done something normally-ill-advised, | ||
| 133 | such as redefining an Emacs function." | ||
| 124 | (interactive (list (read-feature "Feature: ") current-prefix-arg)) | 134 | (interactive (list (read-feature "Feature: ") current-prefix-arg)) |
| 125 | (if (not (featurep feature)) | 135 | (if (not (featurep feature)) |
| 126 | (error "%s is not a currently loaded feature" (symbol-name feature))) | 136 | (error "%s is not a currently loaded feature" (symbol-name feature))) |
| @@ -130,8 +140,8 @@ is nil, raise an error." | |||
| 130 | (if dependents | 140 | (if dependents |
| 131 | (error "Loaded libraries %s depend on %s" | 141 | (error "Loaded libraries %s depend on %s" |
| 132 | (prin1-to-string dependents) file)))) | 142 | (prin1-to-string dependents) file)))) |
| 133 | (let* ((flist (feature-symbols feature)) | 143 | (let* ((unload-hook-features-list (feature-symbols feature)) |
| 134 | (file (car flist)) | 144 | (file (car unload-hook-features-list)) |
| 135 | (unload-hook (intern-soft (concat (symbol-name feature) | 145 | (unload-hook (intern-soft (concat (symbol-name feature) |
| 136 | "-unload-hook")))) | 146 | "-unload-hook")))) |
| 137 | ;; Try to avoid losing badly when hooks installed in critical | 147 | ;; Try to avoid losing badly when hooks installed in critical |
| @@ -155,10 +165,10 @@ is nil, raise an error." | |||
| 155 | (string-match "-hooks?\\'" (symbol-name x))) | 165 | (string-match "-hooks?\\'" (symbol-name x))) |
| 156 | (and (boundp x) ; Known abnormal hooks etc. | 166 | (and (boundp x) ; Known abnormal hooks etc. |
| 157 | (memq x unload-feature-special-hooks))) | 167 | (memq x unload-feature-special-hooks))) |
| 158 | (dolist (y (cdr flist)) | 168 | (dolist (y (cdr unload-hook-features-list)) |
| 159 | (remove-hook x y)))))) | 169 | (remove-hook x y)))))) |
| 160 | (if (fboundp 'elp-restore-function) ; remove ELP stuff first | 170 | (if (fboundp 'elp-restore-function) ; remove ELP stuff first |
| 161 | (dolist (elt (cdr flist)) | 171 | (dolist (elt (cdr unload-hook-features-list)) |
| 162 | (if (symbolp elt) | 172 | (if (symbolp elt) |
| 163 | (elp-restore-function elt)))) | 173 | (elp-restore-function elt)))) |
| 164 | (mapc | 174 | (mapc |
| @@ -183,7 +193,7 @@ is nil, raise an error." | |||
| 183 | (fmakunbound x) | 193 | (fmakunbound x) |
| 184 | (let ((aload (get x 'autoload))) | 194 | (let ((aload (get x 'autoload))) |
| 185 | (if aload (fset x (cons 'autoload aload)))))))) | 195 | (if aload (fset x (cons 'autoload aload)))))))) |
| 186 | (cdr flist)) | 196 | (cdr unload-hook-features-list)) |
| 187 | ;; Delete the load-history element for this file. | 197 | ;; Delete the load-history element for this file. |
| 188 | (let ((elt (assoc file load-history))) | 198 | (let ((elt (assoc file load-history))) |
| 189 | (setq load-history (delq elt load-history))))) | 199 | (setq load-history (delq elt load-history))))) |