[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Removing unloaded functions from auto-mode-alist.
From: |
Lute Kamstra |
Subject: |
Re: Removing unloaded functions from auto-mode-alist. |
Date: |
Tue, 19 Apr 2005 23:05:08 +0200 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) |
David Kastrup <address@hidden> writes:
> Lute Kamstra <address@hidden> writes:
>
>> unload-feature removes functions it is unloading from hooks. What
>> about removing these functions from auto-mode-alist as well?
[...]
> Actually, _both_ sound like a spectacularly bad idea if the unloaded
> function gets replaced by a restored autoload. I don't know the code
> well enough.
Good point.
I don't thinks it's that simple, though. The idea of (unload-feature
x) is to undo the changes introduced by feature x. If feature x puts
a function on a hook or in auto-mode-alist, then unload-feature should
remove it; even if that function is replaced by a restored autoload.
Unfortunately, there is no way to tell how that function got on a hook
or in auto-mode-alist.
I guess it can't hurt to leave a function on a hook or in
auto-mode-alist if it is replaced by a restored autoload. (Even if
feature x actually put it there.) See patch below. Erring on the
other side seems more damaging: removing a function from a hook when
that function was put there by a user's init file or something.
What do others think?
Lute.
Index: lisp/loadhist.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/loadhist.el,v
retrieving revision 1.32
diff -C2 -r1.32 loadhist.el
*** lisp/loadhist.el 19 Apr 2005 15:08:05 -0000 1.32
--- lisp/loadhist.el 19 Apr 2005 20:27:30 -0000
***************
*** 189,194 ****
(memq x unload-feature-special-hooks))) ; Known
abnormal hooks etc.
(dolist (y unload-hook-features-list)
! (when (eq (car-safe y) 'defun)
! (remove-hook x (cdr y))))))))
(when (fboundp 'elp-restore-function) ; remove ELP stuff first
(dolist (elt unload-hook-features-list)
--- 189,201 ----
(memq x unload-feature-special-hooks))) ; Known
abnormal hooks etc.
(dolist (y unload-hook-features-list)
! (when (and (eq (car-safe y) 'defun)
! (not (get (cdr y) 'autoload)))
! (remove-hook x (cdr y)))))))
! ;; Remove any feature-symbols from auto-mode-alist as well.
! (dolist (y unload-hook-features-list)
! (when (and (eq (car-safe y) 'defun)
! (not (get (cdr y) 'autoload)))
! (setq auto-mode-alist
! (rassq-delete-all (cdr y) auto-mode-alist)))))
(when (fboundp 'elp-restore-function) ; remove ELP stuff first
(dolist (elt unload-hook-features-list)
- Re: Removing unloaded functions from auto-mode-alist., (continued)
- Re: Removing unloaded functions from auto-mode-alist., David Kastrup, 2005/04/24
- Re: Removing unloaded functions from auto-mode-alist., Lute Kamstra, 2005/04/24
- Re: Removing unloaded functions from auto-mode-alist., David Kastrup, 2005/04/24
- Re: Removing unloaded functions from auto-mode-alist., Lute Kamstra, 2005/04/24
- Re: Removing unloaded functions from auto-mode-alist., David Kastrup, 2005/04/24
- Re: Removing unloaded functions from auto-mode-alist., Richard Stallman, 2005/04/26
- Re: Removing unloaded functions from auto-mode-alist., Lute Kamstra, 2005/04/20
- Re: Removing unloaded functions from auto-mode-alist., Lute Kamstra, 2005/04/19
- Re: Removing unloaded functions from auto-mode-alist., Andreas Schwab, 2005/04/19
- Re: Removing unloaded functions from auto-mode-alist., David Kastrup, 2005/04/20
Re: Removing unloaded functions from auto-mode-alist.,
Lute Kamstra <=