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 20:35:25 +0200 Message-ID: <86plmvf2mq.fsf@gnu.org> References: <86v7wnh2bk.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14965"; mail-complaints-to="usenet@ciao.gmane.io" Cc: acm@muc.de, 74367@debbugs.gnu.org, stefankangas@gmail.com To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Nov 16 19:36:23 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 1tCNef-0003lS-L7 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 16 Nov 2024 19:36:21 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tCNeQ-0006Ck-Rg; Sat, 16 Nov 2024 13:36:06 -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 1tCNeN-0006CP-MA for bug-gnu-emacs@gnu.org; Sat, 16 Nov 2024 13:36:04 -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 1tCNeN-0004qJ-8j for bug-gnu-emacs@gnu.org; Sat, 16 Nov 2024 13:36: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=Y3XsUGI7pV9TPTHZWjjjDVaWnAe/PQTZlSGjw5Wz3Yw=; b=cgpq5rVwdhHTvxODnL86gBQTJ5WZsTD3h1EzUcCIp8oOK1XjXuFaXpbOdGRRNM7Z73dRjTQ/3l96HV0KiVbZU6eppW3TdN0D/mgWUl5s8+l+lzJucabPRF8wPQU1fqXCjaqIbXBkKlPIfkSfWEjZPvH50NYxtuqsPUTcNJEaJNpicykiQGA/UUNS358noJF/4oM1Xtb0d96FV/obCun51ufcM3w17vgxDtTO8dJU+q+cOu2kwGiFFMsHo3F+/0YBjvIcSoy677mYZG/n19xkkzKaR+v3G+PuNo9iLhUEJ/4eVrTCYwmkkuptf/Uj53oADabphZn6aCQKfzzCfnD7jQ==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tCNeM-0000ds-EX for bug-gnu-emacs@gnu.org; Sat, 16 Nov 2024 13:36:02 -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 18:36:02 +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.17317821432440 (code B ref 74367); Sat, 16 Nov 2024 18:36:02 +0000 Original-Received: (at 74367) by debbugs.gnu.org; 16 Nov 2024 18:35:43 +0000 Original-Received: from localhost ([127.0.0.1]:54766 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tCNe2-0000dH-De for submit@debbugs.gnu.org; Sat, 16 Nov 2024 13:35:42 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:50534) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tCNdx-0000d2-LK for 74367@debbugs.gnu.org; Sat, 16 Nov 2024 13:35:40 -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 1tCNdq-0004oh-P9; Sat, 16 Nov 2024 13:35:30 -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=Y3XsUGI7pV9TPTHZWjjjDVaWnAe/PQTZlSGjw5Wz3Yw=; b=G5hv1E9rw0Mx UWJpsYLkDbaOTOYzTWw9Mknf8gJbHFAgmfEk7LbPiMH7FC3nKjkdmqFZ/Am5egQ4g5z5CWEfSK+bh eg/fieNtcm815rRhVGGCN+wG79GuZ+geq7C6gvcSR+n75NFobw8g7xCWU9gHRJhXUETMnBvMSMwN3 X76JfB8xVAcLObhvwFhWZuxIBGn5D16kwz7SOwz+c8lsldK5/EKHmAMZxUxT30AXW9k8bKZzEsMFJ x6G8Cter9p+XJ498X2YLkeX75bKU8hGPiRFUjPHCqSTGNso0noT6BacFF4ZuCkSFur0m1gc+as8jq S7dKP/iCSbl7X0SdsuR9PQ==; In-Reply-To: (message from Stefan Monnier on Sat, 16 Nov 2024 11:52:48 -0500) 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:295481 Archived-At: > From: Stefan Monnier > Cc: Stefan Kangas , 74367@debbugs.gnu.org, Alan > Mackenzie > Date: Sat, 16 Nov 2024 11:52:48 -0500 > > > 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. Because that's what users did in Emacs 29. I don't want us to make an impression it no longer works. > What advantage do you see in it for the user over the > `major-mode-remap-alist` option? Since I agreed to make the major-mode-remap-alist the first item, is there still a question of the advantages of 'load' wrt major-mode-remap-alist? > > 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. I don't mind limiting the search in c-ts-mode, but then we need two common variables. > > 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. I think we should have a string-or-list-p function in subr.el, like string-or-null-p we already have there. > Maybe we should move those things to a small `cc-utils.el` file which > doesn't load other CC-mode files? That would also work for me.