]> code.delx.au - gnu-emacs/blobdiff - lisp/loadhist.el
(hif-nexttoken): Move to before first def.
[gnu-emacs] / lisp / loadhist.el
index beb4dd46e5c572d8f44a1cc9c4acc03fc11bef7f..daa388d502daae8e4e87382854acecff35629a9e 100644 (file)
@@ -97,8 +97,8 @@ return the feature \(symbol\)."
                           nil t)))
 
 (defvar loadhist-hook-functions
-  '(after-change-function after-change-functions
-after-insert-file-functions auto-fill-function before-change-function
+  '(after-change-functions
+after-insert-file-functions auto-fill-function
 before-change-functions blink-paren-function
 buffer-access-fontify-functions command-line-functions
 comment-indent-function kill-buffer-query-functions
@@ -107,7 +107,7 @@ mouse-position-function
 redisplay-end-trigger-functions temp-buffer-show-function
 window-scroll-functions window-size-change-functions
 write-region-annotate-functions)
-  "A list of special hooks from the `Standard Hooks' node of the Lisp manual.
+  "A list of special hooks from Info node `(elisp)Standard Hooks'.
 
 These are symbols with hook-type values whose names don't end in
 `-hook' or `-hooks', from which `unload-feature' tries to remove
@@ -150,10 +150,14 @@ is nil, raise an error."
          (if (or (and (boundp x)        ; Random hooks.
                       (consp (symbol-value x))
                       (string-match "-hooks?\\'" (symbol-name x)))
-                 (and (fboundp x)       ; Known abnormal hooks etc.
+                 (and (boundp x)       ; Known abnormal hooks etc.
                       (memq x loadhist-hook-functions)))
             (dolist (y (cdr flist))
               (remove-hook x y))))))
+    (if (fboundp 'elp-restore-function)        ; remove ELP stuff first
+       (dolist (elt (cdr flist))
+         (if (symbolp elt)
+             (elp-restore-function elt))))
     (mapc
      (lambda (x)
        (cond ((stringp x) nil)
@@ -161,11 +165,15 @@ is nil, raise an error."
               ;; Remove any feature names that this file provided.
               (if (eq (car x) 'provide)
                   (setq features (delq (cdr x) features))))
-             ((boundp x) (makunbound x))
-             ((fboundp x)
-              (fmakunbound x)
-              (let ((aload (get x 'autoload)))
-                (if aload (fset x (cons 'autoload aload)))))))
+            (t
+             (when (boundp x)
+               (makunbound x))
+             (when (fboundp x)
+               (if (fboundp 'ad-unadvise)
+                   (ad-unadvise x))
+               (fmakunbound x)
+               (let ((aload (get x 'autoload)))
+                 (if aload (fset x (cons 'autoload aload))))))))
      (cdr flist))
     ;; Delete the load-history element for this file.
     (let ((elt (assoc file load-history)))