]> git.eshelyaron.com Git - emacs.git/commit
Use new baseline indent rule in c-ts-mode
authorYuan Fu <casouri@gmail.com>
Sun, 1 Dec 2024 08:15:08 +0000 (00:15 -0800)
committerEshel Yaron <me@eshelyaron.com>
Wed, 4 Dec 2024 17:04:14 +0000 (18:04 +0100)
commitc0b8b26e597033e7b82dd4a2f80b5e8d05b4e093
treef5de26c7932d050575bd342b9afd89d22632e987
parent8997ebf8b443510cf755e0152845d603716971df
Use new baseline indent rule in c-ts-mode

Rework the indent rules in c-ts-mode using
c-ts-common-baseline-indent-rule.  Also reworked internal
functions for setting indent styles to make it simpler and (more
importantly) more readable.  Now there's a single function,
c-ts-mode--simple-indent-rules, that returns a value that can go
straight to treesit-simple-indent-rules.

* lisp/progmodes/c-ts-mode.el:
(c-ts-mode--indent-style-setter): Simplify.
(c-ts-mode--get-indent-style): Remove function.
(c-ts-mode--prompt-for-style): Use a hard-coded list of styles.
This is a tiny downgrade from the computed lists but is
acceptable.
(c-ts-mode-set-style): Use c-ts-mode--simple-indent-rules.
(c-ts-mode--standalone-grandparent): Docstring change.
(c-ts-mode--for-loop-indent-rule): New function.
(c-ts-mode--preproc-indent-rules): New variable.  Copied from
old indent rules and added some new rule.
(c-ts-mode--macro-heuristic-rules):
(c-ts-mode--simple-indent-rules):
(c-ts-mode--parenthesized-expression-indent-rule):
(c-ts-mode--label-indent-rules): New functions.
(c-ts-mode):
(c++-ts-mode): Use c-ts-mode--simple-indent-rules.

(cherry picked from commit 63d69bd154987bcc0434e0f85e09bf5dfa07b827)
lisp/progmodes/c-ts-mode.el