[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: |
Wed, 20 Apr 2005 00:33:36 +0200 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) |
Stefan Monnier <address@hidden> writes:
>> 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):
>
> Duh, this sucks!
> Any objection to removing those aliases?
Not here.
> These names belong to AUCTeX and are just wrong in tex-mode.el.
Well, that is my opinion, too.
> [ In the text below, I'll asume we remove those atrocities ]
I guess that they make handling the case where somebody has put
mode: LaTeX
in his local variable section easier. When the text then gets edited
by somebody without AUCTeX. AUCTeX itself uses 'latex-mode in
major-mode, and consequently also stores that in the mode variable
when it writes out local variables.
>>> - 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.
>
> That's a bug which we should fix.
I am not sure it is a bug. If I load several packages redefining one
symbol, and then unload _one_ of those packages, is it a good idea if
the symbol gets restored to an autoload?
> In the mean time, you can use an auctex-override-unload-hook to
> re-install the autoloads.
This hook is not available in XEmacs or in Emacs 21.3. And the normal
auctex-unload-hook is getting run before symbols are fmakunbound, so
can't restore the autoloads permanently.
>>> 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".
>
> I'd rather try and make my suggestion work than to follow down your
> insane path.
>
> I.e. we should remove those atrocities in tex-mode.el
It won't change that AUCTeX has to redefine tex-mode and latex-mode in
order to be a useful default mode, and that this needs to get reverted
by unload-feature.
> and we should fix the unload-feature to properly re-install
> autoloads.
I am not sure that reinstalling some old autoloads from some previous
time is "proper" here.
> In the mean time, you should be able make my suggestion work by using the
> following autoload-override.el file:
>
> ;; Override the atrocities in tex-mode.el.
> (fmakunbound 'TeX-mode)
> (autoload 'TeX-mode "...")
> ...
>
> (defvar TeX-saved-other-tex-autoloads
> (mapcar (lambda (f) (cons f (symbol-function f)))
> '(tex-mode latex-mode ...)))
>
> (add-hook 'auctex-override-unload-hook
> (lambda ()
> (dolist (x TeX-saved-other-tex-autoloads)
> (fset (car x) (cdr x)))))
Works only in Emacs 22. We'll talk about that solution in four years
or so.
> ;; Give preference to our
> (defalias 'tex-mode 'TeX-mode)
> ...
>
> Then users/admins can (require 'auctex-override) to make AUCTeX be
> the default, and if the admin made it the default, users can
> (unload-feature 'auctex-override) to make the other tex-mode be the
> default.
>
> Of course, you can name this file something else than
> `auctex-override'.
>
> It seems much less insane than your current code. WDYT?
I just remembered another reason for my insane approach: it gives me
working function documentation in the generated autoloads. Manual
autoloads don't give me that, and the string replacements in the DOC
string previously required using TeX-defun instead of just defun, and
that means manual autoloads.
Anyway, I spent about a day fixing this approach. For example, the
first version had just (read) in it instead of (read
(current-buffer)).
That was fine, until I ran the batch byte compiler for the first
time...
I guess I don't have the nerve just now to go for another approach
that would need extensive testing again. The current approach works
under HEAD, 21.3 and XEmacs-21.17 or something.
--
David Kastrup, Kriemhildstr. 15, 44793 Bochum
- Re: Removing unloaded functions from auto-mode-alist., (continued)
- Re: Removing unloaded functions from auto-mode-alist., Stefan Monnier, 2005/04/20
- Re: Removing unloaded functions from auto-mode-alist., David Kastrup, 2005/04/20
- Re: Removing unloaded functions from auto-mode-alist., Stefan Monnier, 2005/04/20
- Re: Removing unloaded functions from auto-mode-alist., David Kastrup, 2005/04/20
- Re: Removing unloaded functions from auto-mode-alist., Stefan Monnier, 2005/04/20
- Re: Removing unloaded functions from auto-mode-alist., David Kastrup, 2005/04/20
- Re: Removing unloaded functions from auto-mode-alist., David Kastrup, 2005/04/20
- Re: Removing unloaded functions from auto-mode-alist., Richard Stallman, 2005/04/21
- Re: Removing unloaded functions from auto-mode-alist., David Kastrup, 2005/04/21
- Re: Removing unloaded functions from auto-mode-alist., Richard Stallman, 2005/04/23
- Re: Removing unloaded functions from auto-mode-alist.,
David Kastrup <=
- Re: Removing unloaded functions from auto-mode-alist., Stefan Monnier, 2005/04/20
- Re: Removing unloaded functions from auto-mode-alist., Lute Kamstra, 2005/04/24
- Re: Removing unloaded functions from auto-mode-alist., David Kastrup, 2005/04/24
- Re: Removing unloaded functions from auto-mode-alist., Lute Kamstra, 2005/04/24
- Re: Removing unloaded functions from auto-mode-alist., David Kastrup, 2005/04/24
- Re: Removing unloaded functions from auto-mode-alist., Lute Kamstra, 2005/04/24
- Re: Removing unloaded functions from auto-mode-alist., David Kastrup, 2005/04/24
- Re: Removing unloaded functions from auto-mode-alist., Richard Stallman, 2005/04/26
- Re: Removing unloaded functions from auto-mode-alist., Lute Kamstra, 2005/04/20
- Re: Removing unloaded functions from auto-mode-alist., Lute Kamstra, 2005/04/19