Subject: bug#50079: 27.2; imenu doesn't work with inline access modifier in ruby

From: christopher flöß <[email-masked]>
Date: Mon, 16 Aug 2021 15:20:26 -0400 (EDT)

While editing a ruby file, invoking imenu with the following class
definition:

class Blub
  def hi
    "Hi!"
  end

  def bye
    "Bye!"
  end

  private def hiding
    "You can't see me"
  end
end

fails to list the private method `hiding`. This is valid ruby and the
method definition has a so-called inline access modifier
(`private`). With the alternative syntax (also valid ruby syntax):

class Blub
  def hi
    "Hi!"
  end

  def bye
    "Bye!"
  end

  private

  def hiding
    "You can't see me"
  end
end

imenu behaves as expected. This problem was first posted to
emacs.stackexchange.com

https://emacs.stackexchange.com/questions/68102/rubyimenu-not-showing-private-methods?noredirect=1#comment107753_68102

Regards,
Chris

In GNU Emacs 27.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.27, cairo version 1.17.4)
of 2021-03-26 built on juergen
Windowing system distributor 'The X.Org Foundation', version 11.0.12012000
System Description: Arch Linux

Recent messages:
Loading /home/chris/.emacs.d/scripts-enabled/.gitkeep...done
Loading /home/chris/.emacs.d/scripts-enabled/circe.el (source)...done
Loading /home/chris/.emacs.d/scripts-enabled/mercury-vars.el (source)...
loading mercury
Loading /home/chris/.emacs.d/scripts-enabled/mercury-vars.el (source)...done
Loading /home/chris/.emacs.d/scripts-enabled/poly-vue.el (source)...done
Loading /home/chris/.emacs.d/scripts-enabled/sql-connections.el (source)...done
Error in defhydra hydra-test-magic: (Each head should have at least two items: nil)
Turning on magit-auto-revert-mode...done
For information about GNU Emacs and the GNU system, type C-h C-a.

Configured using:
'configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib
--localstatedir=/var --with-x-toolkit=gtk3 --with-xft --with-wide-int
--with-modules --with-cairo --with-harfbuzz 'CFLAGS=-march=x86-64
-mtune=generic -O2 -pipe -fno-plt' CPPFLAGS=-D_FORTIFY_SOURCE=2
LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now'

Configured features:
XPM JPEG TIFF GIF PNG RSVG CAIRO SOUND GPM DBUS GSETTINGS GLIB NOTIFY
INOTIFY ACL GNUTLS LIBXML2 FREETYPE HARFBUZZ M17N_FLT LIBOTF ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES THREADS LIBSYSTEMD JSON
PDUMPER LCMS2 GMP

Important settings:
value of $LC_ALL: C
value of $LANG: en_US.UTF-8
value of $XMODIFIERS: @im=ibus
locale-coding-system: nil

Major mode: ruby-mode

Minor modes in effect:
global-company-mode: t
dap-tooltip-mode: t
dap-ui-mode: t
treemacs-filewatch-mode: t
treemacs-follow-mode: t
treemacs-git-mode: deferred
treemacs-fringe-indicator-mode: t
dap-mode: t
which-key-mode: t
global-rbenv-mode: t
projectile-rails-global-mode: t
global-flycheck-mode: t
projectile-mode: t
counsel-mode: t
ivy-mode: t
global-git-commit-mode: t
magit-auto-revert-mode: t
shell-dirtrack-mode: t
override-global-mode: t
global-subword-mode: t
delete-selection-mode: t
global-display-line-numbers-mode: t
global-hl-line-mode: t
savehist-mode: t
show-paren-mode: t
display-time-mode: t
tooltip-mode: t
global-eldoc-mode: t
electric-indent-mode: t
mouse-wheel-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
blink-cursor-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
buffer-read-only: t
column-number-mode: t
line-number-mode: t
transient-mark-mode: t

Load-path shadows:
/home/chris/.emacs.d/elpa/jsonrpc-1.0.14/jsonrpc hides /usr/share/emacs/27.2/lisp/jsonrpc
/home/chris/.emacs.d/elpa/xref-1.1.0/xref hides /usr/share/emacs/27.2/lisp/progmodes/xref
/home/chris/.emacs.d/elpa/project-0.6.0/project hides /usr/share/emacs/27.2/lisp/progmodes/project
/home/chris/.emacs.d/elpa/flymake-1.1.1/flymake hides /usr/share/emacs/27.2/lisp/progmodes/flymake
/home/chris/.emacs.d/elpa/eldoc-1.11.0/eldoc hides /usr/share/emacs/27.2/lisp/emacs-lisp/eldoc

Features:
(shadow sort mail-extr emacsbug sendmail company-oddmuse
company-keywords company-etags etags fileloop generator company-gtags
company-dabbrev-code company-dabbrev company-files company-clang
company-capf company-cmake company-semantic company-template
company-bbdb company hydra ac-solargraph auto-complete popup solargraph
request url url-proxy url-privacy url-expand url-methods url-history
url-cookie url-domsuf mailcap polymode poly-lock polymode-base
polymode-weave polymode-export polymode-compat polymode-methods
polymode-core polymode-classes eieio-custom eieio-base dap-mouse dap-ui
lsp-treemacs lsp-treemacs-themes treemacs treemacs-header-line
treemacs-compatibility treemacs-mode treemacs-interface
treemacs-extensions treemacs-mouse-interface treemacs-tags
treemacs-persistence treemacs-filewatch-mode treemacs-follow-mode
treemacs-rendering treemacs-async treemacs-workspaces treemacs-dom
treemacs-visuals treemacs-fringe-indicator treemacs-scope pulse
treemacs-faces treemacs-icons treemacs-themes treemacs-core-utils
pfuture treemacs-logging treemacs-customization treemacs-macros gdb-mi
bindat gud bui bui-list bui-info bui-entry bui-core bui-history
bui-button bui-utils cus-edit cus-start cus-load lsp-lens dap-mode
dap-launch posframe dap-overlays lsp-ui lsp-ui-flycheck lsp-ui-doc
goto-addr lsp-ui-imenu lsp-ui-peek lsp-ui-sideline face-remap
lsp-ui-util lsp-mode lsp-protocol url-util tree-widget wid-edit spinner
pcase network-stream nsm markdown-mode noutline outline lv inline ht
ewoc yasnippet multiple-cursors mc-separate-operations
rectangular-region-mode mc-mark-pop mc-edit-lines
mc-hide-unmatched-lines-mode mc-mark-more mc-cycle-cursors
multiple-cursors-core rect which-key rspec-mode rbenv projectile-rails
rake f s inflections inf-ruby ruby-mode smie autoinsert flycheck
find-func yaml-imenu yaml-mode projectile grep ibuf-ext ibuffer
ibuffer-loaddefs thingatpt counsel xdg advice xref project compile
swiper ivy ivy-faces ivy-overlay colir color gruvbox-light-medium-theme
gruvbox autothemer magit-submodule magit-obsolete magit-blame
magit-stash magit-reflog magit-bisect magit-push magit-pull magit-fetch
magit-clone magit-remote magit-commit magit-sequence magit-notes
magit-worktree magit-tag magit-merge magit-branch magit-reset
magit-files magit-refs magit-status magit magit-repos magit-apply
magit-wip magit-log which-func imenu magit-diff smerge-mode diff
diff-mode git-commit log-edit message rmc puny dired dired-loaddefs
rfc822 mml mml-sec epa derived epg epg-config gnus-util rmail
rmail-loaddefs text-property-search time-date mm-decode mm-bodies
mm-encode mail-parse rfc2231 rfc2047 rfc2045 mm-util ietf-drums
mail-prsvr mailabbrev mail-utils gmm-utils mailheader pcvs-util add-log
magit-core magit-autorevert autorevert filenotify magit-margin
magit-transient magit-process with-editor shell pcomplete comint ring
server ansi-color magit-mode transient format-spec magit-git
magit-section magit-utils crm dash cl-extra help-mode use-package
use-package-ensure use-package-delight use-package-diminish
use-package-bind-key bind-key easy-mmode use-package-core finder-inf
cap-words superword subword delsel display-line-numbers hl-line savehist
paren time edmacro kmacro rx info package easymenu browse-url
url-handlers url-parse auth-source cl-seq eieio eieio-core cl-macs
eieio-loaddefs password-cache json subr-x map url-vars seq byte-opt gv
bytecomp byte-compile cconv cl-loaddefs cl-lib tooltip eldoc electric
uniquify ediff-hook vc-hooks lisp-float-type mwheel term/x-win x-win
term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode elisp-mode lisp-mode
prog-mode register page tab-bar menu-bar rfn-eshadow isearch timer
select scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame minibuffer cl-generic cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms
cp51932 hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese composite charscript charprop case-table epa-hook
jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice loaddefs
button faces cus-face macroexp files text-properties overlay sha1 md5
base64 format env code-pages mule custom widget hashtable-print-readable
backquote threads dbusbind inotify lcms2 dynamic-setting
system-font-setting font-render-setting cairo move-toolbar gtk x-toolkit
x multi-tty make-network-process emacs)

Memory information:
((conses 16 491770 211664)
(symbols 48 41908 65)
(strings 32 166161 26411)
(string-bytes 1 4909819)
(vectors 16 65430)
(vector-slots 8 774850 224788)
(floats 8 697 1269)
(intervals 56 2225 454)
(buffers 1000 12))