From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: David Kastrup Newsgroups: gmane.emacs.devel Subject: Re: Removing unloaded functions from auto-mode-alist. Date: Tue, 19 Apr 2005 18:25:25 +0200 Message-ID: <85ll7e68ei.fsf@lola.goethe.zz> References: <87zmvu6ba2.fsf@xs4all.nl> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1113928890 14885 80.91.229.2 (19 Apr 2005 16:41:30 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 19 Apr 2005 16:41:30 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Apr 19 18:41:29 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DNvlb-0004uS-WB for ged-emacs-devel@m.gmane.org; Tue, 19 Apr 2005 18:40:04 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DNvpx-0001rc-40 for ged-emacs-devel@m.gmane.org; Tue, 19 Apr 2005 12:44:33 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DNvpj-0001rM-Fn for emacs-devel@gnu.org; Tue, 19 Apr 2005 12:44:19 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DNvph-0001rA-Ja for emacs-devel@gnu.org; Tue, 19 Apr 2005 12:44:19 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DNvph-0001n0-FH for emacs-devel@gnu.org; Tue, 19 Apr 2005 12:44:17 -0400 Original-Received: from [151.189.21.47] (helo=mail-in-07.arcor-online.net) by monty-python.gnu.org with esmtp (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.34) id 1DNvaN-0002jT-5u for emacs-devel@gnu.org; Tue, 19 Apr 2005 12:28:27 -0400 Original-Received: from lola.goethe.zz (i538791E3.versanet.de [83.135.145.227]) by mail-in-07.arcor-online.net (Postfix) with ESMTP id AEDD6125686; Tue, 19 Apr 2005 18:26:17 +0200 (CEST) Original-Received: by lola.goethe.zz (Postfix, from userid 1002) id 5986B1C1E222; Tue, 19 Apr 2005 18:25:25 +0200 (CEST) Original-To: Lute Kamstra In-Reply-To: <87zmvu6ba2.fsf@xs4all.nl> (Lute Kamstra's message of "Tue, 19 Apr 2005 17:23:17 +0200") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) 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:36113 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:36113 Lute Kamstra writes: > unload-feature removes functions it is unloading from hooks. What > about removing these functions from auto-mode-alist as well? > > Index: lisp/loadhist.el > =================================================================== > RCS file: /cvsroot/emacs/emacs/lisp/loadhist.el,v > retrieving revision 1.32 > diff -c -r1.32 loadhist.el > *** lisp/loadhist.el 19 Apr 2005 15:08:05 -0000 1.32 > --- lisp/loadhist.el 19 Apr 2005 15:15:19 -0000 > *************** > *** 189,195 **** > (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) > (when (symbolp elt) > --- 189,200 ---- > (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))))))) > ! ;; Remove any feature-symbols from auto-mode-alist as well. > ! (dolist (elt unload-hook-features-list) > ! (when (eq (car-safe elt) 'defun) > ! (setq auto-mode-alist > ! (rassq-delete-all (cdr elt) auto-mode-alist))))) > (when (fboundp 'elp-restore-function) ; remove ELP stuff first > (dolist (elt unload-hook-features-list) > (when (symbolp elt) 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. Actually, stupid question in that area: does anybody think the following code more than duely insane? This is at the start of a file with generated autoloads: (provide 'auctex) ;;;###autoload (defmacro TeX-define () (read (current-buffer)) nil) (defmacro TeX-define () (let ((form (read (current-buffer))) symbol) (if (stringp (nth 3 form)) (setcar (nthcdr 3 form) (format (nth 3 form) "AUCTeX 11.3"))) (if (and (eq (car form) 'autoload) (fboundp (setq symbol (nth 1 (nth 1 form)))) (eq (car (symbol-function symbol)) 'autoload)) `(progn (defalias ',symbol '(autoload ,@(nthcdr 2 form))) (put ',symbol 'autoload ',(cdr (symbol-function symbol)))) form))) And the autoloads in the original are then something like ;;;###autoload (TeX-define) ;;;###autoload (defun tex-mode (arg) "This is a function from %s" ...) Here is the rationale: I want people to be able to put AUCTeX into the TeX tree and have it preloaded. The TeX-define autoloads are placed before definitions that are potentially _conflicting_ with tex-mode.el. I want to give people the option of having AUCTeX in the tree, and enabled by default on the site (with require 'auctex), while people that don't like it can get rid of it of the autoloads for AUCTeX completely with (unload-feature 'auctex). The Doc string gets salted with version info. Does anybody see any problems with that approach apart from the fact that it is crazy as anything? The autoload cookie in the above file is just for the purpose that somebody actually extracts autoloads from the AUCTeX tree. In that case, the cookie (auctex.el is conveniently alphabetically first and gets extracted as the first package) will disable _all_ autoload actions for such conflicting functions: they only spring into action when (require 'auctex) is actually executed. -- David Kastrup, Kriemhildstr. 15, 44793 Bochum