GNU bug report logs - #61210
28.2; Request to modify code which can accidentally overwrite AUCTeX function

Previous Next

Package: emacs;

Reported by: Ikumi Keita <ikumi <at> ikumi.que.jp>

Date: Wed, 1 Feb 2023 12:14:01 UTC

Severity: normal

Tags: moreinfo

Found in version 28.2

Done: Stefan Kangas <stefankangas <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 61210 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Ikumi Keita <ikumi <at> ikumi.que.jp>
Cc: 61210 <at> debbugs.gnu.org
Subject: Re: bug#61210: 28.2; Request to modify code which can accidentally
 overwrite AUCTeX function
Date: Sat, 18 Mar 2023 18:35:05 -0400
> If we do that in natural ways like
> (define-derived-mode LaTeX-mode text-mode "LaTeX" ...)
> or
> (defun LaTeX-mode () ...)
> , it could wreak havoc because tex-mode.el has these lines:
> ----------------------------------------------------------------------
> ;;;###autoload
> (defalias 'TeX-mode #'tex-mode)
> ;;;###autoload
> (defalias 'plain-TeX-mode #'plain-tex-mode)
> ;;;###autoload
> (defalias 'LaTeX-mode #'latex-mode)
> ----------------------------------------------------------------------
> These defalias'es overwrite the AUCTeX definition unconditionally if
> tex-mode.el are loaded after AUCTeX. So AUCTeX has to do workarounds

In Emacs-29 (see commit 18d75b4ab91fef6e344e612580088b714acfdb6e), the
above `defalias` are now predefined once and for all:

    ;;;###autoload (defalias 'TeX-mode #'tex-mode)
    ;;;###autoload (defalias 'plain-TeX-mode #'plain-tex-mode)
    ;;;###autoload (defalias 'LaTeX-mode #'latex-mode)

It's still not ideal, but at least  loading `tex-mode` won't override
any other definition such as AUCTeX's.  I'd like to hear what you think
about this "solution", both in the short term and what we could try to
do in the longer term (e.g. I'd like to aim to get rid of those
defaliases, but I'm not sure how to get there progressively.
`define-obsolete-function-alias` is not a solution because almost noone
will see those obsolescence warnings, and to make matters worse the
obsolecence will stay (and thus become incorrect) after AUCTeX redefines
the function.  Maybe we should predefine things like `TeX-mode` not as
an alias but as an actual function that emits an obsolecence warning of
some kind?).


        Stefan





This bug report was last modified 1 year and 285 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.