[Top][All Lists]

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

Re: c-ts-mode

From: João Távora
Subject: Re: c-ts-mode
Date: Thu, 07 Sep 2023 18:53:58 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

Eli Zaretskii <eliz@gnu.org> writes:

>> From: João Távora <joaotavora@gmail.com>
>> Date: Thu, 7 Sep 2023 16:58:29 +0100
>> Cc: casouri@gmail.com, spacibba@aol.com, emacs-devel@gnu.org
> I think c-ts-mode--indent-styles needs to be refactored toallow fine
> control on the indentation parameters that are currently hard-coded
> for each supported style.  They will need to have different names,
> because tree-sitter doesn't use the CC Mode terminology for the
> syntactical constructs.  Also, there seem to be many more parameters
> than in CC Mode.

I've been doing some experiments with c-ts-mode-indent-style, which can
be set to a function that returns a list that adds new items in front of
the list returned by with:

   (alist-get 'gnu (c-ts-mode--indent-styles 'cpp))

It's not super clean (notice the '--'), but not very dirty either.

The hard part is writing the rule in question, but I'll get there I

> First, please submit a bug report about this with all the details.

Done.  bug#65810

> And second, I don't seem to be able to reproduce this, assuming that
> by C-M-foo you meant C-M-f and C-M-b.  Maybe this needs some
> particular source file to reproduce?  (I tried with one C file and one
> C++ file.)

You assumed correctly, And no, it works with an empty file even.  The
recipe is so simple I might as well repost it here:

  ~/Source/Emacs/emacs/src/emacs -nw -Q ~/tmp/simple.cpp -f c++-ts-mode

Then just try any C-M-f or C-M-b or C-M-u etc, and see the error

I installed my grammar with M-x treesit-install-language-grammar today.
But it also happens with a grammar installed in the same way many months

Doesn't seem to happen in c-ts-mode.

>> Setting the variable to nil brings me to more familar
>> and satisfactory terrain where, and I suppose the non-treesit
>> syntax table is being used for that.  Is there any big
>> advantage in switching to treesitter's forward-sexp-function?
> Yes, see treesit-defun-tactic.

Will check it out, thanks.


reply via email to

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