unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Ikumi Keita <ikumi@ikumi.que.jp>
Cc: 61210@debbugs.gnu.org
Subject: bug#61210: 28.2; Request to modify code which can accidentally overwrite AUCTeX function
Date: Sat, 18 Mar 2023 18:35:05 -0400	[thread overview]
Message-ID: <jwvsfe14s07.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <13008.1675253596@localhost> (Ikumi Keita's message of "Wed, 01 Feb 2023 21:13:16 +0900")

> 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






  reply	other threads:[~2023-03-18 22:35 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-01 12:13 bug#61210: 28.2; Request to modify code which can accidentally overwrite AUCTeX function Ikumi Keita
2023-03-18 22:35 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2023-03-20 12:25   ` Ikumi Keita
2023-03-20 15:07     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-03-20 17:44       ` Ikumi Keita
2023-09-05 23:29         ` Stefan Kangas
2023-09-06  6:08           ` Ikumi Keita
2023-09-06  8:02             ` Stefan Kangas
2023-09-12 21:50             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvsfe14s07.fsf-monnier+emacs@gnu.org \
    --to=bug-gnu-emacs@gnu.org \
    --cc=61210@debbugs.gnu.org \
    --cc=ikumi@ikumi.que.jp \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).