Skip to content

Instantly share code, notes, and snippets.

@bamanzi
Created August 9, 2012 14:05
Show Gist options
  • Save bamanzi/3304484 to your computer and use it in GitHub Desktop.
Save bamanzi/3304484 to your computer and use it in GitHub Desktop.
[emacs] get rid of cedet's imenu creator
(defun bmz/restore-imenu-index-function ()
"Restore `imenu-create-index-function' for current major-mode.
Note this would reset to `imenu-default-create-index-function', but some modes
have its own implementation."
(interactive)
(let* ((func-name (cond
((eq major-mode 'python-mode)
'python-imenu-create-index)
((eq major-mode 'js2-mode)
'js2-mode-create-imenu-index)
((eq major-mode 'espresso-mode)
'espresso--imenu-create-index)
(t
'imenu-default-create-index-function))))
(eval `(setq-mode-local ,major-mode imenu-create-index-function
func-name))
(setq imenu-create-index-function func-name)))
(add-hook 'python-mode-hook 'bmz/restore-imenu-index-function)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment