Add < and > to the syntax table in c++-ts-mode (bug#60049)

* lisp/progmodes/c-ts-mode.el (c++-ts-mode--syntax-table): Add a
specific syntax table for C++.  Consider "<" and ">" open/close
delimiters (C++ templates).
(c++-ts-mode): Use the new syntax table.
This commit is contained in:
Daniel Martín 2022-12-13 22:28:13 +01:00 committed by Yuan Fu
parent fbf0d3b796
commit 480f41c7de
No known key found for this signature in database
GPG key ID: 56E19BC57664A442

View file

@ -83,6 +83,14 @@ follows the form of `treesit-simple-indent-rules'."
table)
"Syntax table for `c-ts-mode'.")
(defvar c++-ts-mode--syntax-table
(let ((table (make-syntax-table c-ts-mode--syntax-table)))
;; Template delimiters.
(modify-syntax-entry ?< "(" table)
(modify-syntax-entry ?> ")" table)
table)
"Syntax table for `c++-ts-mode'.")
(defun c-ts-mode--indent-styles (mode)
"Indent rules supported by `c-ts-mode'.
MODE is either `c' or `cpp'."
@ -616,6 +624,7 @@ the subtrees."
(define-derived-mode c++-ts-mode c-ts-base-mode "C++"
"Major mode for editing C++, powered by tree-sitter."
:group 'c++
:syntax-table c++-ts-mode--syntax-table
(unless (treesit-ready-p 'cpp)
(error "Tree-sitter for C++ isn't available"))