GNU bug report logs -
#60983
29.0.60; Tree-sitter user-level control
Previous Next
Full log
Message #17 received at submit <at> debbugs.gnu.org (full text, mbox):
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 <at> thornhill.no>
> Cc: Yuan Fu <casouri <at> gmail.com>
> Date: Sat, 21 Jan 2023 12:48:58 +0100
>
> Eli Zaretskii <eliz <at> 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
>
This bug report was last modified 2 years and 193 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.