renzmann / treesit-auto

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

Remove the language from `treesit-auto-langs` #82

Closed sebastiaanspeck closed 7 months ago

sebastiaanspeck commented 8 months ago

This was the underlying issue for https://github.com/renzmann/treesit-auto/pull/81.

In the README it states:

By activating global-treesit-auto-mode, Emacs will:
• Automatically switch to <name>-ts-mode when the grammar for <name> is installed
• Stick with <name>-mode if the grammar isn’t installed

But if it can not switch to it, it kept on retrying, which caused an infinite loop unitl Emacs itself decided to kill the loop.

After this change, the recipe for Magik can be re-added again.

Sorry for the constant adding/removing of the recipe.

NOTE: The language is only removed from treesit-auto-langs in the function. Afterwards it is still in the list of treesit-auto-langs.

sebastiaanspeck commented 7 months ago

@renzmann a little ping since the current release is broken if users do not have the grammar installed and in Windows you have the variable treesit-auto-install set to nil. It will keep on trying to open and compile the languages defined in treesit-auto-recipe-list. By removing the language we are trying to open from the treesit-auto-langs in the function treesit-auto--maybe-install-grammar, we only try it once.

renzmann commented 7 months ago

I can confirm that #83 is working well for me. Why not just do both steps in one go? I'll merge that one to close out both issues at one if you want.

sebastiaanspeck commented 7 months ago

I can confirm that #83 is working well for me. Why not just do both steps in one go? I'll merge that one to close out both issues at one if you want.

If you mean you want to merge this one and #83 at the same time, that is okay, but this needs to be merged to fix the issue as described above.

sebastiaanspeck commented 7 months ago

I personally use the next configuration as described as recommended:

(use-package treesit-auto
  :config
  (global-treesit-auto-mode))

As described above, I do not use auto-install, and with that disabled it will keep on trying to install the language until Emacs itself quits the never-ending loop.

renzmann commented 7 months ago

I mean that #83 also includes the change that this one introduces:

              (treesit-auto-langs (remove lang treesit-auto-langs))

So if we merge that one, we can close it all out at once. Is there something I'm missing about why they'd need to be done in sequence?

sebastiaanspeck commented 7 months ago

I mean that #83 also includes the change that this one introduces:

              (treesit-auto-langs (remove lang treesit-auto-langs))

So if we merge that one, we can close it all out at once. Is there something I'm missing about why they'd need to be done in sequence?

Ah.. I see! Sorry, I was not aware of that. Yes, you are absolutely right to merge #83.

sebastiaanspeck commented 7 months ago

Superseded by #83