emacs-tree-sitter / elisp-tree-sitter

Emacs Lisp bindings for tree-sitter
https://emacs-tree-sitter.github.io
MIT License
816 stars 73 forks source link

emacs-tree-sitter.org: use (require 'tree-sitter-langs) #174

Closed Hi-Angel closed 2 years ago

Hi-Angel commented 2 years ago

The documentation as it is confusing: it basically says you have to enable tree-sitter-mode, and stuff will just work. Well it actually doesn't, because the variable tree-sitter-major-mode-language-alist won't get set until you execute (require 'tree-sitter-langs).

And it is not clear at all that this line needs to be executed because all you get is No language registered for major mode message. Usually lack of (require) results in missing function definitions, so in this case there's no reason a user seeing the error would think "aha, I need a (require) call".

So let's avoid confusion by mentioning the (require) line explicitly.

ubolonton commented 2 years ago

This is an issue with autoloading. It should be fixed by https://github.com/emacs-tree-sitter/tree-sitter-langs/commit/55a444fd6c68801f76b6f4642a1c9b4e4ba6338f.

Please let me know if that helps.

Thanks for pointing out the potential confusion anyway! I'll update the error message, and add more clarifications on the role of tree-sitter-langs to the doc.

Hi-Angel commented 2 years ago

Thank you! What can be even better than a documented problem? Having no problem at all! Thanks for the fix!