From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: bug#74339: 30.0.92; CC Mode stomps C TS Mode Date: Fri, 15 Nov 2024 21:56:03 +0000 Message-ID: References: <86zfm1in2p.fsf@gnu.org> <86wmh5hrya.fsf@gnu.org> <86cyiwimlr.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="30295"; mail-complaints-to="usenet@ciao.gmane.io" Cc: acm@muc.de, Eli Zaretskii , Stefan Monnier , 74339@debbugs.gnu.org To: Stefan Kangas Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Nov 15 22:57:25 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 1tC4Jg-0007fS-Iw for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 15 Nov 2024 22:57:24 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tC4JN-0007Wl-GZ; Fri, 15 Nov 2024 16:57:05 -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 1tC4JL-0007W7-8M for bug-gnu-emacs@gnu.org; Fri, 15 Nov 2024 16:57: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 1tC4JL-0004RL-0Y for bug-gnu-emacs@gnu.org; Fri, 15 Nov 2024 16:57:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=From:In-Reply-To:MIME-Version:References:Date:To:Subject; bh=JDTtQIZ8+kwce8B0CgdW5PESjAietVzIJ/8bNCu2Ou4=; b=H49v7dMw+w3cfAJm1gle1bXjF2AZDMuF+o/MUvuj5vIo2Ai9Y/SOAHgcJssM8dnj1US+2KGCQwCPGy3zCru0OiQEDp7HieKWk5jYYwdcsiBqKkdz9kV0190CmdBl/PhomH8COgnLMmuVsrN3utQEg1TCdbsh4DV9IwqK44LSR33tSyxs1vZFLBr2s+eHjbJx0dQhf7Rp4F55A40KeZR+4IjEtJlseVk7Y3obd7+hvsNFnbft6d5/p2gM27OBl+zCMAJ41OlRpHEocTx63md+7BGQZJ1dzwN1U7s2IwfWvBiPefe0OWTQPB0tDEZkoWJCye9sXIibrJRanfUzqxIJtA==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tC4JK-0002L4-HB for bug-gnu-emacs@gnu.org; Fri, 15 Nov 2024 16:57:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 15 Nov 2024 21:57:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74339 X-GNU-PR-Package: emacs Original-Received: via spool by 74339-submit@debbugs.gnu.org id=B74339.17317077728925 (code B ref 74339); Fri, 15 Nov 2024 21:57:02 +0000 Original-Received: (at 74339) by debbugs.gnu.org; 15 Nov 2024 21:56:12 +0000 Original-Received: from localhost ([127.0.0.1]:51174 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tC4IV-0002Jt-UQ for submit@debbugs.gnu.org; Fri, 15 Nov 2024 16:56:12 -0500 Original-Received: from mail.muc.de ([193.149.48.3]:27241) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tC4IT-0002Je-VS for 74339@debbugs.gnu.org; Fri, 15 Nov 2024 16:56:10 -0500 Original-Received: (qmail 50100 invoked by uid 3782); 15 Nov 2024 22:56:03 +0100 Original-Received: from muc.de (p4fe1581d.dip0.t-ipconnect.de [79.225.88.29]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Fri, 15 Nov 2024 22:56:03 +0100 Original-Received: (qmail 21465 invoked by uid 1000); 15 Nov 2024 21:56:03 -0000 Content-Disposition: inline In-Reply-To: X-Submission-Agent: TMDA/1.3.x (Ph3nix) X-Primary-Address: acm@muc.de 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:295425 Archived-At: Hello, Stefan. On Fri, Nov 15, 2024 at 12:58:02 -0800, Stefan Kangas wrote: > Alan Mackenzie writes: > > On Fri, Nov 15, 2024 at 14:01:26 -0500, Stefan Monnier wrote: [ .... ] > > Here is a section of a test file sent to bug-cc-mode some while ago: > > /* > > ** Local Variables: > > ** mode:c > > ** indent-tabs-mode:nil > > ** c-basic-offset:4 > > ** End: > > */ > > Here it is evident that by "mode:c" the OP means C Mode, not whatever > > random mode happens to have taken the symbol `c-mode'. > Yes, that is how Emacs behaves by default. Only sort of, now. > However, the point of the new feature, major-mode-remap, is exactly to > allow users to override that. No, it is only _approximately_ for that. major-mode-remap-alist is for that. Modes using major-mode-remap-defaults override that setting without the users have much of a say. > This new feature is optional, and AFAICT the user choice is explicit > and not "random". No, that is the problem. Have a look at major-mode-remap-defaults, and how c-ts-mode uses it to cause the symbol `c-mode' to start c-ts-mode in certain circumstances. This is what I'm unhappy about. > Clearly, c-mode is still favored, as it is the default, and many of us > continue being happy users of it even while running a treesitter build. > So this new feature very clearly only affects users that have somehow > explicitly indicated that they want to use c-ts-mode instead. That "somehow" is the loading of c-ts-mode. I think that even C-h f c-ts-mode counts as an "explicit indication" of a supposed preference for c-ts-mode, given that it loads c-ts-mode (if it actually does). I don't think the current mechanism is ready for the release of Emacs 30. It hasn't been thought through thoroughly. > >> > .. This will cause the buffer to start in c-ts-mode regardless of any > >> > other current settings. > >> Actually, no: `major-mode-remap-*` can also remap `c-ts-mode` to some > >> other mode, such as `c-mode`. > > Maybe I should have said "regardless of any non-crazy settings". > What makes anything about that setting crazy? I think making a setting for c-ts-mode in order to get a buffer into c-mode is crazy. It is not the first thing one thinks about, faced with the problem of a buffer going into the wrong mode. > I'd use that setting, if I ever ran into any files with a "-*- c-ts -*-" > cookie. Similarly, I expect that c-ts-mode users will want to use > c-ts-mode precisely when a file has a "-*- c -*-" cookie. We don't have fine enough control. /* mode: c */ followed by /* c-basic-offset: 4 */ in the Local Variables: section is a sure sign that C Mode is intended, not a random C handling mode. What I think we're lacking is an explicit setting or command for the user to state what her preferred mode for C actually is. major-mode-remap-alist isn't that setting - it's too involved, too awkward, and it talks about "remappinig modes" (its internal mechanism) rather than the user's preferred Mode for C. What we need is a defcustom 3-valued radio-button defaulting to "no explicit preference", and having other values "c-mode" and "c-ts-mode". > Again, being able to do that is exactly the point of major-mode-remap. > I struggle to understand why that flexibility is controversial. It > puts more power into users' hands, that's all. It involves c-ts-mode purloining CC Mode's symbols for its own use. If a user wishes to use major-mode-remap-alist for that, that's one thing - having it done by default in major-mode-remap-defaults by Emacs is something quite different, which I think is unacceptable. -- Alan Mackenzie (Nuremberg, Germany).