[Top][All Lists]

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

Re: Removing unloaded functions from auto-mode-alist.

From: David Kastrup
Subject: Re: Removing unloaded functions from auto-mode-alist.
Date: Tue, 19 Apr 2005 23:28:25 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

Stefan Monnier <address@hidden> 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

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

reply via email to

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