Subject: bug#59873: closed (Re: bug#59873: 29.0.60; [PATCH]: Make java-ts-mode defun-type-regexp more granular)

From: [email-masked] (GNU bug Tracking System)
Date: Fri, 09 Dec 2022 21:30:03 +0000

Your bug report

#59873: 29.0.60; [PATCH]: Make java-ts-mode defun-type-regexp more granular

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
59873: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=59873
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#59873: 29.0.60; [PATCH]: Make java-ts-mode defun-type-regexp more granular
From: Yuan Fu <[email-masked]>
To: Theodor Thornhill <[email-masked]>
Cc: [email-masked]
Date: Fri, 9 Dec 2022 13:29:14 -0800
List-Id: <debbugs-submit.debbugs.gnu.org>

Theodor Thornhill <[email-masked]> writes:

> Hi Yuan,
>
> Will you please install this patch?
>
> Thanks,
> Theo

Yes, absolutely. Applied!

Yuan

Subject: 29.0.60; [PATCH]: Make java-ts-mode defun-type-regexp more granular
From: Theodor Thornhill <[email-masked]>
To: [email-masked]
Date: Wed, 07 Dec 2022 10:10:03 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

Hi Yuan,

Will you please install this patch?

Thanks,
Theo

>From ef79549e793773b50faea9bad2cd35509e5714e1 Mon Sep 17 00:00:00 2001
From: Theodor Thornhill <[email-masked]>
Date: Wed, 7 Dec 2022 10:07:37 +0100
Subject: [PATCH] Make more granular defun-type-regexp

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.
---
 lisp/progmodes/java-ts-mode.el | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/lisp/progmodes/java-ts-mode.el b/lisp/progmodes/java-ts-mode.el
index 2c42505ac9..db2566d655 100644
--- a/lisp/progmodes/java-ts-mode.el
+++ b/lisp/progmodes/java-ts-mode.el
@@ -317,7 +317,15 @@ java-ts-mode
               (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)
-- 
2.34.1