Emacs 23.2 in emacs-starter-kit v1 has C-x C-i (or ido-imenu) (similar to Sublime Text's Cmd+R). Emacs24 in emacs-starter-kit v2 lacks this function. I found this github issue and a fix, which try to recreate the functionality. While this ido-imenu works in elisp-mode, it stopped working in ruby-mode. I get:
imenu--make-index-alist: No items suitable for an index found in this buffer
- Has anyone figured out how to get this to work?
- Why was this taken out of Emacs24?
- Is there a new replacement for this function?
So I finally figured it out, after reading the Defining an Imenu Menu for a Mode section on emacs-wiki again.
Short answer: you need to add this bit to your customization. Feel free to add more types to the list (I am happy with just methods).
Longer answer: I first tried to define a
ruby-imenu-generic-expressionfunction and set that toimenu-generic-expressionby using theruby-mode-hook:This however did not work (I would get the same error as before). More reading of the Defining an Imenu Menu for a Mode section showed me the way. Now, I'm not an
elispexpert, so here's my hypothesis: basically, the above method works for modes where theThe example for
foo-modemade it clear how to do it forruby-mode. So it appears thatruby-modedoes not have a buffer-local copy of the realimenu-generic-expressionvariable. I still can't explain why it worked in Emacs 23.2 (with ESK v1) but does not on Emacs24, but hey at least I found a working solution.