emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Make all tree-sitter modes optional


From: Eli Zaretskii
Subject: Re: Make all tree-sitter modes optional
Date: Tue, 17 Jan 2023 19:58:40 +0200

> From: Juri Linkov <juri@linkov.net>
> Cc: casouri@gmail.com,  monnier@iro.umontreal.ca,  larsi@gnus.org,
>   theo@thornhill.no,  jostein@secure.kjonigsen.net,  emacs-devel@gnu.org
> Date: Tue, 17 Jan 2023 19:30:16 +0200
> 
> It fails for many scenarios:
> 
> 1. The user needs to use e.g. js-ts-mode.  Your patch requires that
> users first visit a js file in js-mode, then they need to type
> 
>   M-x js-ts-mode RET
> 
> then for the rest of the session they can use js-ts-mode.
> But for a new session they need to repeat the same again.

Or customize auto-mode-alist.

This is a consequence of the fact that js-ts-mode doesn't have a
separate .el file.  If you have better ideas for that, I'm all ears.

> 2. For other ts modes adding something like (require 'c-ts-mode)
> to the user's init file is not a clean way to enable such modes.

Why not?

> Also takes additional space even when users don't intend to use them
> in the current session, thus negating the benefits of autoloading.

Once again, if the above is somehow too annoying, they can customize
auto-mode-alist manually.  Or even use use-package (and have full
benefit of autoloading).  In any case, the fact that a mode is loaded
and not used is not a problem large enough to reject this simple
arrangement.  Moreover, if someone puts the require into their init
file, they probably want to use the mode quite a lot, so it will not
remain ballast for too long.

> 3. There is no simple way to disable a ts mode after loading
> the corresponding ts file.

Yes, there is: restart the session.  IMO, adequate enough for
something you want to try, and then find not to like.

Bottom line: if you have better, simpler solutions, please tell.  The
ones you proposed until now are significantly more complex, and it is
not reasonable to ask users to go to such lengths to try a new mode.
But of course, if someone wants to do it in a more complex and more
flexible way, they still can.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]