From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Kangas Newsgroups: gmane.emacs.bugs Subject: bug#74339: 30.0.92; CC Mode stomps C TS Mode Date: Fri, 15 Nov 2024 19:22:47 -0800 Message-ID: References: <86zfm1in2p.fsf@gnu.org> <86wmh5hrya.fsf@gnu.org> <86cyiwimlr.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31153"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , Stefan Monnier , 74339@debbugs.gnu.org To: Alan Mackenzie Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Nov 16 04:24:27 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 1tC9QA-0007wB-VN for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 16 Nov 2024 04:24:27 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tC9Pr-0003Em-5n; Fri, 15 Nov 2024 22:24:07 -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 1tC9Pn-0003EJ-BW for bug-gnu-emacs@gnu.org; Fri, 15 Nov 2024 22:24: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 1tC9Pn-0000kj-2l for bug-gnu-emacs@gnu.org; Fri, 15 Nov 2024 22:24:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=Date:MIME-Version:References:In-Reply-To:From:To:Subject; bh=T1uT4eHgckL65faOCCYf0WP6VwIsyPAAuUWJcDuXkJg=; b=o0DVC8GTht3hZvCfjDQ5h75edP4luDZweW9tXP3JYmfSOI+zkA8oBFoS04J+zz4NzjQaOFJwnd1pBi0pj7iFiFnbrXugkAZZ9nvSP9J/unjuSszrFQLOI0WgpEKAD4j2wHrwRDQ+GK2obKA84nr8PCYSUmL/aXp8KT5lZXk1xYawRqQzmCevIMT3EL6B1Ebkij/PsBKywL4rop9YwTE7uQbp/KY6kxoJftG7kP/1TCeDz9SOefXt94Mvg5DhQZMDJsYTcB6VZbI342V9i0HYh5emNd25lFJePUV95hAfKkVYqQUVCH9RE+86FBzTqZALwe7zI0U9FFYhu801Z0QHOw==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tC9Pl-00007m-Ui for bug-gnu-emacs@gnu.org; Fri, 15 Nov 2024 22:24:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Kangas Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 16 Nov 2024 03:24: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.1731727437468 (code B ref 74339); Sat, 16 Nov 2024 03:24:01 +0000 Original-Received: (at 74339) by debbugs.gnu.org; 16 Nov 2024 03:23:57 +0000 Original-Received: from localhost ([127.0.0.1]:51618 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tC9Ph-00007U-1k for submit@debbugs.gnu.org; Fri, 15 Nov 2024 22:23:57 -0500 Original-Received: from mail-ej1-f51.google.com ([209.85.218.51]:56488) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tC9Pe-00007D-1X for 74339@debbugs.gnu.org; Fri, 15 Nov 2024 22:23:55 -0500 Original-Received: by mail-ej1-f51.google.com with SMTP id a640c23a62f3a-a9a6acac4c3so415032166b.0 for <74339@debbugs.gnu.org>; Fri, 15 Nov 2024 19:23:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1731727368; x=1732332168; darn=debbugs.gnu.org; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:from:to:cc:subject:date:message-id:reply-to; bh=T1uT4eHgckL65faOCCYf0WP6VwIsyPAAuUWJcDuXkJg=; b=AogJ1j7DFMZJFCJcAyCYKx2SBGVJGoc1y+V5PWRoB7rUKQqdsT1SVuB0vYvSAPGaUG oh00QjZRAlitwXVbxjncGxXhUM5T9VibZkRsSJz9UtPrOh7mMi0GIHdODzpT89tc4K1j ENwMRLTegsOqhgqUFfkqt1nXLx6KAXih9EZEU9TcYSdiP4GhH15WzSAG1ImlpjRlADlN Bmfc128VFu3WI5QSJa5bCXrx9t7G4gwnfwTnkVUHcw4YI3n9iRqnSEIv1cfrTepBoRMT 6bJYs7R97nL4hfFS+eUYzuKv6ucJ+eebCoBnWy6zkR2ElvEyeI97I16mXPafKS1NBGj/ kiJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731727368; x=1732332168; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=T1uT4eHgckL65faOCCYf0WP6VwIsyPAAuUWJcDuXkJg=; b=R03J4rPmMr2EcQ07CLu0Z3374kuFINm6UMkEoxYL16NxToGal23Mvm4nVa7ofNRmqT rd6AMwFvZuOrQPBe8wB5DBKqKukEosdTnTyW7gxZ8Yvn47uiwgQUw05xjIcVhbRCx4+B 8Dr/L/VRP8fRas6SnbrP9sFAB2TEpP25QpoU9Mb1kmvxJTynEZW43WCH1XJOh64jE7U2 5NEh0DC5UVFE5rbAbSGtfNfV+VuHk+KnwoxR4KjQcaoKEnFNYhNc7zj5YYQleziFSMjR K6WECwCVHQPnmqvdT2fJWJihtUSUBgdtms5cXTGg6Q5tJZfBQL+RtKnpQGc7m6elj2vM N7vw== X-Forwarded-Encrypted: i=1; AJvYcCWdm3FCD+/7VDOsVauwLKvrx6Zrl61FyfLcE7Qjk7mWbknBdEqx3FtozIQLQ9pVGkMDi3uXBw==@debbugs.gnu.org X-Gm-Message-State: AOJu0Yw45Z5t/I4a8Uve2/+09oYhxcCH9LXno7XZwEGKeFgi/pxW1fuP eO+2sTsAugUuLtxa7xT1UxEGwGbU5w0uuW4VP5iWwkkuUdB7n/mYpsx3pVdrOcv3/At301l7hJH K2T5e8A+lvNgqYdjaT/OSkX4/vvc= X-Google-Smtp-Source: AGHT+IHLbYiey6c/6Onc/ITrDy9BENlEgeqtpxbyiqAEyvgEQprviIf2/Wez95o1deNB//zRMJC7ffJ+X5lB9qOCqwQ= X-Received: by 2002:a05:6402:350f:b0:5cf:3d22:6dd9 with SMTP id 4fb4d7f45d1cf-5cf8f949b0dmr3037826a12.0.1731727368038; Fri, 15 Nov 2024 19:22:48 -0800 (PST) Original-Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Fri, 15 Nov 2024 19:22:47 -0800 In-Reply-To: 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:295428 Archived-At: Alan Mackenzie writes: > 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). It seems like you're right about that, in emacs -Q. FWIW, I consider that less than ideal, and would prefer that we did that only when enabling the mode. Loading files shouldn't change behaviour, exactly for this reason. So I'd be in favor of making such a change (on master). But that's me. > I don't think the current mechanism is ready for the release of Emacs 30. > It hasn't been thought through thoroughly. I see no release blocker at this late stage, myself. >> 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. I think `major-mode-remap-alist` is the explicit setting that we have. That said, I wouldn't personally close the door to a proposal that is significantly better. I'm just not sure what it would look like. > 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". The benefit of `major-mode-remap` is that it's sufficiently general not just for c-mode/c-ts-mode, but for all other cases where we have two or more modes, such as yaml-mode/yaml-ts-mode, etc. And it will handle whatever new modes we can dream up in the future. It also fits in nicely with the equally general `auto-mode-alist`, `interpreter-mode-alist`, etc., that we already have. For these reasons, I think I prefer `major-mode-remap` to a specific option just for c-mode/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. So you don't like the specific detail that it overloads the use of the symbol `c-mode` as a proxy for saying C files? FWIW, and AFAIR, I think we discussed this overloading of the mode name on the list, and the other option was to introduce a new concept of "languages" into Emacs Lisp, where we would have had alist entries like `(c . c-mode)` instead. The conclusion was that doing that would be more complex and it was hard to justify this complication. I can't remember that any other ways to avoid this overloading were suggested.