From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuan Fu Newsgroups: gmane.emacs.bugs Subject: bug#68246: 30.0.50; Add non-TS mode as extra parent of TS modes Date: Sat, 13 Jan 2024 20:00:13 -0800 Message-ID: References: <83o7dzvrmf.fsf@gnu.org> <838r53vlo5.fsf@gnu.org> <831qavvcbo.fsf@gnu.org> <83a5phskd5.fsf@gnu.org> <83h6joqz0t.fsf@gnu.org> <834jfoq86m.fsf@gnu.org> <831qarrbjx.fsf@gnu.org> <87a5p84nlh.fsf@gmail.com> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.700.6\)) 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="35756"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 68246@debbugs.gnu.org, Eli Zaretskii , Stefan Monnier To: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jan 14 05:01: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 1rOrgb-00094y-RU for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 14 Jan 2024 05:01:25 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rOrgH-0001qA-FY; Sat, 13 Jan 2024 23:01: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 1rOrgE-0001pk-W4 for bug-gnu-emacs@gnu.org; Sat, 13 Jan 2024 23:01: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 1rOrgE-00024b-Ll for bug-gnu-emacs@gnu.org; Sat, 13 Jan 2024 23:01:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rOrgD-0000hq-Jr for bug-gnu-emacs@gnu.org; Sat, 13 Jan 2024 23:01:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Yuan Fu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 14 Jan 2024 04:01:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68246 X-GNU-PR-Package: emacs Original-Received: via spool by 68246-submit@debbugs.gnu.org id=B68246.170520483232474 (code B ref 68246); Sun, 14 Jan 2024 04:01:01 +0000 Original-Received: (at 68246) by debbugs.gnu.org; 14 Jan 2024 04:00:32 +0000 Original-Received: from localhost ([127.0.0.1]:41495 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rOrfj-0008Qq-St for submit@debbugs.gnu.org; Sat, 13 Jan 2024 23:00:32 -0500 Original-Received: from mail-ot1-x32e.google.com ([2607:f8b0:4864:20::32e]:57549) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rOrfh-0008Fd-MU for 68246@debbugs.gnu.org; Sat, 13 Jan 2024 23:00:30 -0500 Original-Received: by mail-ot1-x32e.google.com with SMTP id 46e09a7af769-6ddf05b1922so2782857a34.2 for <68246@debbugs.gnu.org>; Sat, 13 Jan 2024 20:00:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705204825; x=1705809625; darn=debbugs.gnu.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=vZSR36649lHvzAJhgw3KU/yAVY2pV7Orr/9VpGYrJvU=; b=cP27sD5eWqSSjFXJazsxQkuWS6gNWkvUlWLgNMJkqNJOalvxd7FfzEEV0LZMaPmfPF rTMKM/xLthPabH7r3/4qEiUv4FbLuA0F2iRtkgncdaH4lv4dVfApUNJ+IryZFRBDTNHA Z49G1UjHJj/zMvxk+KFbRIq4q87+vJr3zr+4tQ0j05I8QPZmwHS3V0/OvVYo6MftChfn ze/+40w/bMe/kJlk3l7tPBw1JL5lsKH7dZ9boVs58a1WEJDnZX71991MdnyqwVTb3/kk NX6LZpRKchCYtk+5JOquB5pRR0PD7ppbKM7ocxOLACtutcd3MtBpl9eHy7cPpwkhutaG X2xw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705204825; x=1705809625; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vZSR36649lHvzAJhgw3KU/yAVY2pV7Orr/9VpGYrJvU=; b=bQjhBTaLlO+PaxiFUyAqw03p+IU/Jj+uSecHHfD3KrI63OtSSkO32//rFlcfAdcP8E 2IAO8exqnBTLS7CnEjMqeb/E2HFdwvMBvz/9J+pdL7DUZU+ESfvpkWuM3CcHidFxIzj1 +8bv+neXSj8orOzpooZ3uPCas9fj6n86S1infTRw/qQU0FxcT9XcDVhm6ldqjjFL1Xi6 DfEVtH6BjKmSiAG5iskpcz3oSpFFaK3teONJP+EibjpIVNscC2zRRYKrYWOJ4wWkVXx9 sqbJ2B86GyeWB3sqB2y3Hm3Gkc8EgTiscljfs0TVVw3kSnXZdIicnrm5aqhrrPf4aiw7 UNDQ== X-Gm-Message-State: AOJu0Yx1LJCP+f8nMh4FqNSrRIqGcw40VDXgo9ZSQ0BTfXFvvmX3ye9M 3hguaUTSlsjxsOc3xust4Z8= X-Google-Smtp-Source: AGHT+IFbODyDl4xuZLifsssTtZT/Y42CwYOW1BuuOJyiaeAVuuJfdHWUZMBaofPPkHAHCLZQNZe3GA== X-Received: by 2002:a05:6808:1783:b0:3bd:3fd6:ce67 with SMTP id bg3-20020a056808178300b003bd3fd6ce67mr4490575oib.32.1705204824935; Sat, 13 Jan 2024 20:00:24 -0800 (PST) Original-Received: from smtpclient.apple (172-117-161-177.res.spectrum.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id ko20-20020a056a00461400b006da13bc46c0sm5582834pfb.171.2024.01.13.20.00.24 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 13 Jan 2024 20:00:24 -0800 (PST) In-Reply-To: <87a5p84nlh.fsf@gmail.com> X-Mailer: Apple Mail (2.3731.700.6) 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:278174 Archived-At: > On Jan 13, 2024, at 7:10 PM, Jo=C3=A3o T=C3=A1vora = wrote: >=20 > Yuan Fu writes: >=20 >> observe what breaks? Then Joao can either say =E2=80=9CI told you=E2=80= =9D or happily >> found out that this patch works ok. >=20 > Those are not the only two outcomes. It might work OK and not break > anything [*]. >=20 > However it is not easy to quantify confused users looking to = understand > the new meaning of things in dir-locals.el. Or users wondering why = they > need to set Eglot variables in both 'c++-mode-hook' and > 'c++-ts-mode-hook' when all they see is 'c++-mode' in > 'eglot-server-programs'. I agree. =E2=80=9CNot confusing=E2=80=9D is very valuable for Emacs, or = any system. > So it might not break, and even have some reasonalby solid theoretical > backend beautifully enshrined in documentation. But is it the right > thing? I think not. Unless I'm mistaken it's already proven to be > confusing even to two seasoned Emacs hackers in this thread (and I'm = not > including myself). >=20 > And it doesn't do much for two main problems that were presented at = the > base: Eglot and Yasnippet. I.e. Eglot still inescapably needs to = report > the language to the server and Yasnippet would be better and much > simpler if it could organize snippets by languages instead of major > modes. >=20 > There are better alternatives to this patch: >=20 > 1. The base modes, which are substantially _already_ in place. They > follow the naming convention -base-mode. After giving more > thought to your earlier objection about derived modes overriding > variables, it doesn't make sense (I can elaborate if you want :-) ). Yeah, I made a mistake there, as Stefan corrected. Still, the other part = of the argument holds: creating a base mode needs cooperation from every = involved major modes=E2=80=99 authors. We can=E2=80=99t unilaterally = create base modes and make third-party major modes to base on it. I=E2=80=99= m not saying it wouldn=E2=80=99t work, it would, but we can=E2=80=99t = apply it everywhere. >=20 > 2. Explicitly associating some major modes with languages or file = types. > This doesn't seem hard and other further uses like suggesting modes > or packages to a new user based on languages have been proposed. >=20 > Nevertheless, I suspect that you want a solution to some real problem > happening today Can you say in your own words what that problem is? = As > I explained, I don't have a good idea of the cases besides Eglot, > Yasnippet and possibly/likely Lsp-mode. I think I want the same thing as you do: right now many packages have a = central database that maps major mode to some mode-specific = configuration. IIUC, for Eglot, that=E2=80=99s the server=E2=80=99s = arguments; for Yasnippet, that=E2=80=99s the snippets. I can think of = other examples like hs-special-modes-alist in hideshow.el. I=E2=80=99m = sure there are countless third-party packages that uses a central = database rather than a buffer-local variable for their mode-based = configuration. For those databases, I want lang-ts-mode to use the same configuration = for lang-mode. More importantly, I hope the countless databases in all these = third-party packages to continue to work. Adding language tags for major = modes is nice and all, but a) third-party packages has to change their = database to make use of it, and b) third-party major modes need to add = language tags.=20 That=E2=80=99s why I like major mode names a bit better. Both major mode = names and language tags are leaky abstraction to some degree, so might = as well use the one that already exists. > [*]: It's possible though. One way would be for a user to have added > entries to 'eglot-server-programs' for non-TS 'foo-mode' specifically > with 'add-to-list', a very common practice. Her later 'foo-ts-mode' > entries would be shadowed. Unlikely, perhaps? But what about = variables > set in '.dir-locals.el' for 'foo-mode' and 'foo-ts-mode'? Suprising > "magic" aside, it seems these settings will be merged (right?) in > 'foo-ts-mode' buffers. But does this make sense every time? Even in > our own dir-locals.el there are some settings for 'c-mode' (unrelated = to > cc-mode.el) that are not in the 'c-ts-mode' section, but after = Stefan's > patch it will be as if they were. I think it's unavoidable we'll = catch > some users off-guard and break things. Right=E2=80=A6 Sometimes we want lang-mode and lang-ts-mode to share = some config, and sometimes we don=E2=80=99t. I don=E2=80=99t have good = ideas right now :-) Yuan