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 23:28:25 +0200 Message-ID: <854qe2ihhi.fsf@lola.goethe.zz> 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 1113945957 30902 80.91.229.2 (19 Apr 2005 21:25:57 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 19 Apr 2005 21:25:57 +0000 (UTC) Cc: Lute Kamstra , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Apr 19 23:25:54 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DO0Dd-0006u5-KL for ged-emacs-devel@m.gmane.org; Tue, 19 Apr 2005 23:25:18 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DO0I1-0002P3-6s for ged-emacs-devel@m.gmane.org; Tue, 19 Apr 2005 17:29:49 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DO0Hn-0002Oo-LT for emacs-devel@gnu.org; Tue, 19 Apr 2005 17:29:35 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DO0Hm-0002Ob-2F for emacs-devel@gnu.org; Tue, 19 Apr 2005 17:29:35 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DO0Hm-0001Ds-0m for emacs-devel@gnu.org; Tue, 19 Apr 2005 17:29:34 -0400 Original-Received: from [151.189.21.45] (helo=mail-in-05.arcor-online.net) by monty-python.gnu.org with esmtp (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.34) id 1DO0J5-0005V6-7F for emacs-devel@gnu.org; Tue, 19 Apr 2005 17:30:55 -0400 Original-Received: from lola.goethe.zz (i5387800D.versanet.de [83.135.128.13]) by mail-in-05.arcor-online.net (Postfix) with ESMTP id B204C10D241; Tue, 19 Apr 2005 23:28:38 +0200 (CEST) Original-Received: by lola.goethe.zz (Postfix, from userid 1002) id E119C1C1E25E; Tue, 19 Apr 2005 23:28:25 +0200 (CEST) Original-To: Stefan Monnier In-Reply-To: (Stefan Monnier's message of "Tue, 19 Apr 2005 13:44:17 -0400") 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:36124 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:36124 Stefan Monnier writes: >> Does anybody see any problems with that approach apart from the fact >> that it is crazy as anything? > > Well, for one thing, it's crazy as anything. > > What about the following: > > - make all auctex thingies use the TeX- and LaTeX- prefix (i.e. no > conflict at all with the other tex-mode), Forget it, Bub. TeX-mode and LaTeX-mode are already taken as aliases. Who was the smart guy responsible for that? The annotations show: 1.3 (jimb 13-May-91): ;;;###autoload 1.17 (eric 23-Apr-93): (defalias 'TeX-mode 'tex-mode) 1.3 (jimb 13-May-91): ;;;###autoload 1.99 (rms 16-Feb-99): (defalias 'plain-TeX-mode 'plain-tex-mode) 1.99 (rms 16-Feb-99): ;;;###autoload 1.17 (eric 23-Apr-93): (defalias 'LaTeX-mode 'latex-mode) 1.1 (root 28-Aug-90): Ok, so it was "eric". At that time AUCTeX started to be sort of a contender, and AUCTeX used TeX-mode and LaTeX-mode, quite likely with the intent not to conflict. And maybe "eric" switched between computers and was surprised that TeX-mode worked on one system, and barfed on another. Anyway, this is not much as an option: as a package prefix, TeX and LaTeX are fine, but local variable blocks declaring a major mode should of course have the preference AUCTeX/tex-mode _not_ be decided by the _document_, but by the writer. So a document should just state "Ok, I am plain TeX rather than LaTeX" but not "ok, you have to edit me with tex-mode.el, or with AUCTeX". So the major mode put into the major-mode variable will be lowercased always, and thus the major mode calling function must work lowercased according to the preference of the user. Also auto-mode-alist will demand lowercase modes, and this makes sense. Now it turns out that for 90% of the unsuspecting users (that would never actually stoop to reading a manual), AUCTeX as a default installation is a much more appreciated choice than tex-mode.el. So I want Emacs distributions and system administrators have no qualms of preinstalling and activating it. However, people come in different flavors, and one flavor that prefers writing its documents in plain TeX rather than in LaTeX will also tend to prefer the small tex-mode solution over AUCTeX: if they wanted complex and convenient systems, they would not use plain TeX, anyway. And those people will get insulted if they get confronted with a default mode against their personal tastes that is hard to rip out of the system again. And frankly, the plain TeX mode of AUCTeX is not really exciting. So people should be free to get rid of AUCTeX easily. And if (unload-feature 'auctex) works, that would be perfect. Now unload-feature will not restore stuff that has been overwritten, like autoloads exchanged for different autoloads or overwritten with a function or alias that was not what the autoload was intended for. And that is what my stuff tries to fix: restoring autoloads at unload-feature that have been overwritten with conflicting info. Apparently, it works reasonably. Even better would be (I'll probably try doing this) if a file, when being loaded, only attached itself to those possibly conflicting function cells that had the correctly corresponding autoload. Then the user could arrange the autoloads for his favorite combination of AUCTeX and tex-mode, and even though both might get loaded, they would only occupy the space they were customized for. However, for this to play along, tex-mode.el would probably have to be changed as well. Or some eval-after-load cleans up after it. > with autoload cookies and stuff. > > - make a `auctex-override.el' file which does: > > (defalias 'tex-mode 'TeX-mode) > (defalias 'latex-mode 'LaTeX-mode) > ... > (provide 'auctex-override.el) > > Then (require 'auctex-override) makes AUCTeX the default, and hopefully an > (unload-feature 'auctex-override) will restore the default autloads for the > other tex-mode. Won't work. Autoloads corresponding to a different file than the loaded one don't get restored. I have not found the exact place that causes this, but only the "right" definitions cause the autoload to be saved in the autoload property of the corresponding function. Since I am using the "wrong" definitions in my approach, I have to manually put the autoload properties on. Which is what I do with the above code. > Completely untested, of course. Unfortunately, I tested this already. That's why I had to come up with a better scheme. Not "better" as in "nicer", but in "reckless enough to stand a chance of attaining its goal". -- David Kastrup, Kriemhildstr. 15, 44793 Bochum