Make more granular defun-type-regexp (bug#59873)

We don't want to match local_variable_declaration and others to hit on
beginning-of-defun.  The fix is just to make the regexp a bit more
granular.

* lisp/progmodes/java-ts-mode.el (java-ts-mode): Use regexp-opt to
distinguish more granularly.
This commit is contained in:
Theodor Thornhill 2022-12-07 10:07:37 +01:00 committed by Yuan Fu
parent 8f49137c9b
commit 839341d737
No known key found for this signature in database
GPG key ID: 56E19BC57664A442

View file

@ -321,7 +321,15 @@ the subtrees."
(append "{}():;," electric-indent-chars)) (append "{}():;," electric-indent-chars))
;; Navigation. ;; Navigation.
(setq-local treesit-defun-type-regexp "declaration") (setq-local treesit-defun-type-regexp
(regexp-opt '("method_declaration"
"class_declaration"
"record_declaration"
"interface_declaration"
"enum_declaration"
"import_declaration"
"package_declaration"
"module_declaration")))
;; Font-lock. ;; Font-lock.
(setq-local treesit-font-lock-settings java-ts-mode--font-lock-settings) (setq-local treesit-font-lock-settings java-ts-mode--font-lock-settings)