From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#61210: 28.2; Request to modify code which can accidentally overwrite AUCTeX function Date: Sat, 18 Mar 2023 18:35:05 -0400 Message-ID: References: <13008.1675253596@localhost> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="34515"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 61210@debbugs.gnu.org To: Ikumi Keita Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Mar 18 23:36:15 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pdf9r-0008nD-HB for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 18 Mar 2023 23:36:15 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pdf9f-0002ES-Tt; Sat, 18 Mar 2023 18:36:03 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pdf9e-0002EK-QV for bug-gnu-emacs@gnu.org; Sat, 18 Mar 2023 18:36:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pdf9e-0005kl-DX for bug-gnu-emacs@gnu.org; Sat, 18 Mar 2023 18:36:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pdf9e-0001d5-5y for bug-gnu-emacs@gnu.org; Sat, 18 Mar 2023 18:36:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 18 Mar 2023 22:36:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61210 X-GNU-PR-Package: emacs Original-Received: via spool by 61210-submit@debbugs.gnu.org id=B61210.16791789196194 (code B ref 61210); Sat, 18 Mar 2023 22:36:02 +0000 Original-Received: (at 61210) by debbugs.gnu.org; 18 Mar 2023 22:35:19 +0000 Original-Received: from localhost ([127.0.0.1]:49157 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pdf8w-0001bp-QK for submit@debbugs.gnu.org; Sat, 18 Mar 2023 18:35:19 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:57244) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pdf8u-0001ba-2e for 61210@debbugs.gnu.org; Sat, 18 Mar 2023 18:35:16 -0400 Original-Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 1564980814; Sat, 18 Mar 2023 18:35:10 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 8D069805B7; Sat, 18 Mar 2023 18:35:08 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1679178908; bh=kXMSYdu5VT/trR01eqwqhgS6ft3TaJw4ntX0hBzutRk=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=E0MwLZkuNN4yFBzga0WR5TKGb0/Irju88GHwEAL6iX4rjW9vU9eo08ELPvtyIu39Q s/mE1cfsk8w2p9JK1QnZWOyWkfG7Usaikhkn4kRrJvutSuceXzTFjb+xnddxmxqJpB Z+K/yMD1j4v49csitsaTVC3nTWVx5e3zsyjEYRMbcNIsEBjYdiiiNnlNxnHrucCtJa 8JRpi47upIh076+mHuMxjMUklBGsMCF0RGdDlfjkmielE/e4iWZgt4k6buMf9YRQc5 Gsoe96z+R2hVSqKAogtvKbxDh1zNSfC3mPi3eUiOvq6PxafbOY1WieVizavfFa4B/m YJCdB6vU15hyg== Original-Received: from alfajor (unknown [216.154.34.24]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 66FAB1232CE; Sat, 18 Mar 2023 18:35:08 -0400 (EDT) In-Reply-To: <13008.1675253596@localhost> (Ikumi Keita's message of "Wed, 01 Feb 2023 21:13:16 +0900") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:258215 Archived-At: > 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