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: Thu, 14 Nov 2024 08:59:32 +0200 Message-ID: <86h68al2qz.fsf@gnu.org> References: <868qtnfd2d.fsf@gnu.org> <86r07elwoh.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31478"; mail-complaints-to="usenet@ciao.gmane.io" Cc: acm@muc.de, monnier@iro.umontreal.ca, 74339@debbugs.gnu.org To: Alan Mackenzie Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Nov 14 08:00:21 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 1tBTpz-0007vC-Oz for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 14 Nov 2024 08:00:20 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tBTpm-0002AU-Ae; Thu, 14 Nov 2024 02:00: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 1tBTpj-000280-Rl for bug-gnu-emacs@gnu.org; Thu, 14 Nov 2024 02:00: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 1tBTpj-0007kG-HJ for bug-gnu-emacs@gnu.org; Thu, 14 Nov 2024 02: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=7q4GfwjN3lQbqUW9UKIm1uviMwts4GixqLXjnPddbxY=; b=Ee1Qr3mBUitDv4Oj8Zl6L8IYxBa311aDeU9wL831eZGTVOduTQlRNZmZnpQsXNrUhBdefth69Fqn+PRSfc62kZaXaiSuQDZ44NKtdhFny2+CQDn8KfAW4hGu/L9qPLIJBjn9dE7YYUfsOX+9WF4s5V+IMHDnuISpRFv1e5lkacc0nXrwu6Einv2Z/t9MrY5Tl5LzUxbjQYryXeq01C2zco6Qhnc5YWab11ewMAH6wI0yvn5SJePqKhazl9oC+huNO8coVmP3iikjMcCw0wi2CAYhNsdvc1F9oDsliBWp/P3hx7RpxOHZf/brlw23EQnyQNL+VfSBKaruYru4T/k9Ag==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tBTpi-00054I-CA for bug-gnu-emacs@gnu.org; Thu, 14 Nov 2024 02:00: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: Thu, 14 Nov 2024 07:00: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.173156758419413 (code B ref 74339); Thu, 14 Nov 2024 07:00:02 +0000 Original-Received: (at 74339) by debbugs.gnu.org; 14 Nov 2024 06:59:44 +0000 Original-Received: from localhost ([127.0.0.1]:44704 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tBTpP-000532-Hu for submit@debbugs.gnu.org; Thu, 14 Nov 2024 01:59:43 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:46342) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tBTpN-00052l-1J for 74339@debbugs.gnu.org; Thu, 14 Nov 2024 01:59:41 -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 1tBTpG-0007g9-80; Thu, 14 Nov 2024 01:59:34 -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=7q4GfwjN3lQbqUW9UKIm1uviMwts4GixqLXjnPddbxY=; b=BCnU57UHUWIe RpK6gJrnfq+SV7yCakYdN/rwZgGEwLkt0hHVy86+XTcxaflsG886X+26eSnfo0x542dim3zKLLznc tKu1+ULTIRN2QoAZF4eWySwJhs2OmsfA3Cez1j3yIXuZy5Zih+oj49aXNstDcvb5yW2nnUImT77WD M6WUU18aBxUdlNbMYm22p8N2ez41Rabf3LjLpwtlZp9DYybozScdwZdx+Lg2G9+30LItV+Zu2bbxe gnZJhvFHaPyS/MJqDqsRhiwc0WJEX88avxWJjFkVoSplrISn6RacgVu7xPI7M7Cw/svtOg1UVxVIr brWJkcPW0/DfxCBtqsSoUw==; In-Reply-To: (message from Alan Mackenzie on Wed, 13 Nov 2024 22:34:19 +0000) 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:295304 Archived-At: > Date: Wed, 13 Nov 2024 22:34:19 +0000 > Cc: 74339@debbugs.gnu.org, Stefan Monnier , > acm@muc.de > From: Alan Mackenzie > > > > I did indeed amend CC Mode as I suggested, and that was the patch > > > currently under discussion. It is indeed not ideal. > > > It isn't "not ideal", it is simply buggy! We cannot possibly ignore > > user preferences in this way. Users are used to load c-ts-mode and > > expect that all the C/C++ files after that are visited using that > > mode. Now this expression of user preferences is completely ignored! > > Can I take it that you will respect the choice of users who wish to > remain on CC Mode as much as those who wish the new tree-sitter modes? Of course! That's what happens by default if the user didn't load c-ts-mode, and (under my suggested idea of a change) will happen if the user loads cc-mode after loading c-ts-mode. IOW, the last mode loaded will "win". > > If the user prefers to use c-ts-mode, then revert-buffer _should_ use > > c-ts-mode, not c-mode. The same happens if you change the way > > normal-mode determines the mode and then revert the buffer. This > > change in what revert-buffer does is now another user expectation your > > change has broken, and it, too, must be fixed. > > And if a user has made no such choice, normal-mode will forcibly change > the major modes of their buffers, whether they like it or not. No, it won't. This could happen only if the user loads c-ts-mode in-between, which means the user prefers c-ts-mode. Without that, normal-mode will always revert to c-mode in the default Emacs configuration. > > I'm not interested in having revert-buffer ignore user preferences of > > using c-ts-mode, ..... > > Instead Emacs ignores the perfectly reasonable preference to have > buffers modes stay the same as when the user set them. Reverting the buffer activates whatever major mode corresponds to the file name and other relevant settings at the moment of the reverting. If you modify those settings in-between, it is quite possible (and expected!) that normal-mode will activate a different mode. This is how Emacs always behaved (and should keep behaving). Anything else is against user expectations. > > If we can fix Emacs to behave like I described, i.e. return to the > > state where C/C++ files are visited in cc-mode rather than in > > c-ts-mode, just by reloading cc-mode, would you agree with such a fix? > > I think so, provided there was symmetry between the tree-sitter modes and > CC Mode. I would suggest the obvious fix; loading either one of the > libraries should append its entries to auto-mode-alist, having removed > any "lower down" entries. That's what I suggested. If you agree, let's make that change and move on.