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#74367: [PATCH] c-ts-mode.el: Adjust doc about how to change default modes Date: Sat, 16 Nov 2024 11:52:48 -0500 Message-ID: References: <86v7wnh2bk.fsf@gnu.org> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="36052"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Alan Mackenzie , 74367@debbugs.gnu.org, Stefan Kangas To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Nov 16 17:53:26 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 1tCM34-0009FD-4b for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 16 Nov 2024 17:53:26 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tCM2i-0007FF-FN; Sat, 16 Nov 2024 11:53:04 -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 1tCM2g-0007F6-CY for bug-gnu-emacs@gnu.org; Sat, 16 Nov 2024 11:53:02 -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 1tCM2g-0005gT-42 for bug-gnu-emacs@gnu.org; Sat, 16 Nov 2024 11:53:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=aieLVlVTcv5FKd0FYORW46qhjM/N5ll2OF4/qmksmG0=; b=X86JWekFOWkKGxg5DcI0f3SWCoKaEH1QOLoRlihKOEGRjuK0rlH1QDKXO+Y+f99bOHKeDTm4elpnhvjkkJyHqivMipTWZGZn1E8SiWDmhnBT3FW3/U+xFB75XMj3UCd/jZtTCJ6fXG5Q8qR5M6esI/34y7H5kaG2zpczrhQKlDnOUlWTroe4w4tGY91of2NjORFozgNxsr3iKYS6JMUJ0J7Vl5oxWk/in4ddPiCzK3mv4ja85td3Sq6Dgod8LOH12247jCVKqg2ryCmPxSlpJztk1LcCPtDh0Icw5y2begptXbBMRnt/LXt++qjEyYUSoqeLxOv49OnsyPrX77rMHw==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tCM2f-0004PB-S8 for bug-gnu-emacs@gnu.org; Sat, 16 Nov 2024 11:53:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 16 Nov 2024 16:53:01 +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.173177597916922 (code B ref 74367); Sat, 16 Nov 2024 16:53:01 +0000 Original-Received: (at 74367) by debbugs.gnu.org; 16 Nov 2024 16:52:59 +0000 Original-Received: from localhost ([127.0.0.1]:54569 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tCM2d-0004Os-8k for submit@debbugs.gnu.org; Sat, 16 Nov 2024 11:52:59 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:62449) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tCM2b-0004Oe-1s for 74367@debbugs.gnu.org; Sat, 16 Nov 2024 11:52:58 -0500 Original-Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id D23E2809C2; Sat, 16 Nov 2024 11:52:50 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1731775969; bh=axm3dgXP2migvQIkByGyjFKHAeWI6G5DrSUu8qxf4iI=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=bNT9hY7yGNALQVpbOJ+w2uzLh5hgj5o/mZqeDCYGuuEgeX8feZOI/25qPp7rBmrdu 00TM9liXKgj+Ear1AECLa1GpTAVIC78OMSpn/+N/sN79ubcIQbYcboDsxIjuuVfZg2 XnaUMGMMsALeGTVoDbktby+EqLvBjgPn3pb0kd23aLa93WqvU2tfr6ShyIWjkSRT9e nx16tJV5m2JxMNqIKyri6JteaN5BGJwM+LzcIAhwdVpKCGJ1Ef/fuXWecPGhRc5uMm echioMy5/tVDb/RKodFbmcFIO7ooJhJj6bcEOE8HYXkzT0u7jNn4QGf4LpP7i7nrmu IWobZwRe4V/Kw== Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id D48A1804BC; Sat, 16 Nov 2024 11:52:49 -0500 (EST) Original-Received: from pastel (104-195-225-43.cpe.teksavvy.com [104.195.225.43]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 9A00F1200BB; Sat, 16 Nov 2024 11:52:49 -0500 (EST) In-Reply-To: <86v7wnh2bk.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 16 Nov 2024 12:59:11 +0200") 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:295475 Archived-At: >> 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. Yup. I too often focus on the code and skip the doc. =F0=9F=99=81 > 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. `load`? Yuck! But well, better than nothing (tho it likely won't make much difference in an init file: the problem of later loading `cc-mode` will still bite just as much). I don't understand why you insist on suggesting such a "setting" since it's unreliable now and probably even more so in the future. What advantage do you see in it for the user over the `major-mode-remap-alist` option? > 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 the `c-or-c++-mode` function itself. Good point. > (And note that c-ts-mode doesn't limit the search for the regexp, > whereas cc-mode.el does.) Should we harmonize the two? Do we know if there's a reason other than accidental for the difference? Presumably the `cc-mode.el` one has been more widely tested. > 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. BTW, there's a similar issue with the `c-string-list-p` and `c-string-or-string-list-p` functions which are used for `safe-local-variable` which would cause `cc-vars.el` to be loaded for `c-ts-mode` users when a `dir-locals.el` sets some `c-mode` vars. Maybe we should move those things to a small `cc-utils.el` file which doesn't load other CC-mode files? [ Currently, this problem is hidden by the fact that we eagerly load `cc-mode.el` anyway (which also loads `cc-vars.el`) even before we try to look at those vars's `safe-local-variable` setting. ] Stefan