File: c-ts-mode.el.html

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 modes by default, assuming you have the respective tree-sitter grammars available, do one of the following:

- Add one or more of the following lines to your init file:

   (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))

  If you have only C grammar available, use only the first one; if
  you have only the C++ grammar, use only the second one.

- Customize 'auto-mode-alist' to turn one or more of the modes
  automatically. For example:

    (add-to-list 'auto-mode-alist
                 '("\\\\(\\\\.ii\\\\|\\\\.\\\\(CC?\\\\|HH?\\\\)\\\\|\\\\.[ch]\\\\(pp\\\\|xx\\\\|\\\\+\\\\+\\\\)\\\\|\\\\.\\\\(cc\\\\|hh\\\\)\\\\)\\\\'"
                   . c++-ts-mode))

  will turn on the c++-ts-mode for C++ source files.

- If you have both C and C++ grammars installed, customize
  'treesit-enabled-modes' and select 'c-ts-mode',
  'c++-mode', 'c-or-c++-mode'.

You can also turn on these modes manually in a buffer. Doing so will set up Emacs to use the C/C++ modes defined here for other files, provided that you have the corresponding parser grammar libraries installed.

If the tree-sitter doxygen grammar is available, then the comment blocks can be highlighted according to this grammar.

Defined variables (32)

c++-ts-mode-abbrev-tableAbbrev table for ‘c++-ts-mode’.
c++-ts-mode-hookHook run after entering ‘c++-ts-mode’.
c++-ts-mode-mapKeymap for ‘c++-ts-mode’.
c++-ts-mode-syntax-tableSyntax table for ‘c++-ts-mode’.
c-ts-base-mode-abbrev-tableAbbrev table for ‘c-ts-base-mode’.
c-ts-base-mode-hookHook run after entering ‘c-ts-base-mode’.
c-ts-base-mode-mapKeymap for C and C-like languages with tree-sitter
c-ts-mode--c++-operator-keywordsC++ operators that we fontify as keywords.
c-ts-mode--c++-operatorsC++ operators that aren’t supported by C.
c-ts-mode--c-or-c++-regexpA regexp applied to C header files to check if they are really C++.
c-ts-mode--doxygen-comment-regexA regexp that matches all doxygen comment styles.
c-ts-mode--emacs-c-range-queryQuery that finds a FOR_EACH_* macro with an unbracketed body.
c-ts-mode--feature-list‘treesit-font-lock-feature-list’ for ‘c-ts-mode’.
c-ts-mode--for-each-tail-rangesRanges covering all the FOR_EACH_* macros in the buffer.
c-ts-mode--for-each-tail-regexpA regexp matching all the variants of the FOR_EACH_* macro.
c-ts-mode--ms-keywordsMSVC keywords.
c-ts-mode--operatorsC/C++ operators for tree-sitter font-locking.
c-ts-mode--optional-c-keywordsKeywords added in each tree-sitter-c version.
c-ts-mode--preproc-indent-rulesIndent rules for preprocessors.
c-ts-mode--preproc-keywordsC/C++ keywords for tree-sitter font-locking.
c-ts-mode--syntax-tableSyntax table for ‘c-ts-mode’.
c-ts-mode--thing-settings‘treesit-thing-settings’ for both C and C++.
c-ts-mode--type-keywordsKeywords that should be considered as part of a type.
c-ts-mode-abbrev-tableAbbrev table for ‘c-ts-mode’.
c-ts-mode-emacs-sources-supportWhether to enable Emacs source-specific C features.
c-ts-mode-enable-doxygenEnable doxygen syntax highlighting.
c-ts-mode-hookHook run after entering ‘c-ts-mode’.
c-ts-mode-indent-offsetNumber of spaces for each indentation step in ‘c-ts-mode’.
c-ts-mode-indent-styleStyle used for indentation.
c-ts-mode-mapKeymap for ‘c-ts-mode’.
c-ts-mode-menuMenu for ‘c-ts-mode’ and ‘c++-ts-mode’.
c-ts-mode-syntax-tableSyntax table for ‘c-ts-mode’.

Defined functions (46)

c++-ts-mode()
c-or-c++-ts-mode()
c-ts-base--before-indent(ARGS)
c-ts-base-mode()
c-ts-indent-style-safep(STYLE)
c-ts-mode()
c-ts-mode--compute-optional-keywords(MODE)
c-ts-mode--declarator-identifier(NODE &optional QUALIFIED)
c-ts-mode--defun-for-class-in-imenu-p(NODE)
c-ts-mode--defun-name(NODE)
c-ts-mode--defun-skipper()
c-ts-mode--defun-valid-p(NODE)
c-ts-mode--emacs-current-defun-name()
c-ts-mode--emacs-defun-at-point(&optional RANGE)
c-ts-mode--emacs-defun-body-p(NODE)
c-ts-mode--emacs-defun-p(NODE)
c-ts-mode--emacs-macro-rules(_ PARENT &rest _)
c-ts-mode--emacs-set-ranges(BEG END)
c-ts-mode--font-lock-settings(MODE)
c-ts-mode--fontify-DEFUN(NODE OVERRIDE START END &rest _)
c-ts-mode--fontify-declarator(NODE OVERRIDE START END &rest ARGS)
c-ts-mode--fontify-error(NODE OVERRIDE START END &rest _)
c-ts-mode--fontify-for-each-tail(NODE OVERRIDE START END &rest _)
c-ts-mode--fontify-variable(NODE OVERRIDE START END &rest _)
c-ts-mode--for-each-tail-body-matcher(N P BOL &rest _)
c-ts-mode--for-loop-indent-rule(NODE PARENT &rest _)
c-ts-mode--indent-style-setter(SYM VAL)
c-ts-mode--keywords(MODE)
c-ts-mode--label-indent-rules(NODE PARENT BOL &rest ARGS)
c-ts-mode--macro-heuristic-rules(NODE PARENT &rest _)
c-ts-mode--outline-predicate(NODE)
c-ts-mode--parenthesized-expression-indent-rule(NODE PARENT &rest _)
c-ts-mode--preproc-offset(N P &rest _)
c-ts-mode--prev-sibling(NODE PARENT BOL &rest _)
c-ts-mode--prompt-for-style()
c-ts-mode--reverse-ranges(RANGES BEG END)
c-ts-mode--simple-indent-rules(MODE STYLE)
c-ts-mode--standalone-parent(N PARENT &rest _)
c-ts-mode--syntax-propertize(BEG END)
c-ts-mode--top-level-declarator(NODE)
c-ts-mode-indent-defun()
c-ts-mode-menu(ARG1)
c-ts-mode-set-global-style(STYLE)
c-ts-mode-set-modeline()
c-ts-mode-set-style(STYLE)
c-ts-mode-toggle-comment-style(&optional ARG)

Defined faces (0)