Replace prelude-goto-symbol with imenu-anywhere

This commit is contained in:
Bozhidar Batsov 2016-01-30 12:44:16 +02:00
parent 601db9099e
commit 81cc977b16
3 changed files with 3 additions and 44 deletions

View file

@ -499,48 +499,5 @@ With a prefix argument ARG, find the `user-init-file' instead."
(interactive "P")
(sp-wrap-with-pair ,s)))
;; needed for prelude-goto-symbol
(require 'imenu)
(defun prelude-goto-symbol (&optional symbol-list)
"Refresh imenu and jump to a place in the buffer using Ido."
(interactive)
(cond
((not symbol-list)
(let (name-and-pos symbol-names position)
(while (progn
(imenu--cleanup)
(setq imenu--index-alist nil)
(prelude-goto-symbol (imenu--make-index-alist))
(setq selected-symbol
(completing-read "Symbol? " (reverse symbol-names)))
(string= (car imenu--rescan-item) selected-symbol)))
(unless (and (boundp 'mark-active) mark-active)
(push-mark nil t nil))
(setq position (cdr (assoc selected-symbol name-and-pos)))
(cond
((overlayp position)
(goto-char (overlay-start position)))
(t
(goto-char position)))
(recenter)))
((listp symbol-list)
(dolist (symbol symbol-list)
(let (name position)
(cond
((and (listp symbol) (imenu--subalist-p symbol))
(prelude-goto-symbol 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)
(string= (car imenu--rescan-item) name))
(add-to-list 'symbol-names (substring-no-properties name))
(add-to-list 'name-and-pos (cons (substring-no-properties name) position))))))))
(provide 'prelude-core)
;;; prelude-core.el ends here

View file

@ -32,6 +32,7 @@
;;; Code:
(require 'easymenu)
(require 'imenu-anywhere)
(defvar prelude-mode-map
(let ((map (make-sparse-keymap)))
@ -63,7 +64,7 @@
(define-key map (kbd "C-c TAB") 'prelude-indent-rigidly-and-copy-to-clipboard)
(define-key map (kbd "C-c I") 'prelude-find-user-init-file)
(define-key map (kbd "C-c S") 'prelude-find-shell-init-file)
(define-key map (kbd "C-c i") 'prelude-goto-symbol)
(define-key map (kbd "C-c i") 'imenu-anywhere)
;; extra prefix for projectile
(define-key map (kbd "s-p") 'projectile-command-map)
;; make some use of the Super key

View file

@ -62,6 +62,7 @@
god-mode
grizzl
guru-mode
imenu-anywhere
ov
projectile
magit