bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#60176: 29.0.60; Fallback file variable mode if treesitter is not usa


From: Juri Linkov
Subject: bug#60176: 29.0.60; Fallback file variable mode if treesitter is not usable
Date: Mon, 19 Dec 2022 19:29:13 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu)

>> So to completely cover all needs, 'major-mode-remap-alist' should
>> support a predicate as well.  For example,
>>
>> (setq major-mode-remap-alist '((c-mode #'treesit-available-p c-ts-mode)))
>
> I think the idea is that this should happen by default, not as a
> (not-so-trivial) customization by the users.

Then 'c-ts-mode' should fall back to 'c-mode' when treesit is not available?
Like this:

```
diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el
index cf941236f82..5004b9a5e1d 100644
--- a/lisp/progmodes/c-ts-mode.el
+++ b/lisp/progmodes/c-ts-mode.el
@@ -616,7 +616,7 @@ c-ts-mode
 (define-derived-mode c-ts-mode c-ts-base-mode "C"
 
   (unless (treesit-ready-p 'c)
-    (error "Tree-sitter for C isn't available"))
+    (c-mode))
 
   (treesit-parser-create 'c)
 
```





reply via email to

[Prev in Thread] Current Thread [Next in Thread]