From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#74367: [PATCH] c-ts-mode.el: Adjust doc about how to change default modes Date: Sat, 16 Nov 2024 12:59:11 +0200 Message-ID: <86v7wnh2bk.fsf@gnu.org> References: Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20259"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 74367@debbugs.gnu.org, monnier@iro.umontreal.ca To: Stefan Kangas Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Nov 16 12:00:29 2024 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 1tCGXV-000557-7w for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 16 Nov 2024 12:00:29 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tCGX9-0001nc-Jp; Sat, 16 Nov 2024 06:00:07 -0500 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 1tCGX5-0001k7-TB for bug-gnu-emacs@gnu.org; Sat, 16 Nov 2024 06:00:03 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tCGX5-0002SX-JC for bug-gnu-emacs@gnu.org; Sat, 16 Nov 2024 06:00:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=References:In-Reply-To:From:Date:To:Subject; bh=DG2ceOkldwi9qx1dTDjHpC404kgAjt0VTn+yC36HT4Q=; b=WeeG1oXPBR8WEDG5cneEZfvt+gcQL0c/xy0Gv54Kxkx/yq9wxGMttWWkvL9+ZRaeZTOFqas2elW6luKJwhJ5a4qlIFt3BYUmEq1qQue05lzEIowgXvlT7Hleuak3dEwJeF8UaClZRM77r/6/FSjp1D4i4REap/bY2Dhpx5W/uSZO8LxEE769JglZzUQBykB/vd752zd17NrcPhuycOtzxo0yoMAxsC0KXEopzheA0EoHuPAXFW+jEJQ3Ts7ZzIPIngt6Bmt1Yw2qeI3SNVs1QTyYZ9F91sG6bK72KCkvGBtR98rfAv1SKw0DCPJlu+OZpSNG6FMqJ4Cgqgjt1HJOjA==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tCGX5-0004Lr-D8 for bug-gnu-emacs@gnu.org; Sat, 16 Nov 2024 06:00:03 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 16 Nov 2024 11:00:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74367 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 74367-submit@debbugs.gnu.org id=B74367.173175476916620 (code B ref 74367); Sat, 16 Nov 2024 11:00:03 +0000 Original-Received: (at 74367) by debbugs.gnu.org; 16 Nov 2024 10:59:29 +0000 Original-Received: from localhost ([127.0.0.1]:52244 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tCGWW-0004K0-Ki for submit@debbugs.gnu.org; Sat, 16 Nov 2024 05:59:28 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:42592) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tCGWS-0004JR-FM for 74367@debbugs.gnu.org; Sat, 16 Nov 2024 05:59:24 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tCGWM-0002KD-4c; Sat, 16 Nov 2024 05:59:18 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=DG2ceOkldwi9qx1dTDjHpC404kgAjt0VTn+yC36HT4Q=; b=ESBhb07ZksDh Z84CUPEKEo+HAJ6U7LJx0SsAcuY1PsNe8Ny5meRhFxaL6TIMXays9QSw163i4sH7KLVXgLSJrYM+W kXSeqhTYE9OsbXR2tYA0NfN9I+MiSyrjUucUoW6Bt+Qb06oBOPdAGoJ4OtBjl62zQT+FxPSwccoyo DPvA0WtebhHJwQz2OZyK5u42erwiqOuh7mSAiNTuvuwEIUwAZBpxvV+tyN4gbJMpPDXq8Sa12X5oZ zl3hK8CXP4eGlzT246dsdhxpEgHOi4ApTrsMTC/kkVQmUHZatu6TGDquMTzT9Rlhxzolr0+u2l9ZG LdZIer6U1V98Dr5etqYZgg==; In-Reply-To: (message from Stefan Kangas on Fri, 15 Nov 2024 13:15:38 -0800) 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:295442 Archived-At: > From: Stefan Kangas > Date: Fri, 15 Nov 2024 13:15:38 -0800 > > Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of > text editors" writes: > > > Tags: patch > > > > The doc of `c-ts-mode.el` currently recommends things we deprecate. > > The patch below fixes this. > > > > I think this can go into `emacs-30`, but I believe Eli prefers we leave > > this alone there, so I guess it would go to `master`. If we can install > > at least part of it into `emacs-30` (such as the removal of the > > recommendation to `require` or the suggestion to use the obsolete > > `c-or-c++-ts-mode`), I'll happily split it. > > FWIW, I agree that we should at least remove the recommendation to use > `require` on emacs-30, as it encourages bad habits and contributes to an > already poor understanding of autoloading among users. This all should have been discussed when major-mode-remap-defaults was added and c-ts-mode was modified to use it. Not now, sigh. Anyway, I don't want to remove the 'require' part from the commentary, but I think we should modify it to use 'load', not 'require' (given the discussion in bug#74339), and we should make it the second alternative, after the one that talks about using major-mode-remap-alist. I also don't think I agree with these removals: > @@ -1340,8 +1321,6 @@ c-ts-mode > > (add-to-list \\='major-mode-remap-alist \\='(c-mode . c-ts-mode)) > (add-to-list \\='major-mode-remap-alist \\='(c++-mode . c++-ts-mode)) > - (add-to-list \\='major-mode-remap-alist > - \\='(c-or-c++-mode . c-or-c++-ts-mode)) > > in your init files." > :group 'c > @@ -1410,8 +1389,6 @@ c++-ts-mode > > (add-to-list \\='major-mode-remap-alist \\='(c-mode . c-ts-mode)) > (add-to-list \\='major-mode-remap-alist \\='(c++-mode . c++-ts-mode)) > - (add-to-list \\='major-mode-remap-alist > - \\='(c-or-c++-mode . c-or-c++-ts-mode)) > > in your init files. The commit log message says > (c-ts-mode, c++-ts-mode): Don't suggest remapping `c-or-c++-mode` > to `c-or-c++-ts-mode` since `c-or-c++-ts-mode` is deprecated > since `c-or-c++-mode` already obeys the remapping of `c/c++-mode`. However, if we don't remap c-or-c++-mode, it will load cc-mode.el, which loads a bunch of other cc-*.el files, which is not clean, since all we need is a single regexp. (And note that c-ts-mode doesn't limit the search for the regexp, whereas cc-mode.el does.) So I think if we want to _really_ deprecate c-or-c++-ts-mode, we should make this variable defined on a separate file, common to CC Mode and c-ts-mode, which doesn't load anything else. Perhaps in subr.el or files.el. P.S. As an aside, I find our handling of this and related issues quite appalling. Variables introduced (or should I say "sneaked in"?), without properly discussing their effects on the users and without properly documenting those effects; unclean tricks to "fight off" changes installed by others, without properly describing those changes and triggering a discussion; etc. This is unbecoming, and almost feels like some kind of court intrigues. We should know better how to deal with controversial changes.