From: Theodor Thornhill Date: Wed, 7 Dec 2022 09:07:37 +0000 (+0100) Subject: Make more granular defun-type-regexp (bug#59873) X-Git-Tag: emacs-29.0.90~1269 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=839341d73707be2082abbd8834ba46292e59aeb7;p=emacs.git 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. --- diff --git a/lisp/progmodes/java-ts-mode.el b/lisp/progmodes/java-ts-mode.el index 23e166ee4c3..9155a7fff25 100644 --- a/lisp/progmodes/java-ts-mode.el +++ b/lisp/progmodes/java-ts-mode.el @@ -321,7 +321,15 @@ the subtrees." (append "{}():;," electric-indent-chars)) ;; 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. (setq-local treesit-font-lock-settings java-ts-mode--font-lock-settings)