Subject: Re: bug#62204: 30.0.50; Feature Request: treesit-major-mode-hook

From: Eli Zaretskii <[email-masked]>
Date: Wed, 15 Mar 2023 16:24:45 +0200

> From: Aleksandar Dimitrov <[email-masked]>
> Date: Wed, 15 Mar 2023 12:50:38 +0100
> 
> 
> I'd like to propose a major mode hook that is called every time any treesit-based major mode is enabled.
> 
> My use case is this: I'd like to extend the expand-region.el package so that it can make use of treesit to set the region to any treesit node. This should work in all treesit-based major modes.
> 
> Currently, I've found two ways to accomplish loading my functionality for all ts-modes:
> 
> - enumerate them all and use their respective hooks
> - advise something like `treesit-major-mode-setup` to execute my code

Isn't it enough to check that the buffer has a treesit parser?

A hooks sounds too blunt and ad-hoc for your purposes, AFAIU.