From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Theodor Thornhill via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#59873: 29.0.60; [PATCH]: Make java-ts-mode defun-type-regexp more granular Date: Wed, 07 Dec 2022 10:10:03 +0100 Message-ID: <87sfhrzij8.fsf@thornhill.no> Reply-To: Theodor Thornhill Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="35456"; mail-complaints-to="usenet@ciao.gmane.io" Cc: casouri@gmail.com To: 59873@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Dec 07 10:11:30 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p2qSe-00090q-Br for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 07 Dec 2022 10:11:28 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p2qSI-0002rF-Ky; Wed, 07 Dec 2022 04:11:06 -0500 Original-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 1p2qSH-0002pP-7x for bug-gnu-emacs@gnu.org; Wed, 07 Dec 2022 04:11:05 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p2qSE-0003b7-Sj for bug-gnu-emacs@gnu.org; Wed, 07 Dec 2022 04:11:04 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p2qSE-0001Eg-Iu; Wed, 07 Dec 2022 04:11:02 -0500 X-Loop: help-debbugs@gnu.org 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 X-Debbugs-Original-To: bug-gnu-emacs@gnu.org X-Debbugs-Original-Xcc: casouri@gmail.com Original-Received: via spool by submit@debbugs.gnu.org id=B.16704042594742 (code B ref -1); Wed, 07 Dec 2022 09:11:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 7 Dec 2022 09:10:59 +0000 Original-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 Original-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 Original-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 Original-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== 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-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:250167 Archived-At: --=-=-= 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 --=-=-=--