From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: JD Smith Newsgroups: gmane.emacs.devel Subject: Re: On treesit preference for "consumer" modes Date: Sat, 26 Aug 2023 15:18:02 -0400 Message-ID: <69F50732-2940-4993-8D77-6FEF4A1092EE@gmail.com> References: Mime-Version: 1.0 (1.0) Content-Type: multipart/alternative; boundary=Apple-Mail-F6792806-ECBE-4849-AA66-9D0D30B0C008 Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27168"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Eshel Yaron Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Aug 26 21:19:08 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 1qZyoN-0006nt-TW for ged-emacs-devel@m.gmane-mx.org; Sat, 26 Aug 2023 21:19:08 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qZyng-0004KT-V6; Sat, 26 Aug 2023 15:18:24 -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 1qZynf-0004K6-FV for emacs-devel@gnu.org; Sat, 26 Aug 2023 15:18:23 -0400 Original-Received: from mail-io1-xd2a.google.com ([2607:f8b0:4864:20::d2a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qZynd-0002os-5E for emacs-devel@gnu.org; Sat, 26 Aug 2023 15:18:23 -0400 Original-Received: by mail-io1-xd2a.google.com with SMTP id ca18e2360f4ac-7927f84525dso51889739f.0 for ; Sat, 26 Aug 2023 12:18:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1693077500; x=1693682300; h=to:references:message-id:date:cc:in-reply-to:from:subject :mime-version:content-transfer-encoding:from:to:cc:subject:date :message-id:reply-to; bh=7JvatJPCJ1iRYauZxQRJwXJMVfY0f7e9LdtcN2M/1pw=; b=H1O4MjiepazsXNfjfdbi8/znlWiW5uZYjLsUfm/e9nGnET1CrcEvW7b3bitMEm7ntM zsffLufFT8Z5ADu5wD8rPU+jEO1d28Zh/FZGk8ctmwgYe3OJF+cEAOqG1bws5hY441JB ImwlmVmP1lqlaO0qzB2PtyN/CL2vCJPPLyEKHAuVTHfSA68U6oRXsaa5hry8uUnlfc9f NVtM/KAsF869/TmfX85Ft//yigK1rcPPQc50bt1z1q4Zk+9v5rQNq5AATJWP5cPFi+MA AV7GQ/Yfpg+ww/BriaB+DAJgoqrtUTihEWPKnrtIOG89Ro3vAtLCGU8ffRRPGp06D94T LQCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693077500; x=1693682300; h=to:references:message-id:date:cc:in-reply-to:from:subject :mime-version:content-transfer-encoding:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=7JvatJPCJ1iRYauZxQRJwXJMVfY0f7e9LdtcN2M/1pw=; b=X2bkfhsY3GnCtzHLmtp/H1V6E0YIFUUhbuyg0DW+d0c7PQPJk+TbP+WwXa4N01SJRd JN6J89sy7pRUtvxVjg3CLeGLT3dRMYZpfdjO9vbC5jeZg1wJLB98/Nv2GvdPyfwrZ0mm nlIphEz1HxYFXZZF0ZUTPzoxkmVwHeocRCCSz3XLqlbaS37YTDx6JWLrs3a5p1JoB9ad EzYqV44/F2mEMXt9XYKq9Qaufjsd6gROQGprJ7xItA/sx5XpoTLWC6mmCVX/tVXFrZm7 y/mY1yRPEBSA5wg0ldae9REcIt9s1pE95tZSPQeTwzHPB1Rv6U+i+LNQreTDb/JLaQ/J ZE+w== X-Gm-Message-State: AOJu0YxLLn9dKUTRz3DnoG4CcoN6cmpd7Pc9QdBQDXsT5Iha5MSikKaB 5IS77fNtj735bkl1lYFpkrSEGVJcEm0= X-Google-Smtp-Source: AGHT+IG0q5JIxpXahuZsbeeqY+l2uuXrhrVF2uwYuh7/28a4Qq9KyCRCh0jux7oz9VRI2YBBFV+RJw== X-Received: by 2002:a6b:f214:0:b0:790:f733:2f9e with SMTP id q20-20020a6bf214000000b00790f7332f9emr13617720ioh.13.1693077499756; Sat, 26 Aug 2023 12:18:19 -0700 (PDT) Original-Received: from smtpclient.apple ([2600:1009:b1c0:4e3c:6901:6bbc:12e2:1565]) by smtp.gmail.com with ESMTPSA id z10-20020a6b5c0a000000b0077a1d1029fcsm1362933ioh.28.2023.08.26.12.18.17 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 26 Aug 2023 12:18:19 -0700 (PDT) In-Reply-To: X-Mailer: iPhone Mail (20G75) Received-SPF: pass client-ip=2607:f8b0:4864:20::d2a; envelope-from=jdtsmith@gmail.com; helo=mail-io1-xd2a.google.com X-Spam_score_int: -11 X-Spam_score: -1.2 X-Spam_bar: - X-Spam_report: (-1.2 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, MIME_HTML_ONLY=0.1, MIME_HTML_ONLY_MULTI=0.001, MIME_QP_LONG_LINE=0.001, MPART_ALT_DIFF=0.79, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action 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:309277 Archived-At: --Apple-Mail-F6792806-ECBE-4849-AA66-9D0D30B0C008 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable

On Aug 26, 2023, at 1:= 59 PM, Eshel Yaron <me@eshelyaron.com> wrote:


I think the last sent= ence is a slight over simplification: even before
`foo-ts-mo= de`s, Emacs didn't have a clean abstraction for a (programming
language) AFAICT, only major modes.  And "competing" major modes for= the
same language are not a new problem.  So these "co= nsumer modes" would
have to be more clever and, hopefully, a= lready have the right methods in
place to deal with the exis= tence of multiple major modes per language.
(Admittedly, `fo= o-ts-mode`s make this challenge much more pronounced.)

Looking at the specific examples you mentioned: Org mode handles= this
well with `org-src-lang-modes`, which is quite more so= phisticated than
just reaching out for `LANG-mode`.  (B= TW in `sweeprolog.el` there's a
similar mechanism for highli= ghting quasi-

Thanks for these= thoughts.  I did and do acknowledge multiple prevailing modes for some= languages, but IME that has been the exception and now is effectively the r= ule!  The hope is to come up with useful defaults that don=E2=80=99t ne= ed tweaking for most users.  Your example of `org-src-lang-modes` actua= lly provides a very good illustration of this issue:
<= br>
org-src-lang-modes =C2=B6

If an Emacs maj= or-mode named <LANG>-mode exists, where = <LANG> is the language identifier from code block=E2=80=99s= header line, then the edit buffer uses that major mode. 

That default may surprise users who have carefully set thi= ngs up for, say, python-ts-mode in their .py file buffers (python-ts not bei= ng a language).
= --Apple-Mail-F6792806-ECBE-4849-AA66-9D0D30B0C008--