From: Theodor Thornhill via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: 59873@debbugs.gnu.org
Cc: casouri@gmail.com
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 [thread overview]
Message-ID: <87sfhrzij8.fsf@thornhill.no> (raw)
[-- Attachment #1: Type: text/plain, Size: 62 bytes --]
Hi Yuan,
Will you please install this patch?
Thanks,
Theo
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Make-more-granular-defun-type-regexp.patch --]
[-- Type: text/x-diff, Size: 1459 bytes --]
From ef79549e793773b50faea9bad2cd35509e5714e1 Mon Sep 17 00:00:00 2001
From: Theodor Thornhill <theo@thornhill.no>
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
next reply other threads:[~2022-12-07 9:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-07 9:10 Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2022-12-09 21:29 ` bug#59873: 29.0.60; [PATCH]: Make java-ts-mode defun-type-regexp more granular Yuan Fu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87sfhrzij8.fsf@thornhill.no \
--to=bug-gnu-emacs@gnu.org \
--cc=59873@debbugs.gnu.org \
--cc=casouri@gmail.com \
--cc=theo@thornhill.no \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.