[Top][All Lists]
[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: |
Wed, 20 Apr 2005 14:52:20 -0400 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) |
>>> 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.
Maybe not the problem described in the text I quoted, but if I have function
FOO autoloaded and (require 'blabla) replaces that with some other
definition, than an immediately following (unload-feature 'blabla) should
restore the autoload, no matter whether the autoload was pointing to
blabla.el or not.
> 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?
That's a different scenario. We'll cross that bridge when we get there.
>> 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.
As mentioned in another email, if you define with `fset' instead of
`defalias', the modification is not recorded, so the unload won't do any
`fmakunbound'.
> 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.
Of course.
>> 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.
Can't be much worse than leaving those functions undefined, can it?
>> 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.
It should be adaptable to other emacsen.
> 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.
My suggestion uses plain `defun' and normal auto-generated autoloads.
It concentrates all the icky bits in one file which does nothing else than
the icky bits of dealing with the conflict between AUCTeX and tex-mode on
the few toplevel functions like `tex-mode', `latex-mode', `texinfo-mode',
and `doctex-mode'.
Stefan
- Re: Removing unloaded functions from auto-mode-alist., (continued)
- 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, 2005/04/20
- Re: Removing unloaded functions from auto-mode-alist.,
Stefan Monnier <=
- 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
- Re: Removing unloaded functions from auto-mode-alist., Andreas Schwab, 2005/04/19