renzmann / treesit-auto

Automatic installation, usage, and fallback for tree-sitter major modes in Emacs 29
GNU General Public License v3.0
377 stars 29 forks source link

Syncing hooks between tree-sitter and default modes #3

Open renzmann opened 1 year ago

renzmann commented 1 year ago

A reddit comment brought up the fact that it's annoying to manually sync hooks between tree-sitter and the default modes. Maybe add a switch like treesit-auto-sync-hooks that can be t or nil? Or maybe a customizable list for modes that should be synced?

justinbarclay commented 1 year ago

Instead of "syncing" hooks across modes, python-ts-mode and python-mode would it be better to recommend setting all their generic hooks and configs on python-base-mode? From briefly looking into the source code, I think every major mode that has a ts-mode derivative also has a base-mode that contains all the code and config that is generic across the two modes.

renzmann commented 1 year ago

That makes sense for legacy languages like Python, but not net-new languages like Go and Rust. If I'm trying to transition to go-ts-mode, which derives from prog-mode directly, but also have go-mode handy, I might want to apply the same hooks regardless of which one gets activated.

12 would introduce treesit-auto--available-alist, however, which makes an implementation per the Reddit post considerably easier

gitrj95 commented 1 year ago

another thing worth thinking about is how this will play into styles. eg, it's tedious to set c style in two sets of variables -- one tree sitter one separate