From 2268dfc27a90bc9a9d39046bf7deb20e7b635dcd Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Thu, 25 May 2023 00:14:46 -0700 Subject: [PATCH] [oni-groovy] Add regexp for top-level functions In the Groovy used with Jenkins it seems quite common for there to be top-level functions that aren't explicitly in classes (they still are implicitly). --- oni-groovy.el | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/oni-groovy.el b/oni-groovy.el index b8f5211..57844a8 100644 --- a/oni-groovy.el +++ b/oni-groovy.el @@ -4,7 +4,7 @@ ;; Author: Tom Willemse ;; Keywords: local -;; Version: 2022.0926.132722 +;; Version: 2023.0505.164419 ;; Package-Requires: (groovy-mode oni-embrace oni-smartparens groovy-imports rainbow-delimiters jenkinsfile-mode) ;; This program is free software; you can redistribute it and/or modify @@ -88,5 +88,13 @@ (with-eval-after-load 'grep (add-to-list 'grep-files-aliases '("groovy" . "*.groovy *.pipeline Jenkinsfile"))) +(setf (alist-get "Functions" groovy-imenu-regexp nil nil #'string=) + (list (rx line-start "def" + (minimal-match (one-or-more whitespace)) + (group alpha (minimal-match (zero-or-more alphanumeric))) + (minimal-match (zero-or-more whitespace)) + "(") + 1)) + (provide 'oni-groovy) ;;; oni-groovy.el ends here