unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: David Kastrup <dak@gnu.org>
Cc: Lute Kamstra <Lute.Kamstra.lists@xs4all.nl>, emacs-devel@gnu.org
Subject: Re: Removing unloaded functions from auto-mode-alist.
Date: Tue, 19 Apr 2005 23:28:25 +0200	[thread overview]
Message-ID: <854qe2ihhi.fsf@lola.goethe.zz> (raw)
In-Reply-To: <jwvoecavf7i.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Tue, 19 Apr 2005 13:44:17 -0400")

Stefan Monnier <monnier@iro.umontreal.ca> 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

  reply	other threads:[~2005-04-19 21:28 UTC|newest]

Thread overview: 66+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-19 15:23 Removing unloaded functions from auto-mode-alist Lute Kamstra
2005-04-19 16:25 ` David Kastrup
2005-04-19 17:44   ` Stefan Monnier
2005-04-19 21:28     ` David Kastrup [this message]
2005-04-19 21:58       ` Stefan Monnier
2005-04-19 22:33         ` David Kastrup
2005-04-20 18:52           ` Stefan Monnier
2005-04-24 20:24             ` Lute Kamstra
2005-04-24 20:50               ` David Kastrup
2005-04-24 21:51                 ` Lute Kamstra
2005-04-24 22:00                   ` David Kastrup
2005-04-24 23:37                     ` Lute Kamstra
2005-04-25  0:07                       ` David Kastrup
2005-04-26 10:04                       ` Richard Stallman
2005-04-20 19:22           ` Lute Kamstra
2005-04-19 23:01         ` Stefan Monnier
2005-04-19 23:14         ` Lute Kamstra
2005-04-19 23:24           ` David Kastrup
2005-04-20 18:41             ` Stefan Monnier
2005-04-20 19:00               ` David Kastrup
2005-04-20 19:18                 ` Stefan Monnier
2005-04-20 19:50                   ` David Kastrup
2005-04-20 19:29               ` Lute Kamstra
2005-04-20 14:57           ` Richard Stallman
2005-04-20 15:59             ` Lute Kamstra
2005-04-21 15:30               ` Richard Stallman
2005-04-21 16:35                 ` Lute Kamstra
2005-04-22 20:51                   ` David Kastrup
2005-04-23 21:00                     ` Lute Kamstra
2005-04-23 22:10                       ` David Kastrup
2005-04-24 20:21                         ` Lute Kamstra
2005-04-24 20:32                           ` David Kastrup
2005-04-24 20:52                             ` Lute Kamstra
2005-04-25 16:05                             ` Richard Stallman
2005-04-23 22:24                     ` Richard Stallman
2005-04-20 14:57         ` Richard Stallman
2005-04-20 15:02           ` Stefan Monnier
2005-04-20 15:57             ` David Kastrup
2005-04-20 18:37               ` Stefan Monnier
2005-04-20 19:19                 ` David Kastrup
2005-04-20 20:11                   ` Stefan Monnier
2005-04-20 20:25                     ` David Kastrup
2005-04-20 20:57                       ` Stefan Monnier
2005-04-20 21:33                         ` David Kastrup
2005-04-20 16:25             ` Andreas Schwab
2005-04-20 16:57               ` David Kastrup
2005-04-20 22:47                 ` Andreas Schwab
2005-04-20 22:58                   ` David Kastrup
2005-04-21  9:56                     ` Andreas Schwab
2005-04-21 10:12                       ` David Kastrup
2005-04-21 11:50                         ` Andreas Schwab
2005-04-21 19:56                         ` Richard Stallman
2005-04-21 20:13                           ` David Kastrup
2005-04-23 16:15                             ` Richard Stallman
2005-04-23 16:23                               ` David Kastrup
2005-04-23 16:15                           ` Richard Stallman
2005-04-21 11:41                       ` Johan Vromans
2005-04-20 15:43           ` David Kastrup
2005-04-21 15:30             ` Richard Stallman
2005-04-21 17:46               ` David Kastrup
2005-04-23 16:15                 ` Richard Stallman
2005-04-19 22:00       ` Lute Kamstra
2005-04-19 23:22       ` Andreas Schwab
2005-04-19 23:33         ` David Kastrup
2005-04-19 21:05   ` Lute Kamstra
2005-04-20 14:57     ` Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=854qe2ihhi.fsf@lola.goethe.zz \
    --to=dak@gnu.org \
    --cc=Lute.Kamstra.lists@xs4all.nl \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).