]> git.eshelyaron.com Git - emacs.git/commit
Move c-ts-mode--statement-offset to c-ts-common.el
authorYuan Fu <casouri@gmail.com>
Sun, 29 Jan 2023 01:08:53 +0000 (17:08 -0800)
committerYuan Fu <casouri@gmail.com>
Sun, 29 Jan 2023 08:12:56 +0000 (00:12 -0800)
commita3003492ace0571e5179500b42bbe44cb9763dbb
tree18cfcb00f5d2707d2b6eed00f1ce5b6faeea8d4b
parent4b1714571c8c6cf7ae2ee2602c66b7c903c45a4a
Move c-ts-mode--statement-offset to c-ts-common.el

Now it can be used by other C-like languages.

* lisp/progmodes/c-ts-common.el (c-ts-common-indent-offset):
(c-ts-common-indent-block-type-regexp):
(c-ts-common-indent-bracketless-type-regexp): New variables.
(c-ts-common-statement-offset):
(c-ts-mode--fix-bracketless-indent):
(c-ts-mode--close-bracket-offset): New functions.

* lisp/progmodes/c-ts-mode.el (c-ts-mode--indent-styles): Change
c-ts-mode--statement-offset to c-ts-common-statement-offset.
The (parent-is "if_statement") rules are now handled by (node-is
"compound_statement").

(c-ts-mode--statement-offset-post-processr):
(c-ts-mode--statement-offset):
(c-ts-mode--fix-bracketless-indent): Move to c-ts-common.el.

(c-ts-base-mode): Setup c-ts-common stuff.

* test/lisp/progmodes/c-ts-mode-resources/indent.erts: Make the test
more challenging.
lisp/progmodes/c-ts-common.el
lisp/progmodes/c-ts-mode.el
test/lisp/progmodes/c-ts-mode-resources/indent.erts