aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/loadhist.el12
1 files changed, 10 insertions, 2 deletions
diff --git a/lisp/loadhist.el b/lisp/loadhist.el
index 8ca1de4aeca..39d51a280f5 100644
--- a/lisp/loadhist.el
+++ b/lisp/loadhist.el
@@ -173,6 +173,9 @@ such as redefining an Emacs function."
173 (prin1-to-string dependents) file)))) 173 (prin1-to-string dependents) file))))
174 (let* ((unload-hook-features-list (feature-symbols feature)) 174 (let* ((unload-hook-features-list (feature-symbols feature))
175 (file (pop unload-hook-features-list)) 175 (file (pop unload-hook-features-list))
176 ;; If non-nil, this is a symbol for which we should
177 ;; restore a previous autoload if possible.
178 restore-autoload
176 (unload-hook (intern-soft (concat (symbol-name feature) 179 (unload-hook (intern-soft (concat (symbol-name feature)
177 "-unload-hook")))) 180 "-unload-hook"))))
178 ;; Try to avoid losing badly when hooks installed in critical 181 ;; Try to avoid losing badly when hooks installed in critical
@@ -209,6 +212,7 @@ such as redefining an Emacs function."
209 (dolist (elt unload-hook-features-list) 212 (dolist (elt unload-hook-features-list)
210 (when (symbolp elt) 213 (when (symbolp elt)
211 (elp-restore-function elt)))) 214 (elp-restore-function elt))))
215
212 (dolist (x unload-hook-features-list) 216 (dolist (x unload-hook-features-list)
213 (if (consp x) 217 (if (consp x)
214 (case (car x) 218 (case (car x)
@@ -221,10 +225,14 @@ such as redefining an Emacs function."
221 (when (fboundp 'ad-unadvise) 225 (when (fboundp 'ad-unadvise)
222 (ad-unadvise fun)) 226 (ad-unadvise fun))
223 (let ((aload (get fun 'autoload))) 227 (let ((aload (get fun 'autoload)))
224 (if aload 228 (if (and aload (eq fun restore-autoload))
225 (fset fun (cons 'autoload aload)) 229 (fset fun (cons 'autoload aload))
226 (fmakunbound fun)))))) 230 (fmakunbound fun))))))
227 ((t require defface) nil) 231 ;; (t . SYMBOL) comes before (defun . SYMBOL)
232 ;; and says we should restore SYMBOL's autoload
233 ;; when we undefine it.
234 ((t) (setq restore-autoload (cdr x)))
235 ((require defface) nil)
228 (t (message "Unexpected element %s in load-history" x))) 236 (t (message "Unexpected element %s in load-history" x)))
229 ;; Kill local values as much as possible. 237 ;; Kill local values as much as possible.
230 (dolist (buf (buffer-list)) 238 (dolist (buf (buffer-list))