all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: JD Smith <jdtsmith@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: On treesit preference for "consumer" modes
Date: Sat, 26 Aug 2023 13:17:54 -0400	[thread overview]
Message-ID: <54636E96-059D-4087-846D-61E9CF697952@gmail.com> (raw)
In-Reply-To: <83il91loqd.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 1582 bytes --]



> On Aug 26, 2023, at 1:04 PM, Eli Zaretskii <eliz@gnu.org> wrote:
>> 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.

Got it, thanks.  There has always been some ambiguity when there are several modes competing, but usually there is a “dominant strain” 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 “one stop shopping” for the user.  I.e. they would not need to configure this and `major-mode-remap-alist’.

One (likely too) simple idea: a function to ask emacs “What mode would you enable if I opened /path/to/file.EXT”, 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’s a cousin of my (too) simple idea above, except for dir-locals etc. 

[-- Attachment #2: Type: text/html, Size: 2556 bytes --]

  parent reply	other threads:[~2023-08-26 17:17 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-26 16:47 On treesit preference for "consumer" modes JD Smith
2023-08-26 17:04 ` Eli Zaretskii
2023-08-26 17:14   ` Eli Zaretskii
2023-08-26 17:17   ` JD Smith [this message]
2023-08-26 17:31     ` Eli Zaretskii
2023-08-26 17:58 ` Eshel Yaron
2023-08-26 19:18   ` JD Smith

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54636E96-059D-4087-846D-61E9CF697952@gmail.com \
    --to=jdtsmith@gmail.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.