From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: On treesit preference for "consumer" modes Date: Sat, 26 Aug 2023 20:04:10 +0300 Message-ID: <83il91loqd.fsf@gnu.org> References: <7649A9B7-3697-4CA4-BCBE-BAC7DA814B12@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="28843"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: JD Smith Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Aug 26 19:04:25 2023 Return-path: Envelope-to: ged-emacs-devel@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 1qZwi1-0007LT-0Y for ged-emacs-devel@m.gmane-mx.org; Sat, 26 Aug 2023 19:04:25 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qZwhK-0000nE-6T; Sat, 26 Aug 2023 13:03:42 -0400 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 1qZwhJ-0000n1-3l for emacs-devel@gnu.org; Sat, 26 Aug 2023 13:03:41 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qZwhI-0002Ht-5E; Sat, 26 Aug 2023 13:03:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=LbasEAJ0X41On7tAzWiM7/SUum/fxyPqjRKLxNYd38I=; b=JeIV2g36oG2iG+lkR5xg OnvIZ+pdexoxI1jZDKRV7btXIghc915fBjAmS/eJdk1I7HQ2zxAkmUBO3hHa5+bOXIVVsGT3O/DKZ PWXdNfe8vIuHGNcMH0LfAQLPovTfJf1VuqVE7AzkBgJpo6upfRO9CvahzszoxrO5ZHZ08SVzJTuzd B+pmJkTuvpSd/clNr6oddnG3MojiMVGTV6UeC4Ywa+MR7NZgnQzoM0NThwXxe81gKQVKJNFbUO6oE sSswPMM7rvxxIMBvLw7j8RECJ2Ftskan75LWfIiz1XGY6AoXflpeff6qCvsJ0RTAZngKLNWxCk3o2 xTsTF73m6iLjkg==; In-Reply-To: <7649A9B7-3697-4CA4-BCBE-BAC7DA814B12@gmail.com> (message from JD Smith on Sat, 26 Aug 2023 12:47:18 -0400) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:309264 Archived-At: > From: JD Smith > Date: Sat, 26 Aug 2023 12:47:18 -0400 > > The current LANG-mode and LANG-ts-mode separation leaves some ambiguities. One in particular: some modes are “consumers” of other majors modes. That is, they have a different focus, but use LANG modes as subordinate helpers for some aspect of their feature set. Examples: org-mode SRC block highlighting, or a shell mode which wants to highlight and indent code written at the shell prompt. In the pre-treesit era, such a “consumer mode” simply reached for, e.g., LANG-mode for this, directly making use of all the customizations users have applied. > > In the new era of LANG-mode and LANG-ts-mode duality, how should the consumer mode decide which one to use? A user option, I think. There's no other reliable way ATM. > I guess I’m looking for something like `(treesit-preferred LANG)’ or `(default-major-mode LANG)’. There's no such thing, and probably won't be, at least not soon enough for you to rely on it. We are still learning how to deal with this new situation. As for your suggestions: treesit-preferred is problematic, because no one says the user will always prefer ts modes for all of the languages, nor do we want to force them. As for default-major-mode, I don't understand how could we implement that, except by deferring to user options again.