From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#68246: 30.0.50; Add non-TS mode as extra parent of TS modes Date: Wed, 10 Jan 2024 03:41:33 +0200 Message-ID: References: <83edeww73j.fsf@gnu.org> <83o7dzvrmf.fsf@gnu.org> <838r53vlo5.fsf@gnu.org> <831qavvcbo.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="12829"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird Cc: 68246@debbugs.gnu.org, Eli Zaretskii , casouri@gmail.com, =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Jan 10 02:42:30 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 1rNNbx-000361-66 for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 10 Jan 2024 02:42:30 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rNNbW-0007uf-GK; Tue, 09 Jan 2024 20:42:02 -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 1rNNbO-0007qu-V0 for bug-gnu-emacs@gnu.org; Tue, 09 Jan 2024 20:41:55 -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 1rNNbO-0005Lb-Jz for bug-gnu-emacs@gnu.org; Tue, 09 Jan 2024 20:41:54 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rNNbV-0002lk-N4 for bug-gnu-emacs@gnu.org; Tue, 09 Jan 2024 20:42:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 10 Jan 2024 01:42: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.170485091310630 (code B ref 68246); Wed, 10 Jan 2024 01:42:01 +0000 Original-Received: (at 68246) by debbugs.gnu.org; 10 Jan 2024 01:41:53 +0000 Original-Received: from localhost ([127.0.0.1]:41422 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rNNbM-0002lM-SE for submit@debbugs.gnu.org; Tue, 09 Jan 2024 20:41:53 -0500 Original-Received: from wout3-smtp.messagingengine.com ([64.147.123.19]:59863) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rNNbK-0002l4-K6 for 68246@debbugs.gnu.org; Tue, 09 Jan 2024 20:41:51 -0500 Original-Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id 4229B3200B1B; Tue, 9 Jan 2024 20:41:37 -0500 (EST) Original-Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Tue, 09 Jan 2024 20:41:37 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1704850896; x=1704937296; bh=htQ99Hi7jMOSyaX2foZsrSyd9F0xaBR2QYZjg5jp88w=; b= bc9Cf8dJQKCvcRvzxPEiiWzB3JMdDRPF+gkaR4GLQG2BpBtKwg9WCEFHsOWeTgM/ HUD7Ye5F7iDUpTzNWyoAcmpBYo8d46kjVPbw0arkMHM9Sw6+HQlMSzS4RZZ4kewA v8aT4UxulaSts2+SbshrqDIcfBmgw8B+0QEE2XpHaYlMtN/XYo7KXA2sYlwUcpbR UplzYdiU71AD97gPJMSwRt2L17cEacHjHaYeArCX6i91HfuEKe9T7MgYoZfa7Kf3 tEx3BEHFFzi3aS4QcM0Liw1aQjTCgZDGWYd/4sirmR1HQPJjz5pMSor0HU+wOmww iyMswnVm4mvckSJ95SnDFg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1704850896; x= 1704937296; bh=htQ99Hi7jMOSyaX2foZsrSyd9F0xaBR2QYZjg5jp88w=; b=B 6W4ii1Ww5S93cIwElmkOXNdr5V6llRQQYQbR6nX4UyKO+XGWfIn51M25A14p0GdL ZN89RqHjAY2nPW0/mPIlfl/S182sjUupmK4jBu3YiFvxS77afSG8vlZcRa00+d8k Xu/AbFDBkPfUhSoux+3jjYuj3oq/N4otH8WkQa5O3SuaoaAW072bjNXL865RYUOK vsFpzBUUefHo34aAE9mPMpoIG5MTg/49L2IbJUZP0d400BWfJTTrm27xr6yxRoGX No3Wj7f2r9N5JxyRgdYZI4UKEhJZ78b9CKJ7dwC6JNGNxhSwosXf/OlocM/8ypdz h6mrBAHxZIiQpAhGFUj1g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrvdeitddgfeekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtjeertddtvdejnecuhfhrohhmpeffmhhi thhrhicuifhuthhovhcuoegumhhithhrhiesghhuthhovhdruggvvheqnecuggftrfgrth htvghrnhepteduleejgeehtefgheegjeekueehvdevieekueeftddvtdevfefhvdevgedu jeehnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepug hmihhtrhihsehguhhtohhvrdguvghv X-ME-Proxy: Feedback-ID: i0e71465a:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 9 Jan 2024 20:41:34 -0500 (EST) Content-Language: en-US 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:277671 Archived-At: On 09/01/2024 05:55, Stefan Monnier wrote: >> But for this to be useful to determine the language >> of a major mode via reverse lookup, > Define "the language". > > The mapping from "language" to major mode can't be always reversible, so > `major-mode-remap-alist` works to map "language" to "major-mode" but not > the other way. But that's the point: to be able to find 'javascript' from both 'js-mode' and 'js2-mode'. Or 'ruby' from 'ruby-mode' and 'ruby-ts-mode'. major-mode-remap-alist could have several entries for the same language: 'assoc' will pick the highest priority (first) one, but 'rassoc' would be able to take advantage of every entry. > The current bug-report*is* about "finding the language" but the code > that needs that info luckily doesn't need "the language" it just needs > to know "does the current buffer contain language FOO", which is an > easier problem, which I propose to solve with `derived-mode-p`, since > that's what we've been using all these years. TBF, I don't quite like the "subtleness" of this solution. The inheritance hierarchy of the modes is an implicit thing, and the fact that js-mode-hook would run in js-ts-mode in Emacs 30 but not in Emacs 29 would likely trip over a lot of people. Especially those who read recipes on the Internet. Also, "what language is this" does happen to be a meaningful question. Eglot's example aside, we can have other tools, databases, etc. And what about the idea of TS modes becoming the "main" modes sometime, far in the future, if tree-sitter stays around long enough? At least for some languages, I mean. If the name of the "original" major mode stays synonymous with the file type, how do we migrate away from them? Create obsolete alias? Rename js-ts-mode to js-mode someday? Finally, if we did have "languages" as an entity, we could have some UI for the user to choose the mode for a language - something like Debian's 'update-alternatives'. And it would also serve to list the supported languages, I guess.