Don't fail silently when grammar is missing #1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
These conditional clauses are found in some
-ts
modes, but only in the case where the parent mode is the non-ts
version of the mode: in such cases, the clause serves to quietly "downgrade" the mode to the non-ts
version when the grammar is missing, so that the-ts
mode can be enabled unconditionally inauto-mode-alist
.In cases where the parent mode is just
prog-mode
, likenoir-ts-mode
, the-ts
mode is non-functional without the grammar and should throw an error instead.As a related note, it is unclear how best to handle the
###autoload
-ed addition toauto-mode-alist
, since we'd expect to be able to install the same package config in Emacsen with and without tree-sitter. It's probably safest to guard theauto-mode-alist
expression in a(when (treesit-read-p 'lang) ...)
form too.(It looks like a couple of whitespace fixes found their way into the commit too, sorry.)