aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/loadhist.el44
1 files changed, 21 insertions, 23 deletions
diff --git a/lisp/loadhist.el b/lisp/loadhist.el
index 76ef87ee845..473c8dc3bc8 100644
--- a/lisp/loadhist.el
+++ b/lisp/loadhist.el
@@ -194,29 +194,27 @@ such as redefining an Emacs function."
194 (dolist (elt (cdr unload-hook-features-list)) 194 (dolist (elt (cdr unload-hook-features-list))
195 (if (symbolp elt) 195 (if (symbolp elt)
196 (elp-restore-function elt)))) 196 (elp-restore-function elt))))
197 (mapc 197 (dolist (x (cdr unload-hook-features-list))
198 (lambda (x) 198 (when (consp x)
199 (cond ((stringp x) nil) 199 ;; Remove any feature names that this file provided.
200 ((consp x) 200 (if (eq (car x) 'provide)
201 ;; Remove any feature names that this file provided. 201 (setq features (delq (cdr x) features)))
202 (if (eq (car x) 'provide) 202 (when (eq (car x) 'defvar)
203 (setq features (delq (cdr x) features))) 203 ;; Kill local values as much as possible.
204 (when (eq (car x) 'defvar) 204 (dolist (buf (buffer-list))
205 ;; Kill local values as much as possible. 205 (with-current-buffer buf
206 (dolist (buf (buffer-list)) 206 (kill-local-variable (cdr x))))
207 (with-current-buffer buf 207 ;; Get rid of the default binding if we can.
208 (kill-local-variable (cdr x)))) 208 (unless (local-variable-if-set-p (cdr x))
209 ;; Get rid of the default binding if we can. 209 (makunbound (cdr x))))
210 (unless (local-variable-if-set-p (cdr x)) 210 (when (eq (car x) 'defun)
211 (makunbound (cdr x))))) 211 (let ((fun (cdr x)))
212 (t 212 (when (fboundp fun)
213 (when (fboundp x) 213 (if (fboundp 'ad-unadvise)
214 (if (fboundp 'ad-unadvise) 214 (ad-unadvise fun))
215 (ad-unadvise x)) 215 (fmakunbound fun)
216 (fmakunbound x) 216 (let ((aload (get fun 'autoload)))
217 (let ((aload (get x 'autoload))) 217 (if aload (fset fun (cons 'autoload aload)))))))))
218 (if aload (fset x (cons 'autoload aload))))))))
219 (cdr unload-hook-features-list))
220 ;; Delete the load-history element for this file. 218 ;; Delete the load-history element for this file.
221 (let ((elt (assoc file load-history))) 219 (let ((elt (assoc file load-history)))
222 (setq load-history (delq elt load-history))))) 220 (setq load-history (delq elt load-history)))))