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

Auto-load of ts major mode fails when no other alternative major mode exists #110

Open bnicolae opened 1 month ago

bnicolae commented 1 month ago

cmake-ts-mode is not automatically loaded when opening CMakeLists.txt files. This is because auto-mode-alist is missing the following line:

("\\(?:CMakeLists\\.txt\\|\\.cmake\\)\\'" . cmake-ts-mode)

After manually loading it (M-x cmake-ts-mode) this line is added to auto-mode-alist. Note that I don't have any other major cmake mode. When I install one ((e.g., cmake-mode), treesit-auto correctly replaces it. Expected behavior: load cmake-ts-mode regardless whether an alternative exists or not.

I am using this configuration in ~/.emacs:


  :custom
  (treesit-auto-install 'prompt)
  :config
  (treesit-auto-add-to-auto-mode-alist 'all)
  (global-treesit-auto-mode))```