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 13:17:54 -0400 Message-ID: <54636E96-059D-4087-846D-61E9CF697952@gmail.com> References: <7649A9B7-3697-4CA4-BCBE-BAC7DA814B12@gmail.com> <83il91loqd.fsf@gnu.org> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.700.6\)) Content-Type: multipart/alternative; boundary="Apple-Mail=_E547E704-B8D9-4FAE-AF28-68ED5F0B6680" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15734"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Aug 26 19:18:37 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 1qZwvl-0003tr-HB for ged-emacs-devel@m.gmane-mx.org; Sat, 26 Aug 2023 19:18:37 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qZwvM-0004Gu-JB; Sat, 26 Aug 2023 13:18:12 -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 1qZwvK-0004GY-Rp for emacs-devel@gnu.org; Sat, 26 Aug 2023 13:18:10 -0400 Original-Received: from mail-yw1-x112d.google.com ([2607:f8b0:4864:20::112d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qZwvI-0004mQ-Cl; Sat, 26 Aug 2023 13:18:10 -0400 Original-Received: by mail-yw1-x112d.google.com with SMTP id 00721157ae682-5925e580e87so21659717b3.1; Sat, 26 Aug 2023 10:18:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1693070286; x=1693675086; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:from:to:cc:subject:date:message-id:reply-to; bh=z9ukSELdwOHLjNDknGTgBDiNU1tMIJs0vWvLxvj0VM4=; b=Y+K7kMhrM0tcHWhy5QnnNUaxNu0KNcQd5eF2odY8F8GbxGh7+v+u16kl5BfiooI1WE IWnglnEaI7mqwTld9JUQo/kY+XNaoEgT5n6MGkAzJUMkmPJf2XcWsw47vRgJOX0gl2B+ enBfeaXxS6YYoJImAN5lXHHeffmkq0bHCyaMQbPM3BAITor7GMbBF1HIeky6n5oLvLaG EBPY2NZI9V9tEC4ojURCZEJ+03tjbqYmE95sxGe6/v3SyetEYmX4Ao7o5UePFKaz2920 9PWY4joDbqaaT7l2WFxCibcO08Gac/aUYE7d3ALe+7jeRjqiSMZejCIE2XnT5pTawJWp NEDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693070286; x=1693675086; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=z9ukSELdwOHLjNDknGTgBDiNU1tMIJs0vWvLxvj0VM4=; b=IJ/zkfGHl22OegsMfusONjH8Ps8Mv04HNeHbrwEwSTQKaguTSD4yaeZxz9XUDil30m gkKwMWzBd7oyuC92gbqITBWB3bd3PMaVJmp3uklWiLMPAE1ESfSnGHeINERPUVcuWTAk kaS2zFCJQcHmV+Kynfmc18055auCGf3imfH5In4cn+00KqumXQijkmch7UEZUUv+8Jf1 APBB1DMHWjf32G7RRGblFDrbL2Xl9o0BeQI8o5X8eeVaj+rwKa9PzEYa4GnGZsW9xu0I nV62soWy+X33zOEjNGN14vIh9xgsULNK61geTQ1FIssRNnLiJ+mAwDqqhOB4jkDe+1WT Ml4A== X-Gm-Message-State: AOJu0YxrQslzxEGjAOcrbiX2btCA9SFgqWbiRm0rN5CXNjW8S0Fq5TIv tsGULepEjDMfbUFGjzM5T2mpvX5/ppE+HQ== X-Google-Smtp-Source: AGHT+IFYOaBsYy97wm+eql9nBOXjusByBP4flmTDyXddi3fERkgDE2M85F/+7Wm9UBM1YZ0oITndPg== X-Received: by 2002:a0d:d8d0:0:b0:56d:4d34:20c with SMTP id a199-20020a0dd8d0000000b0056d4d34020cmr22741995ywe.37.1693070286220; Sat, 26 Aug 2023 10:18:06 -0700 (PDT) Original-Received: from smtpclient.apple ([131.183.131.33]) by smtp.gmail.com with ESMTPSA id i142-20020a0ddf94000000b0058451c12076sm1163275ywe.14.2023.08.26.10.18.05 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 26 Aug 2023 10:18:05 -0700 (PDT) In-Reply-To: <83il91loqd.fsf@gnu.org> X-Mailer: Apple Mail (2.3731.700.6) Received-SPF: pass client-ip=2607:f8b0:4864:20::112d; envelope-from=jdtsmith@gmail.com; helo=mail-yw1-x112d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham 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:309266 Archived-At: --Apple-Mail=_E547E704-B8D9-4FAE-AF28-68ED5F0B6680 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Aug 26, 2023, at 1:04 PM, Eli Zaretskii wrote: >> I guess I=E2=80=99m looking for something like `(treesit-preferred = LANG)=E2=80=99 or `(default-major-mode LANG)=E2=80=99. >=20 > 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. Got it, thanks. There has always been some ambiguity when there are = several modes competing, but usually there is a =E2=80=9Cdominant = strain=E2=80=9D consumer modes can adopt as the default. > 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. This would be a top-level user option, but it would be =E2=80=9Cone stop = shopping=E2=80=9D for the user. I.e. they would not need to configure = this and `major-mode-remap-alist=E2=80=99. One (likely too) simple idea: a function to ask emacs =E2=80=9CWhat mode = would you enable if I opened /path/to/file.EXT=E2=80=9D, without = actually having to open it. Consumer modes could check that for = relevant paths and extensions, and opt to use that mode (if everything = else checks out). > . if a ts mode is already loaded (featurep test) The consumer-mode may be the first to use it. > . if auto-mode-alist defines a ts mode for the relevant files I mentioned that in my #5. I suppose that=E2=80=99s a cousin of my (too) = simple idea above, except for dir-locals etc.=20= --Apple-Mail=_E547E704-B8D9-4FAE-AF28-68ED5F0B6680 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8

On Aug = 26, 2023, at 1:04 PM, Eli Zaretskii <eliz@gnu.org> = wrote:
I guess I=E2=80=99m looking for something like = `(treesit-preferred LANG)=E2=80=99 or `(default-major-mode = LANG)=E2=80=99.

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.

Got it, = thanks.  There has always been some ambiguity when there are = several modes competing, but usually there is a =E2=80=9Cdominant = strain=E2=80=9D consumer modes can adopt as the = default.

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.

This would = be a top-level user option, but it would be =E2=80=9Cone stop = shopping=E2=80=9D for the user.  I.e. they would not need to = configure this and `major-mode-remap-alist=E2=80=99.

One = (likely too) simple idea: a function to ask emacs =E2=80=9CWhat mode = would you enable if I opened /path/to/file.EXT=E2=80=9D, without = actually having to open it.  Consumer modes could check that for = relevant paths and extensions, and opt to use that mode (if everything = else checks out).

 . if a = ts mode is already loaded (featurep test)

The = consumer-mode may be the first to use it.

 . if auto-mode-alist defines a ts mode for the relevant = files

I mentioned that in my #5. I suppose = that=E2=80=99s a cousin of my (too) simple idea above, except for = dir-locals etc. 
= --Apple-Mail=_E547E704-B8D9-4FAE-AF28-68ED5F0B6680--