GNU bug report logs - #78814
31.0.50; problems setting custom c++-ts-mode indent style

Previous Next

Package: emacs;

Reported by: "Jacek Świerk" <jacekswierk <at> gmail.com>

Date: Tue, 17 Jun 2025 10:02:02 UTC

Severity: normal

Found in version 31.0.50

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Eli Zaretskii <eliz <at> gnu.org>
To: Jacek Świerk <jacekswierk <at> gmail.com>
Cc: 78814 <at> debbugs.gnu.org
Subject: bug#78814: 31.0.50; problems setting custom c++-ts-mode indent style
Date: Sat, 21 Jun 2025 12:18:14 +0300
> From: "Jacek Świerk" <jacekswierk <at> gmail.com>
> Date: Tue, 17 Jun 2025 07:17:39 +0200
> 
> I encountered two separate issues while configuring a non-default
> indentation style in c++-ts-mode (although one of them also applies to
> c-ts-mode).
> 
> When invoking C-c . to set a style, c-ts-mode-set-style incorrectly sets
> treesit-simple-indent-rules to nil, preventing proper indentation.
> 
> I believe the issue stems from a typo in the c-ts-mode-set-style
> function. Specifically, when the mode is c++-ts-mode, the function
> passes the symbol 'c++ to c-ts-mode--simple-indent-rules, but the
> function expects the symbol 'cpp instead.
> 
> To reproduce:
> 
> M-x c++-ts-mode
> C-c . and pick any style
> C-h v treesit-simple-indent-rules should show nil and indentation does
> not work correctly

Thanks, I fixed this typo on the master branch.

> As for the second issue, in definitions of both c-ts-mode and
> c++-ts-mode, treesit-simple-indent-rules is derived from the return
> value of c-ts-mode--simple-indent-rules (lines 1486 and 1559). However,
> if the user customizes the indentation style by setting
> c-ts-mode-indent-style to a function, the current implementation breaks.
> The c-ts-mode--simple-indent-rules function expects one of the four
> predefined styles, but when c-ts-mode-indent-style is a custom function,
> it does not handle this correctly.
> 
> To reproduce:
> 
> Set c-ts-mode-indent-style to some custom function
> M-x c++-ts-mode
> C-h v treesit-simple-indent-rules should show ((cpp)) and indentation
> does not work correctly

Thanks, but please show a more detailed recipe, with a specific custom
function, so I could more easily investigate this issue.
Alternatively provide more details about what goes wrong in the code
in this case, in particular of this sentence:

> The c-ts-mode--simple-indent-rules function expects one of the four
> predefined styles, but when c-ts-mode-indent-style is a custom function,
> it does not handle this correctly.

I don't understand which call to c-ts-mode--simple-indent-rules is at
fault here, and what does "does not handle this correctly" mean.




This bug report was last modified 25 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.