emacs-devel
[Top][All Lists]
Advanced

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

Re: Tree sitter support for C-like languages


From: Eli Zaretskii
Subject: Re: Tree sitter support for C-like languages
Date: Tue, 15 Nov 2022 20:38:57 +0200

> From: Yuan Fu <casouri@gmail.com>
> Date: Tue, 15 Nov 2022 10:18:21 -0800
> Cc: Stefan Monnier <monnier@iro.umontreal.ca>,
>  theo@thornhill.no,
>  emacs-devel@gnu.org
> 
> > Maybe we should grow some augmentations for tree-sitter, at least
> > given enough time.  Or maybe it's possible to identify the parts where
> > this happens by some tree-sitter indications, and tweak the faces in
> > those regions in some way.
> 
> I don’t know how could you improve this in tree-sitter since macros are 
> literally “define you own syntax”. We can reasonably fix the highlighting for 
> some of our macros like DEFUN. As a demonstration I added some 
> emacs-devel-specific rules (that are disabled by default). Run this:
> 
> (add-hook 'c-ts-mode-hook
>           (lambda ()
>             (treesit-font-lock-recompute-features '(emacs-devel))))
> 
> And restart c-ts-mode, and DEFUN’s should look normal now.

I will try that when I have time, thanks.  But if this indeed works
well, why not do something similar to fix more warnings?  And why not
make this the default, instead of asking users to write mode hooks?



reply via email to

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