1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-06 06:20:55 -08:00

ruby-mode imenu: Support methods with modifiers

* lisp/progmodes/ruby-mode.el (ruby-imenu-create-index-in-block):
Support methods with modifiers (visibility or otherwise)
(bug#50079).
This commit is contained in:
Dmitry Gutov 2021-08-17 04:07:19 +03:00
parent fd7f2077bc
commit 9e2cc406d3
2 changed files with 24 additions and 2 deletions

View file

@ -679,7 +679,7 @@ It is used when `ruby-encoding-magic-comment-style' is set to `custom'."
(let ((index-alist '()) (case-fold-search nil)
name next pos decl sing)
(goto-char beg)
(while (re-search-forward "^\\s *\\(\\(class\\s +\\|\\(class\\s *<<\\s *\\)\\|module\\s +\\)\\([^(<\n ]+\\)\\|\\(def\\|alias\\)\\s +\\([^(\n ]+\\)\\)" end t)
(while (re-search-forward "^\\s *\\(\\(class\\s +\\|\\(class\\s *<<\\s *\\)\\|module\\s +\\)\\([^(<\n ]+\\)\\|\\(\\(?:\\(?:private\\|protected\\|public\\) +\\)?def\\|alias\\)\\s +\\([^(\n ]+\\)\\)" end t)
(setq sing (match-beginning 3))
(setq decl (match-string 5))
(setq next (match-end 0))
@ -689,7 +689,7 @@ It is used when `ruby-encoding-magic-comment-style' is set to `custom'."
((string= "alias" decl)
(if prefix (setq name (concat prefix name)))
(push (cons name pos) index-alist))
((string= "def" decl)
((not (null decl))
(if prefix
(setq name
(cond