renzmann / treesit-auto

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

Improve method for temporarily overriding major-mode-remap-alist #87

Open noctuid opened 4 months ago

noctuid commented 4 months ago

Let bind major-mode-remap-alist around set-auto-mode-0 instead of using setq-local, and only consider the mode being switched to.

Fixes #84. After doing some more testing this was actually caused by interaction between other plugins (my editorconfig setup) causing set-auto-mode-0 to be called 20+ times when opening a file.

Still, this should be an improvement over the old method using setq-local and provides a small performance boost. Let me know if you think there are any potential issues with this method.

I also added autoload cookies for some of the commands. For now I just left the globalized minor mode alone because adding an autoload cookie will cause an error since it will pull in the cl-loop from :predicate into the autoloads file (and the struct doesn't exist yet).