From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Lute Kamstra Newsgroups: gmane.emacs.devel Subject: Re: Removing unloaded functions from auto-mode-alist. Date: Tue, 19 Apr 2005 23:05:08 +0200 Message-ID: <87wtqy4gvv.fsf@xs4all.nl> References: <87zmvu6ba2.fsf@xs4all.nl> <85ll7e68ei.fsf@lola.goethe.zz> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1113944911 6714 80.91.229.2 (19 Apr 2005 21:08:31 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 19 Apr 2005 21:08:31 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Apr 19 23:08:28 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DNzwR-0004VI-EC for ged-emacs-devel@m.gmane.org; Tue, 19 Apr 2005 23:07:31 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DO00p-0007Bu-0N for ged-emacs-devel@m.gmane.org; Tue, 19 Apr 2005 17:12:03 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DO00Y-0007Bj-OB for emacs-devel@gnu.org; Tue, 19 Apr 2005 17:11:46 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DO00X-0007BF-0R for emacs-devel@gnu.org; Tue, 19 Apr 2005 17:11:46 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DO00W-0007BC-S8 for emacs-devel@gnu.org; Tue, 19 Apr 2005 17:11:44 -0400 Original-Received: from [194.109.24.35] (helo=smtp-vbr15.xs4all.nl) by monty-python.gnu.org with esmtp (Exim 4.34) id 1DNzwX-00040Z-7M; Tue, 19 Apr 2005 17:07:37 -0400 Original-Received: from pijl (a80-127-67-124.adsl.xs4all.nl [80.127.67.124]) by smtp-vbr15.xs4all.nl (8.12.11/8.12.11) with ESMTP id j3JL5E0c096273; Tue, 19 Apr 2005 23:05:14 +0200 (CEST) (envelope-from Lute.Kamstra@xs4all.nl) Original-Received: from lute by pijl with local (Exim 3.36 #1 (Debian)) id 1DNzuD-0008LH-00; Tue, 19 Apr 2005 23:05:13 +0200 Original-To: David Kastrup In-Reply-To: <85ll7e68ei.fsf@lola.goethe.zz> (David Kastrup's message of "Tue, 19 Apr 2005 18:25:25 +0200") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) Original-Lines: 62 X-Virus-Scanned: by XS4ALL Virus Scanner X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:36122 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:36122 David Kastrup writes: > Lute Kamstra 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)