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: Thu, 14 Nov 2024 16:20:37 +0000 Message-ID: References: <868qtnfd2d.fsf@gnu.org> <86r07elwoh.fsf@gnu.org> <86h68al2qz.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="16845"; mail-complaints-to="usenet@ciao.gmane.io" Cc: acm@muc.de, monnier@iro.umontreal.ca, 74339@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Nov 14 17:21: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 1tBcaz-00047U-S8 for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 14 Nov 2024 17:21:26 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tBcae-00011I-F6; Thu, 14 Nov 2024 11:21: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 1tBcac-0000yk-G6 for bug-gnu-emacs@gnu.org; Thu, 14 Nov 2024 11:21: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 1tBcac-0000mP-7g for bug-gnu-emacs@gnu.org; Thu, 14 Nov 2024 11:21:02 -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=99CqHxYUwSG62YJyToT4DHG8WQ3hFaPfBYqt0hZ1zu4=; b=gDZsicPBFf3NQfrfuPFjJ/e5ybDmj88U9NbwRGt4Kx7abwHWyxI8lRmMdBpyvKFJx2Cm3sJu/52+fz5rxAnZlVG+0RZozBXbwKUKjoGLOp5GNQWgTIzlh7f2rSSGn2N/J1TE/Fp/XfCy3lFGukSiB2sziCmOX91dzKZwYR3g7xbNcDztwmwiwXx4S39ErZ8eUm+j7td/HWwRE09vUtwVRPBrmWFwmchItS1e7WS81PYU8rEE2fsjUgl8yM8hBiVigrDH4Wn9hXoNBv9qqI55wIyX0VDlDrAnV2kdi8aHTj7iSV/jBhfagnQ5Lsm+mwjkPdYpk56QFowlpHFtyTQ0gA==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tBcab-0007En-Re for bug-gnu-emacs@gnu.org; Thu, 14 Nov 2024 11:21:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 14 Nov 2024 16:21:01 +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.173160125027795 (code B ref 74339); Thu, 14 Nov 2024 16:21:01 +0000 Original-Received: (at 74339) by debbugs.gnu.org; 14 Nov 2024 16:20:50 +0000 Original-Received: from localhost ([127.0.0.1]:46891 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tBcaP-0007ED-8T for submit@debbugs.gnu.org; Thu, 14 Nov 2024 11:20:49 -0500 Original-Received: from mail.muc.de ([193.149.48.3]:35503) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tBcaM-0007Dx-14 for 74339@debbugs.gnu.org; Thu, 14 Nov 2024 11:20:47 -0500 Original-Received: (qmail 24518 invoked by uid 3782); 14 Nov 2024 17:20:39 +0100 Original-Received: from muc.de (pd953aec8.dip0.t-ipconnect.de [217.83.174.200]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Thu, 14 Nov 2024 17:20:39 +0100 Original-Received: (qmail 11614 invoked by uid 1000); 14 Nov 2024 16:20:37 -0000 Content-Disposition: inline In-Reply-To: <86h68al2qz.fsf@gnu.org> 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:295340 Archived-At: Hello, Eli. On Thu, Nov 14, 2024 at 08:59:32 +0200, Eli Zaretskii wrote: > > Date: Wed, 13 Nov 2024 22:34:19 +0000 > > Cc: 74339@debbugs.gnu.org, Stefan Monnier , > > acm@muc.de > > From: Alan Mackenzie [ .... ] > > 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". This is also not ideal, in that M-x c-ts-mode will mostly not change the preferred mode, but will do if it causes an autoload. I've been trying to think up something better, but all that springs to mind would be two commands `cc-mode-prefer' and `c-ts-mode-prefer'. > > > 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. OK, let's agree to disagree on this one. As a user, when I was comparing the two modes, I got annoyed at Emacs continually changing my major modes. I may not be the only one. Maybe (for Emacs 31?) there could be a user option to control this. > > > 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. OK. It would seem there is then no need to put entries for c-mode/c-ts-mode into major-mode-remap-defaults. I don't think this solution is optimal, though. Perhaps we can come up with something better for Emacs 31. But let's just go with this "last loaded wins" strategem for Emacs 30. -- Alan Mackenzie (Nuremberg, Germany).