Created
May 28, 2009 00:26
-
-
Save bkudria/118998 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun ido-goto-symbol () | |
"Will update the imenu index and then use ido to select a symbol to navigate to" | |
(interactive) | |
(imenu--make-index-alist) | |
(let ((name-and-pos '()) | |
(symbol-names '())) | |
(flet ((addsymbols (symbol-list) | |
(when (listp symbol-list) | |
(dolist (symbol symbol-list) | |
(let ((name nil) (position nil)) | |
(cond | |
((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)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment