Quickly jumping to symbols

This is brilliant.

For a while, I have been using ido to quickly jump between buffers and files by just typing any part of the file/buffer name I want. In fact, typing any sequence of letters narrows the interactive search to candidates with names that contain those letters in that order:

fb -> Foobar, FrancisGailBrown

But for finding method definitions in a big source file, I have always just used isearch. It turns out that there is a better way.

By combining imenu with ido, I can quickly find methods as well:

All it takes is this method in my init.el:

(defun ido-goto-symbol ()
"Will update the imenu index and then use ido to select a
symbol to navigate to"
(let ((name-and-pos '())
(symbol-names '()))
(flet ((addsymbols (symbol-list)
(when (listp symbol-list)
(dolist (symbol symbol-list)
(let ((name nil) (position nil))
((and (listp symbol) (imenu--subalist-p symbol))
(addsymbols symbol))

((listp symbol)
(setq name (car symbol))
(setq position (cdr symbol)))

((stringp symbol)
(setq name symbol)
(setq position (get-text-property 1 'org-imenu-marker symbol))))

(unless (or (null position) (null name))
(add-to-list 'symbol-names name)
(add-to-list 'name-and-pos (cons name position))))))))
(addsymbols imenu--index-alist))
(let* ((selected-symbol (ido-completing-read "Symbol? " symbol-names))
(position (cdr (assoc selected-symbol name-and-pos))))
(goto-char position))))

I have bound it to C-t, because I realized that I don't use transpose-chars (or whichever transpose method was there..I don't use any of those, really).

I found this trick on the imenu wiki page.