Stefan Monnier <[EMAIL PROTECTED]> 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 _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-devel