Fix enums and unions appearing as structs in c-ts-base-mode's imenu

* lisp/progmodes/c-ts-mode.el (c-ts-base-mode): Separate enums and unions out
from structs.
This commit is contained in:
Randy Taylor 2023-03-07 20:38:18 -05:00 committed by Yuan Fu
parent ecdfd584a5
commit 1de513a29f
No known key found for this signature in database
GPG key ID: 56E19BC57664A442

View file

@ -930,9 +930,9 @@ the semicolon. This function skips the semicolon."
;; Imenu.
(setq-local treesit-simple-imenu-settings
(let ((pred #'c-ts-mode--defun-valid-p))
`(("Struct" ,(rx bos (or "struct" "enum" "union")
"_specifier" eos)
,pred nil)
`(("Enum" "\\`enum_specifier\\'" ,pred nil)
("Struct" "\\`struct_specifier\\'" ,pred nil)
("Union" "\\`union_specifier\\'" ,pred nil)
("Variable" ,(rx bos "declaration" eos) ,pred nil)
("Function" "\\`function_definition\\'" ,pred nil)
("Class" ,(rx bos (or "class_specifier"