summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorDmitry Gutov <dgutov@yandex.ru>2021-08-17 04:07:19 +0300
committerDmitry Gutov <dgutov@yandex.ru>2021-08-17 04:07:19 +0300
commit9e2cc406d3bc1a1f2f6008059091b9c1b8f12acf (patch)
tree385f086a24cd43b3a42d5dfbf3cd6da689422c0c /lisp
parentfd7f2077bc6165cfb3844d8be475ae056c80c4db (diff)
downloademacs-9e2cc406d3bc1a1f2f6008059091b9c1b8f12acf.tar.gz
emacs-9e2cc406d3bc1a1f2f6008059091b9c1b8f12acf.tar.bz2
emacs-9e2cc406d3bc1a1f2f6008059091b9c1b8f12acf.zip
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).
Diffstat (limited to 'lisp')
-rw-r--r--lisp/progmodes/ruby-mode.el4
1 files changed, 2 insertions, 2 deletions
diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el
index 74b48ca4bde..c09f007a5ee 100644
--- a/lisp/progmodes/ruby-mode.el
+++ b/lisp/progmodes/ruby-mode.el
@@ -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