From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#74339: 30.0.92; CC Mode stomps C TS Mode Date: Fri, 15 Nov 2024 15:45:46 -0500 Message-ID: References: <861pzdk4aq.fsf@gnu.org> <86zfm1in2p.fsf@gnu.org> <86wmh5hrya.fsf@gnu.org> <86cyiwimlr.fsf@gnu.org> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="8711"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Eli Zaretskii , 74339@debbugs.gnu.org To: Alan Mackenzie Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Nov 15 21:46:20 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 1tC3Ct-00029r-6N for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 15 Nov 2024 21:46:19 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tC3Ce-0006K7-TW; Fri, 15 Nov 2024 15:46: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 1tC3Cd-0006Jw-1c for bug-gnu-emacs@gnu.org; Fri, 15 Nov 2024 15:46: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 1tC3Cc-0002yi-Oc for bug-gnu-emacs@gnu.org; Fri, 15 Nov 2024 15:46:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=Bv/y7Hp8kNU3B/H8eYWX5FZM/HOw9oLHNoOj+QUnbuE=; b=T/EUClzjgskNZD9woecfaDyGfxzSaRd+frLRYxz2ZceepJ1CgVkzExd9MzINxJlddlOvTTF+Tss3KAUl7vTjYMTN9sNQAgN6yLhOjCiS7lvzhY/JBot/m0/++Xm8oNrS5AdjxZc+J+mQtlYUl3Oi867fCCkjApvpShkSpOBsvLeZtnIRVWiZDqD1W5cy1DH7Es1vj2gE76YoJn1bzQp09dqnvjBURKwC5ljEnh7UDzkueHv2wGhoc74DG3wgb22pXWJ6SS3XyXBeHoZiJdTSWI+8euxdZI3fJzWTsrdibtWN13TutrJyquOARA4v/+eeztSnp6czqay8ZtsiL26hhg==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tC3Cc-0007V9-Hc for bug-gnu-emacs@gnu.org; Fri, 15 Nov 2024 15:46:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 15 Nov 2024 20:46: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.173170355728822 (code B ref 74339); Fri, 15 Nov 2024 20:46:02 +0000 Original-Received: (at 74339) by debbugs.gnu.org; 15 Nov 2024 20:45:57 +0000 Original-Received: from localhost ([127.0.0.1]:51019 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tC3CW-0007Uo-SO for submit@debbugs.gnu.org; Fri, 15 Nov 2024 15:45:57 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:41146) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tC3CU-0007UY-Cp for 74339@debbugs.gnu.org; Fri, 15 Nov 2024 15:45:54 -0500 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id B276B444D13; Fri, 15 Nov 2024 15:45:48 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1731703547; bh=C5xkR00sok1YQm/5JAZdSRg01yC6EbKdDrjm1XCXhRw=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=i7gyLzWRcx4lnSHcHIFEqReC0xcJT67lv+zR2cqT9ed1Dzn2Uoc+bw/3xhBIrfcZy q1RRSNcVpR8Od3w/Tu12VLh5iVljGRNTJ+Cso27UCtsul2mbUPdNFV9d3iWJK1gjZI bGEtJM9aS2NMwfrxIn3HMbp7+DfarpvvhTHOZ2gLvJKBStXjXll/ooehvfZRUSbyDP fgA1WtV8cp7E6FNrBbH8EXlYqiQ0Gmd+WGQ8i+7H4T2y/alBCgqva9FbiArDN+lvDk ILa05z+MktANrjMQithYjhCHdzzj2q+R5Fa1p535HPMNlBkUyGCj/Zy1j0rDhhQAZS gCoeT3fYp79+w== Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 6E9D2444D0F; Fri, 15 Nov 2024 15:45:47 -0500 (EST) Original-Received: from pastel (104-195-225-43.cpe.teksavvy.com [104.195.225.43]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 43C261204A3; Fri, 15 Nov 2024 15:45:47 -0500 (EST) In-Reply-To: (Alan Mackenzie's message of "Fri, 15 Nov 2024 19:46:03 +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:295420 Archived-At: > 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'. It is evident that the OP means CC-mode's C Mode because the bug report is sent to `bug-cc-mode`, indeed. But that doesn't mean these file-local settings intend to impose the use of CC-mode to those users who prefer `c-ts-mode`. >> 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". If something is "crazy" here it would be using a `mode: c-ts` cookie. Adding such entries to `major-mode-remap-*` would just be the sane way to work around that "crazy" part. =F0=9F=99=82 >> If you really insist, we can add >> (add-to-list 'major-mode-remap-defaults '(c-ts-mode . c-mode)) >> (add-to-list 'major-mode-remap-defaults '(c++-ts-mode . c++-mode)) >> to your `cc-mode.el` together with corresponding removals in >> `c-ts-mode.el`, even though in my book file-local settings of >> `mode: c-ts-mode` in non-personal files are just bugs. > The problem is that entries in major-mode-remap-defaults (and the other > one) do not accurately represent user preferences. Entries in `major-mode-remap-defaults` indeed do not reflect a user preference, just a "circumstantial" preference. [ Ideally, they shouldn't be set just by loading a file (whether `cc-mode.el` or `c-ts-mode.el`). But after a long protracted discussion the Emacs maintainers decided that it was the least bad choice in Emacs-29. This may be revisited in the future, e.g. for Emacs-31, but AFAICT it's too late to make such a change in Emacs-30. ] But entries in `major-mode-remap-alist` very much reflect a user preference. > As a value for mode: in C files, we need three distinct settings: for > C Mode, for c-ts-mode, and for any mode which handles C. If someone sends me a file which says `mode: c-ts`, I will complain and so should anyone else. Whether you edit it with `c-mode` or with `c-ts-mode` is not the file's business. >> It is supposed to opt-in, indeed. > So, for a user trying out Emacs 30, with a desktop file containing at > least one file with major mode c-ts-mode; visiting a file with the above > Local Variables section will indeed start the buffer with C Mode? If you see a file that stipulates `c-ts-mode`, complain to the file's author, not to us. > I haven't looked just yet, but can I assume there's a recipe in the > Emacs 30 NEWS file telling users how to switch between old behaviour > (-*- c -*- always means C mode) and new behaviour (-*- c -*- can mean > c-ts-mode depending on other settings)? If anything, Emacs-30 makes it easier than Emacs-29: (add-to-list 'major-mode-remap-alist '(c-mode)) In Emacs-29, you had to go and undo the mess in `auto-mode-alist`. Stefan