Commit f55bbc68 authored by Theodor Thornhill's avatar Theodor Thornhill
Browse files

Add sentence and sexp movement to c-ts-mode

* lisp/progmodes/c-ts-mode.el (c-ts-base-mode): Add
'treesit-sentence-type-regexp' and 'treesit-sexp-type-regexp' node
types.
parent f4a3e8f2
Pipeline #22900 passed with stage
in 2 minutes and 37 seconds
......@@ -896,6 +896,37 @@ Set up:
(setq-local treesit-defun-skipper #'c-ts-mode--defun-skipper)
(setq-local treesit-defun-name-function #'c-ts-mode--defun-name)
(setq-local treesit-sentence-type-regexp
;; compound_statement makes us jump over too big units
;; of code, so skip that one, and include the other
;; statements.
(regexp-opt '("preproc"
"declaration"
"specifier"
"attributed_statement"
"labeled_statement"
"expression_statement"
"if_statement"
"switch_statement"
"do_statement"
"while_statement"
"for_statement"
"return_statement"
"break_statement"
"continue_statement"
"goto_statement"
"case_statement")))
(setq-local treesit-sexp-type-regexp
(regexp-opt '("preproc"
"declarator"
"qualifier"
"type"
"parameter"
"expression"
"literal"
"string")))
;; Nodes like struct/enum/union_specifier can appear in
;; function_definitions, so we need to find the top-level node.
(setq-local treesit-defun-prefer-top-level t)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment