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
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
;;;###autoload
(defun unload-feature (feature &optional force)
"Unload the library that provided FEATURE, restoring all its autoloads.
-If the feature is required by any other loaded code, and optional FORCE
+If the feature is required by any other loaded code, and prefix arg FORCE
is nil, raise an error."
- (interactive (list (read-feature "Feature: ")))
+ (interactive (list (read-feature "Feature: ") current-prefix-arg))
(if (not (featurep feature))
(error "%s is not a currently loaded feature" (symbol-name feature)))
(if (not force)
(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)
;; 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)))