From unknown Fri Sep 05 15:34:43 2025 X-Loop: help-debbugs@gnu.org Subject: bug#59873: 29.0.60; [PATCH]: Make java-ts-mode defun-type-regexp more granular Resent-From: Theodor Thornhill Original-Sender: "Debbugs-submit" Resent-CC: casouri@gmail.com, bug-gnu-emacs@gnu.org Resent-Date: Wed, 07 Dec 2022 09:11:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 59873 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 59873@debbugs.gnu.org Cc: casouri@gmail.com X-Debbugs-Original-To: bug-gnu-emacs@gnu.org X-Debbugs-Original-Xcc: casouri@gmail.com Received: via spool by submit@debbugs.gnu.org id=B.16704042594742 (code B ref -1); Wed, 07 Dec 2022 09:11:02 +0000 Received: (at submit) by debbugs.gnu.org; 7 Dec 2022 09:10:59 +0000 Received: from localhost ([127.0.0.1]:48672 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p2qSA-0001EQ-A2 for submit@debbugs.gnu.org; Wed, 07 Dec 2022 04:10:59 -0500 Received: from lists.gnu.org ([209.51.188.17]:39676) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p2qS5-0001EK-9G for submit@debbugs.gnu.org; Wed, 07 Dec 2022 04:10:57 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p2qRw-0002et-UC for bug-gnu-emacs@gnu.org; Wed, 07 Dec 2022 04:10:47 -0500 Received: from out-38.mta0.migadu.com ([2001:41d0:1004:224b::26]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p2qRt-00036L-Fu for bug-gnu-emacs@gnu.org; Wed, 07 Dec 2022 04:10:44 -0500 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no; s=key1; t=1670404204; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type; bh=70tqKeWbgJMFWiVJMJZ89H96fvyivEqtWa7F/s/px0M=; b=dtrQrO6uKUu1or/jemVJ+sdqgfeQw/Gag4HG1ABZVE9qoUQEpXtgUvA7KiUQVTtqoxLgk4 WzqbnF1PSt0mSNM3Kw6XwFOkIHbRYIJmrAAlDIIgoRVCnPvX2WYInwMpSjHlxC7U5NLsx6 1ZhEtGDcX8c0DXxE3NSFjA90+/kGOxevqWOZ2wTHIWwXOn/la1+RQnyEJh9y30UZXhw53X CMlbD+W1Y95tGswj2Qj5mKLdP3uPuwBOrX2abACVdqK6nUACQqTrmWFARlfhqcf041u12g quu3fOTwHGGTJhdwV3WLb5IhCAlTMKF9/EonQjyhVd95oXBdsi3L+/a0+4BUiA== From: Theodor Thornhill Date: Wed, 07 Dec 2022 10:10:03 +0100 Message-ID: <87sfhrzij8.fsf@thornhill.no> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Migadu-Flow: FLOW_OUT Received-SPF: pass client-ip=2001:41d0:1004:224b::26; envelope-from=theo@thornhill.no; helo=out-38.mta0.migadu.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) --=-=-= Content-Type: text/plain Hi Yuan, Will you please install this patch? Thanks, Theo --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Make-more-granular-defun-type-regexp.patch >From ef79549e793773b50faea9bad2cd35509e5714e1 Mon Sep 17 00:00:00 2001 From: Theodor Thornhill 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 --=-=-=-- From unknown Fri Sep 05 15:34:43 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Theodor Thornhill Subject: bug#59873: closed (Re: bug#59873: 29.0.60; [PATCH]: Make java-ts-mode defun-type-regexp more granular) Message-ID: References: <6B31E685-D07C-46C7-9509-19D6BD9BF132@gmail.com> <87sfhrzij8.fsf@thornhill.no> X-Gnu-PR-Message: they-closed 59873 X-Gnu-PR-Package: emacs X-Gnu-PR-Keywords: patch Reply-To: 59873@debbugs.gnu.org Date: Fri, 09 Dec 2022 21:30:03 +0000 Content-Type: multipart/mixed; boundary="----------=_1670621403-22834-1" This is a multi-part message in MIME format... ------------=_1670621403-22834-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 59873@debbugs.gnu.org. --=20 59873: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D59873 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1670621403-22834-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 59873-done) by debbugs.gnu.org; 9 Dec 2022 21:29:24 +0000 Received: from localhost ([127.0.0.1]:38620 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p3kvs-0005vc-19 for submit@debbugs.gnu.org; Fri, 09 Dec 2022 16:29:24 -0500 Received: from mail-pl1-f172.google.com ([209.85.214.172]:34650) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p3kvp-0005vS-RH for 59873-done@debbugs.gnu.org; Fri, 09 Dec 2022 16:29:22 -0500 Received: by mail-pl1-f172.google.com with SMTP id p24so6225713plw.1 for <59873-done@debbugs.gnu.org>; Fri, 09 Dec 2022 13:29:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:cc:date:message-id:subject:mime-version :content-transfer-encoding:from:from:to:cc:subject:date:message-id :reply-to; bh=gkwdG1NBr6fu8xplIYYk8WdGT5gedHPc4Xmy8JUQTGg=; b=EDj5fW72hOtzIf5L/ojtQKGTe+OYi8S2D0mHXIFKUyhZVGTkfCSpbn1FKfiP5QUEkf 8Ok7iouvJrqSdm9KO+7R9S2lGFwtWayrDoKVYWJse2RiS9m3YRisTptfnoxZVAL259AA OtT1HJEeOqZhWzf+hZt7T/CHbxZ2QMQ9XV6RAIBi6v/MbP+NWWgR0gDOT5oJnzNRMe19 u5VJRHZ0uJncity6Y7mBM5zL7sQsIhdhJ2ZKv8nqethwSJpH3OEhfslfya5LqvxCPX7r 3LAZCqpLDDn0jmIRbEQKMVaydvcNt4LrbCtpnwYex3ilvSRNKFH2ZnoDShrbrjfnDBsa Y6KQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:cc:date:message-id:subject:mime-version :content-transfer-encoding:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gkwdG1NBr6fu8xplIYYk8WdGT5gedHPc4Xmy8JUQTGg=; b=GN4g37mFw8zaygmXl56eXzbKfCyfN9qnOENEoXAVOKlwy7/M0RZaUh5QBwPMW37XOj DGjDEwck0mP7sj1wujdb7IfC8DRm8h6Gtc1ZbZC6hFNQc5krYtHZb6BTCE4LtYEN+SHX C2ulwyozhuxMvKUgg2+9CF2StY6rtFJxdvVT1kTeSgkAZeJ2f2eKAZvW46xiUg/UkV+Q BpDNn5ATTMJApfS54/VkuoDathASnoV/zDpRPAl6vpMKHgk2QaVINBSju3hjP2giGM07 39wwhDC311PmpzZqdGAaQSe/l5lyn5KmJ4jUCxoP13BDw6KMzA6xQyeHqATMLCgEILbd y/XQ== X-Gm-Message-State: ANoB5pkbipEunKc/Cg1WNvqy5yKNkrOd5E2u3MvT7t5gKawiL7Ak0gYY hkQ11rgQAvJL1jSCdvIuxrUN4hKFPOc= X-Google-Smtp-Source: AA0mqf5c5CffaN99oAQ2Yy4lIeu8tl9ZVgZOAzsMSpKTybDoAsWVuEjlXKEbHoQW4USvdAj1VZKISQ== X-Received: by 2002:a17:903:d2:b0:189:cc72:9602 with SMTP id x18-20020a17090300d200b00189cc729602mr5911359plc.18.1670621356195; Fri, 09 Dec 2022 13:29:16 -0800 (PST) Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id b6-20020a170903228600b00188f6cbd950sm1747894plh.226.2022.12.09.13.29.15 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 09 Dec 2022 13:29:15 -0800 (PST) From: Yuan Fu Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.1\)) Subject: Re: bug#59873: 29.0.60; [PATCH]: Make java-ts-mode defun-type-regexp more granular Message-Id: <6B31E685-D07C-46C7-9509-19D6BD9BF132@gmail.com> Date: Fri, 9 Dec 2022 13:29:14 -0800 To: Theodor Thornhill X-Mailer: Apple Mail (2.3696.120.41.1.1) X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 59873-done Cc: 59873-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Theodor Thornhill writes: > Hi Yuan, > > Will you please install this patch? > > Thanks, > Theo Yes, absolutely. Applied! Yuan ------------=_1670621403-22834-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 7 Dec 2022 09:10:59 +0000 Received: from localhost ([127.0.0.1]:48672 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p2qSA-0001EQ-A2 for submit@debbugs.gnu.org; Wed, 07 Dec 2022 04:10:59 -0500 Received: from lists.gnu.org ([209.51.188.17]:39676) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p2qS5-0001EK-9G for submit@debbugs.gnu.org; Wed, 07 Dec 2022 04:10:57 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p2qRw-0002et-UC for bug-gnu-emacs@gnu.org; Wed, 07 Dec 2022 04:10:47 -0500 Received: from out-38.mta0.migadu.com ([2001:41d0:1004:224b::26]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p2qRt-00036L-Fu for bug-gnu-emacs@gnu.org; Wed, 07 Dec 2022 04:10:44 -0500 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no; s=key1; t=1670404204; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type; bh=70tqKeWbgJMFWiVJMJZ89H96fvyivEqtWa7F/s/px0M=; b=dtrQrO6uKUu1or/jemVJ+sdqgfeQw/Gag4HG1ABZVE9qoUQEpXtgUvA7KiUQVTtqoxLgk4 WzqbnF1PSt0mSNM3Kw6XwFOkIHbRYIJmrAAlDIIgoRVCnPvX2WYInwMpSjHlxC7U5NLsx6 1ZhEtGDcX8c0DXxE3NSFjA90+/kGOxevqWOZ2wTHIWwXOn/la1+RQnyEJh9y30UZXhw53X CMlbD+W1Y95tGswj2Qj5mKLdP3uPuwBOrX2abACVdqK6nUACQqTrmWFARlfhqcf041u12g quu3fOTwHGGTJhdwV3WLb5IhCAlTMKF9/EonQjyhVd95oXBdsi3L+/a0+4BUiA== From: Theodor Thornhill To: bug-gnu-emacs@gnu.org Subject: 29.0.60; [PATCH]: Make java-ts-mode defun-type-regexp more granular X-Debbugs-Cc: casouri@gmail.com Date: Wed, 07 Dec 2022 10:10:03 +0100 Message-ID: <87sfhrzij8.fsf@thornhill.no> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Migadu-Flow: FLOW_OUT Received-SPF: pass client-ip=2001:41d0:1004:224b::26; envelope-from=theo@thornhill.no; helo=out-38.mta0.migadu.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) --=-=-= Content-Type: text/plain Hi Yuan, Will you please install this patch? Thanks, Theo --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Make-more-granular-defun-type-regexp.patch >From ef79549e793773b50faea9bad2cd35509e5714e1 Mon Sep 17 00:00:00 2001 From: Theodor Thornhill 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 --=-=-=-- ------------=_1670621403-22834-1--