emacs-pretest-bug
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: unload-feature is broken


From: Dave Love
Subject: Re: unload-feature is broken
Date: Mon, 18 Apr 2005 23:41:57 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/21.3 (gnu/linux)

Richard Stallman <address@hidden> writes:

> Does this fix it?

It seems to work for the feature's functions but not its variables.

By the way, the `fset' in `easy-menu-do-define' should be `defalias'
for the definition to be unloadable.

> *** loadhist.el       02 Jan 2005 18:45:48 -0500      1.30
> --- loadhist.el       12 Apr 2005 22:15:08 -0400      
> ***************
> *** 194,222 ****
>       (dolist (elt (cdr unload-hook-features-list))
>         (if (symbolp elt)
>             (elp-restore-function elt))))
> !     (mapc
> !      (lambda (x)
> !        (cond ((stringp x) nil)
> !              ((consp x)
> !               ;; Remove any feature names that this file provided.
> !               (if (eq (car x) 'provide)
> !                   (setq features (delq (cdr x) features)))
> !               (when (eq (car x) 'defvar)
> !             ;; Kill local values as much as possible.
> !             (dolist (buf (buffer-list))
> !               (with-current-buffer buf
> !                 (kill-local-variable (cdr x))))
> !             ;; Get rid of the default binding if we can.
> !             (unless (local-variable-if-set-p (cdr x))
> !               (makunbound (cdr x)))))
> !          (t
> !           (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 unload-hook-features-list))
>       ;; Delete the load-history element for this file.
>       (let ((elt (assoc file load-history)))
>         (setq load-history (delq elt load-history)))))
> --- 194,220 ----
>       (dolist (elt (cdr unload-hook-features-list))
>         (if (symbolp elt)
>             (elp-restore-function elt))))
> !     (dolist (x (cdr unload-hook-features-list))
> !       (when (consp x)
> !     ;; Remove any feature names that this file provided.
> !     (if (eq (car x) 'provide)
> !         (setq features (delq (cdr x) features)))
> !     (when (eq (car x) 'defvar)
> !       ;; Kill local values as much as possible.
> !       (dolist (buf (buffer-list))
> !         (with-current-buffer buf
> !           (kill-local-variable (cdr x))))
> !       ;; Get rid of the default binding if we can.
> !       (unless (local-variable-if-set-p (cdr x))
> !         (makunbound (cdr x))))
> !     (when (eq (car x) 'defun)
> !       (let ((fun (cdr x)))
> !         (when (fboundp fun)
> !           (if (fboundp 'ad-unadvise)
> !               (ad-unadvise fun))
> !           (fmakunbound fun)
> !           (let ((aload (get fun 'autoload)))
> !             (if aload (fset fun (cons 'autoload aload)))))))))
>       ;; Delete the load-history element for this file.
>       (let ((elt (assoc file load-history)))
>         (setq load-history (delq elt load-history)))))




reply via email to

[Prev in Thread] Current Thread [Next in Thread]