aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/loadhist.el40
1 files changed, 23 insertions, 17 deletions
diff --git a/lisp/loadhist.el b/lisp/loadhist.el
index 1c71cc6cd07..da6fd695da3 100644
--- a/lisp/loadhist.el
+++ b/lisp/loadhist.el
@@ -188,27 +188,34 @@ such as redefining an Emacs function."
188 (string-match "-hooks?\\'" (symbol-name x))) 188 (string-match "-hooks?\\'" (symbol-name x)))
189 (memq x unload-feature-special-hooks))) ; Known abnormal hooks etc. 189 (memq x unload-feature-special-hooks))) ; Known abnormal hooks etc.
190 (dolist (y unload-hook-features-list) 190 (dolist (y unload-hook-features-list)
191 (when (eq (car-safe y) 'defun) 191 (when (and (eq (car-safe y) 'defun)
192 (remove-hook x (cdr y)))))))) 192 (not (get (cdr y) 'autoload)))
193 (remove-hook x (cdr y)))))))
194 ;; Remove any feature-symbols from auto-mode-alist as well.
195 (dolist (y unload-hook-features-list)
196 (when (and (eq (car-safe y) 'defun)
197 (not (get (cdr y) 'autoload)))
198 (setq auto-mode-alist
199 (rassq-delete-all (cdr y) auto-mode-alist)))))
193 (when (fboundp 'elp-restore-function) ; remove ELP stuff first 200 (when (fboundp 'elp-restore-function) ; remove ELP stuff first
194 (dolist (elt unload-hook-features-list) 201 (dolist (elt unload-hook-features-list)
195 (when (symbolp elt) 202 (when (symbolp elt)
196 (elp-restore-function elt)))) 203 (elp-restore-function elt))))
197 (dolist (x unload-hook-features-list) 204 (dolist (x unload-hook-features-list)
198 (if (consp x) 205 (if (consp x)
199 (progn 206 (cond
200 ;; Remove any feature names that this file provided. 207 ;; Remove any feature names that this file provided.
201 (when (eq (car x) 'provide) 208 ((eq (car x) 'provide)
202 (setq features (delq (cdr x) features))) 209 (setq features (delq (cdr x) features)))
203 (when (eq (car x) 'defun) 210 ((eq (car x) 'defun)
204 (let ((fun (cdr x))) 211 (let ((fun (cdr x)))
205 (when (fboundp fun) 212 (when (fboundp fun)
206 (when (fboundp 'ad-unadvise) 213 (when (fboundp 'ad-unadvise)
207 (ad-unadvise fun)) 214 (ad-unadvise fun))
208 (fmakunbound fun) 215 (fmakunbound fun)
209 (let ((aload (get fun 'autoload))) 216 (let ((aload (get fun 'autoload)))
210 (when aload 217 (when aload
211 (fset fun (cons 'autoload aload)))))))) 218 (fset fun (cons 'autoload aload))))))))
212 ;; Kill local values as much as possible. 219 ;; Kill local values as much as possible.
213 (dolist (buf (buffer-list)) 220 (dolist (buf (buffer-list))
214 (with-current-buffer buf 221 (with-current-buffer buf
@@ -217,8 +224,7 @@ such as redefining an Emacs function."
217 (unless (local-variable-if-set-p x) 224 (unless (local-variable-if-set-p x)
218 (makunbound x)))) 225 (makunbound x))))
219 ;; Delete the load-history element for this file. 226 ;; Delete the load-history element for this file.
220 (let ((elt (assoc file load-history))) 227 (setq load-history (delq (assoc file load-history) load-history))))
221 (setq load-history (delq elt load-history)))))
222 228
223(provide 'loadhist) 229(provide 'loadhist)
224 230