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#74339: 30.0.92; CC Mode stomps C TS Mode Date: Sun, 24 Nov 2024 09:41:29 +0200 Message-ID: <86ttbxjcye.fsf@gnu.org> References: <868qtnfd2d.fsf@gnu.org> <86r07elwoh.fsf@gnu.org> <86h68al2qz.fsf@gnu.org> <867c95kaye.fsf@gnu.org> <861pzdk4aq.fsf@gnu.org> <86r075qasz.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="32335"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 74339@debbugs.gnu.org To: rms@gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Nov 24 08:43:13 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 1tF7Gz-0008KK-6p for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 24 Nov 2024 08:43:13 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tF7Gs-0004Wx-JW; Sun, 24 Nov 2024 02:43: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 1tF7Gp-0004Wk-Qr for bug-gnu-emacs@gnu.org; Sun, 24 Nov 2024 02:43: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 1tF7Go-0008Cu-Qr for bug-gnu-emacs@gnu.org; Sun, 24 Nov 2024 02:43: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=24fUjqtXdBoadlfCROb7aDlmXushMp/TlDvMjrBH/4k=; b=Q4V4rfbB3Ng7PPKpGPAX53d8k92HeD77rDSJbLOYYSJDEfu1nMhnA5oInpF4JMJes7C7zzFhld1vQS2Y0RkQadcHKXM8mHhLUI/K9aUf71bY7qn6PisLPSDukKqDCp5T3WO+DUJNG8vH27cIRcWXLg0sDynWwq3CnvXEK4Q3TMMcV3rhScWDoTY3xCzcqYLsmD6Zt5e41WR3nZ8WAIFFiXvSnVf47N49SyftJf8+oD24P+9jPtHgpB5hxgWk29GYeBXMxrSQSjp5RI41fcQ8BIqZMhGZ5XOoFZJadYuEGNbaKw27+wlApmG3NZ3itL0LRtkAl294G+3N8tIN+YYS3A==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tF7Go-0003pT-1Z for bug-gnu-emacs@gnu.org; Sun, 24 Nov 2024 02:43: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: Sun, 24 Nov 2024 07:43: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.173243412614641 (code B ref 74339); Sun, 24 Nov 2024 07:43:02 +0000 Original-Received: (at 74339) by debbugs.gnu.org; 24 Nov 2024 07:42:06 +0000 Original-Received: from localhost ([127.0.0.1]:60585 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tF7Ft-0003o5-Kn for submit@debbugs.gnu.org; Sun, 24 Nov 2024 02:42:06 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:52052) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tF7Fr-0003nX-FQ for 74339@debbugs.gnu.org; Sun, 24 Nov 2024 02:42:04 -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 1tF7Fm-0008BX-0l for 74339@debbugs.gnu.org; Sun, 24 Nov 2024 02:41:58 -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=24fUjqtXdBoadlfCROb7aDlmXushMp/TlDvMjrBH/4k=; b=jkMnvEOSgI5G RTnzVa1SY6U6exiuNXJ9F0rhEgXZudUDOeqDlOKFzKECRMsHuIWFz68on0rMZFuSKB5Cta9h3VcWu 8X5PMgaLP+8qkh7mx9NEumA6AI2mq1Nl6faimPyLofb3mPXF85vAodenbC3+h6COWx1mlrz8eVUZJ yByz1dk2W5sDR0i7rae9ASwyxW91Rx+XbWCknCh7qSHgzBDeTiDdKOf5LMp821CyxZP4jIoLB46KM bszdMcGjg30a8isZYfaxoSZDCuU/0aoj+QgfgNorb8mcRmUayeNGbf8M+Xo78MyeCetfnxl5C8VOS xm9fp+V4Us/1sfGIOUJXFg==; In-Reply-To: (message from Richard Stallman on Sat, 23 Nov 2024 23:35:10 -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:295893 Archived-At: > From: Richard Stallman > Cc: 74339@debbugs.gnu.org > Date: Sat, 23 Nov 2024 23:35:10 -0500 > > > I've now made changes in c-ts-mode.el on the emacs-30 branch that > > allow to remap CC Mode's C/C++ modes to the corresponding tree-sitter > > based modes as result of loading c-ts-mode, which resolves this bug. > > (cc-mode.el remains unchanged, so loading cc-mode will revert to using > > CC Mode, as it did before this change. IOW, the changes I installed > > make it possible for users to prefer c-ts-mode if they want, and leave > > intact the ability of users to prefer cc-mode if that is what they > > want.) > > This does help a user insist on c-mode rather than c-ts-mode. > However, setting that switch by loading file A or file B is not > natural. In Emacs we try to have a user option to control such a > choice. > > How about making a user option that will be tested on every occasion > whet it is time to put a buffer in one of those modes? It's more complicated than that. The situation where more than one major mode is appropriate for certain contents of a buffer is new in Emacs, we first encountered it in Emacs 29, quite close to its release. The solution took a couple of iterations, but eventually I decided that loading a mode will be the best alternative in the short term, although it has known issues. We are currently discussing the possible improvements, which include user option and more, in this thread: https://lists.gnu.org/archive/html/emacs-devel/2024-11/msg00636.html > The simplest way is to call the option `c-mode-use-tree-sitter'. I > think a similar option will be needed for each major mode that has a > TS counterpart. We could have an option like that for each of those > major modes. That is one possibility, but I'm not sure it's the best one. For example, if the user wants to prefer several such modes, calling a command for each one of them would be a nuisance. Also, having a separate command for each mode makes this harder to remember. There are also some issues regarding the implementation that we need to figure out. > Other user interfaces involving a single option to specify which > modes should get tree-sitter handling can be considered. > I think the goals are > > (1) the Customize interface should handle these options cleanly. > > (2) a user should be able to set this just once, and the setting will > stick in future Emacs versions (unless the user explicitly changes it) > as long as this aspect of Emacs doesn't fundamentally change. > > There could also be a command M-x major-mode-use-tree-sitter which > would toggle that switch for the current major mode. So if you use > that command while in a C mode buffer, it would change the value of > `c-mode-use-tree-sitter'. Perhaps it would also change the major mode > in each buffer that uses `c-mode' or `c-ts-mode'. All of this (and more) is in scope of the above discussion. I hope we will have a much better solution for this in Emacs 31.