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

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

bug#60983: 29.0.60; Tree-sitter user-level control


From: Eli Zaretskii
Subject: bug#60983: 29.0.60; Tree-sitter user-level control
Date: Mon, 23 Jan 2023 18:52:33 +0200

Ping!  Yuan, any comments?  I'd like to finish this job some time
soon, and I need your feedback and/or code changes before I can
proceed.

> From: Theodor Thornhill <theo@thornhill.no>
> Cc: Yuan Fu <casouri@gmail.com>
> Date: Sat, 21 Jan 2023 12:48:58 +0100
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > I started looking into providing user-level documentation for
> > tree-sitter based modes, and bumped into some issues:
> >
> >  . How does one use treesit-font-lock-level?
> >
> >    - It is not a customizable user option (unlike
> >      font-lock-maximum-decoration), so it cannot be set via
> >      customize-variable.  Is there a reason not to make it a
> >      defcustom?
> >    - It automatically becomes buffer-local when set, and OTOH setting
> >      it in a buffer does not produce fontifications according to the
> >      level, and neither does setting it in a mode hook.  So the only
> >      way to change its value is by using setq-default, which I don't
> >      think is the intent?
> >    - Should we make the variable a defcustom?
> >    - Should it be possible to customize it separately for each mode?
> >    - Should we allow to change the level and then call some function
> >      to re-fontify the current buffer according to the new level?
> 
> I struggled with this too.  I ended up setting it with setq-default,
> assuming I was just missing something very simple.  I'm in favor for
> either a defcustom or honoring the font-lock-maximum-decoration values,
> specifically these settings:
> 
> ```
> If t, use the maximum decoration available.
> If a number, use that level of decoration (or if not available the maximum).
> ```
> 
> >
> >  . How does one change the indentation style in c-ts-mode?
> >
> >    - There is a defcustom c-ts-mode-indent-style, but I don't think I
> >      see any difference in indentation of new code when I change the
> >      value.  What am I missing?
> >
> 
> (setq c-ts-mode-indent-style 'bsd) then revert-buffer fixes it for me.
> It seems you need to reload the file to enable the new style.  Should I
> add a command that can be set explicitly as in c-mode?
> 'c-ts-mode-set-style'?
> 
> However, going over it I see there are lots of regressions after the new
> bracket-counting code added recently, effectively making the indent
> styles pretty broken right now...
> 
> For example with bsd style:
> 
> Previously:
> 
> int
> main()
> {
>   if (x)
>   {
>       
>   }
>   else
>       {
>               
>   }
> }
> 
> now:
> 
> int
> main()
> {
>   if (x)
>   {
>       
>     }
>   else
>       {
>               
>               }
> }
> 
> 
> 
> >  . What commands are affected by treesit-defun-tactic?
> 
> 'treesit--navigate-thing' uses it, so 'beginning-of-defun',
> 'forward-sentence' etc uses it through 'treesit-beginning-of-thing'.
> 
> Theo
> 





reply via email to

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