]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix enums and unions appearing as structs in c-ts-base-mode's imenu
authorRandy Taylor <dev@rjt.dev>
Wed, 8 Mar 2023 01:38:18 +0000 (20:38 -0500)
committerYuan Fu <casouri@gmail.com>
Fri, 10 Mar 2023 05:58:55 +0000 (21:58 -0800)
* lisp/progmodes/c-ts-mode.el (c-ts-base-mode): Separate enums and unions out
from structs.

lisp/progmodes/c-ts-mode.el

index fdd962ff020f5a4f322f0f258803345e84651816..ff86b9e054468d8be7c47d13abf15545b9bdcd8d 100644 (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"