; Add commentary and dostring in c-ts-mode

* lisp/progmodes/c-ts-mode.el: Add commentary.
(c-ts-mode, c++-ts-mode): Add docstring.
This commit is contained in:
Yuan Fu 2023-01-18 15:32:12 -08:00
parent 4fb7b0b0b8
commit c289786886
No known key found for this signature in database
GPG key ID: 56E19BC57664A442

View file

@ -24,6 +24,34 @@
;;; Commentary: ;;; 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: ;;; Code:
@ -936,7 +964,16 @@ Set up:
This mode is independent from the classic cc-mode.el based This mode is independent from the classic cc-mode.el based
`c-mode', so configuration variables of that mode, like `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 :group 'c
(when (treesit-ready-p 'c) (when (treesit-ready-p 'c)
@ -957,7 +994,16 @@ This mode is independent from the classic cc-mode.el based
This mode is independent from the classic cc-mode.el based This mode is independent from the classic cc-mode.el based
`c++-mode', so configuration variables of that mode, like `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++ :group 'c++
(when (treesit-ready-p 'cpp) (when (treesit-ready-p 'cpp)