188 |
(string-match "-hooks?\\'" (symbol-name x))) |
(string-match "-hooks?\\'" (symbol-name x))) |
189 |
(memq x unload-feature-special-hooks))) ; Known abnormal hooks etc. |
(memq x unload-feature-special-hooks))) ; Known abnormal hooks etc. |
190 |
(dolist (y unload-hook-features-list) |
(dolist (y unload-hook-features-list) |
191 |
(when (eq (car-safe y) 'defun) |
(when (and (eq (car-safe y) 'defun) |
192 |
(remove-hook x (cdr y)))))))) |
(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))))) |
200 |
(when (fboundp 'elp-restore-function) ; remove ELP stuff first |
(when (fboundp 'elp-restore-function) ; remove ELP stuff first |
201 |
(dolist (elt unload-hook-features-list) |
(dolist (elt unload-hook-features-list) |
202 |
(when (symbolp elt) |
(when (symbolp elt) |
203 |
(elp-restore-function elt)))) |
(elp-restore-function elt)))) |
204 |
(dolist (x unload-hook-features-list) |
(dolist (x unload-hook-features-list) |
205 |
(if (consp x) |
(if (consp x) |
206 |
(progn |
(cond |
207 |
;; Remove any feature names that this file provided. |
;; Remove any feature names that this file provided. |
208 |
(when (eq (car x) 'provide) |
((eq (car x) 'provide) |
209 |
(setq features (delq (cdr x) features))) |
(setq features (delq (cdr x) features))) |
210 |
(when (eq (car x) 'defun) |
((eq (car x) 'defun) |
211 |
(let ((fun (cdr x))) |
(let ((fun (cdr x))) |
212 |
(when (fboundp fun) |
(when (fboundp fun) |
213 |
(when (fboundp 'ad-unadvise) |
(when (fboundp 'ad-unadvise) |
214 |
(ad-unadvise fun)) |
(ad-unadvise fun)) |
215 |
(fmakunbound fun) |
(fmakunbound fun) |
216 |
(let ((aload (get fun 'autoload))) |
(let ((aload (get fun 'autoload))) |
217 |
(when aload |
(when aload |
218 |
(fset fun (cons 'autoload aload)))))))) |
(fset fun (cons 'autoload aload)))))))) |
219 |
;; Kill local values as much as possible. |
;; Kill local values as much as possible. |
220 |
(dolist (buf (buffer-list)) |
(dolist (buf (buffer-list)) |
221 |
(with-current-buffer buf |
(with-current-buffer buf |
224 |
(unless (local-variable-if-set-p x) |
(unless (local-variable-if-set-p x) |
225 |
(makunbound x)))) |
(makunbound x)))) |
226 |
;; Delete the load-history element for this file. |
;; Delete the load-history element for this file. |
227 |
(let ((elt (assoc file load-history))) |
(setq load-history (delq (assoc file load-history) load-history)))) |
|
(setq load-history (delq elt load-history))))) |
|
228 |
|
|
229 |
(provide 'loadhist) |
(provide 'loadhist) |
230 |
|
|