;;; Commentary:
;;
+;; This package provides major modes for C and C++, plus some handy
+;; functions that are useful generally to major modes for C-like
+;; languages.
+;;
+;; This package provides `c-ts-mode' for C, `c++-ts-mode' for C++, and
+;; `c-or-c++-ts-mode' which automatically chooses the right mode for
+;; C/C++ header files.
+;;
+;; To use these more by default, evaluate
+;;
+;; (add-to-list 'major-mode-remap-alist '(c-mode . c-ts-mode))
+;; (add-to-list 'major-mode-remap-alist '(c++-mode . c++-ts-mode))
+;; (add-to-list 'major-mode-remap-alist '(c-or-c++-mode . c-or-c++-ts-mode))
+;;
+;; in your configuration.
+;;
+;; For C-like language major modes:
+;;
+;; - Use `c-ts-mode-comment-setup' to setup comment variables and
+;; filling.
+;;
+;; - Use simple-indent matcher `c-ts-mode--looking-at-star' and anchor
+;; `c-ts-mode--comment-start-after-first-star' for indenting block
+;; comments. See `c-ts-mode--indent-styles' for example.
+;;
+;; - Use variable `c-ts-mode-indent-block-type-regexp' with indent
+;; offset c-ts-mode--statement-offset for indenting statements.
+;; Again, see `c-ts-mode--indent-styles' for example.
;;; Code:
This mode is independent from the classic cc-mode.el based
`c-mode', so configuration variables of that mode, like
-`c-basic-offset', don't affect this mode."
+`c-basic-offset', doesn't affect this mode.
+
+To use tree-sitter C/C++ modes by default, evaluate
+
+ (add-to-list \\='major-mode-remap-alist \\='(c-mode . c-ts-mode))
+ (add-to-list \\='major-mode-remap-alist \\='(c++-mode . c++-ts-mode))
+ (add-to-list \\='major-mode-remap-alist
+ \\='(c-or-c++-mode . c-or-c++-ts-mode))
+
+in your configuration."
:group 'c
(when (treesit-ready-p 'c)
This mode is independent from the classic cc-mode.el based
`c++-mode', so configuration variables of that mode, like
-`c-basic-offset', don't affect this mode."
+`c-basic-offset', don't affect this mode.
+
+To use tree-sitter C/C++ modes by default, evaluate
+
+ (add-to-list \\='major-mode-remap-alist \\='(c-mode . c-ts-mode))
+ (add-to-list \\='major-mode-remap-alist \\='(c++-mode . c++-ts-mode))
+ (add-to-list \\='major-mode-remap-alist
+ \\='(c-or-c++-mode . c-or-c++-ts-mode))
+
+in your configuration."
:group 'c++
(when (treesit-ready-p 'cpp)