emacs-devel
[Top][All Lists]
Advanced

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

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


From: Stefan Monnier
Subject: Re: Removing unloaded functions from auto-mode-alist.
Date: Tue, 19 Apr 2005 17:58:34 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

> 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?
These names belong to AUCTeX and are just wrong in tex-mode.el.
[ In the text below, I'll asume we remove those atrocities ]

>> - 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.
In the mean time, you can use an auctex-override-unload-hook to re-install
the autoloads.

>> 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 and we should fix the
unload-feature to properly re-install autoloads.

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)))))

   ;; 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?


        Stefan




reply via email to

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