python: use semantic for imenu only when semantic-mode is on

This commit is contained in:
Bar Magal 2015-08-08 14:48:59 +03:00 committed by syl20bnr
parent 987d731916
commit 84c1967594

View file

@ -234,7 +234,20 @@
(define-key inferior-python-mode-map (kbd "C-l") 'comint-clear-buffer))
;; add this optional key binding for Emacs user, since it is unbound
(define-key inferior-python-mode-map (kbd "C-c M-l") 'comint-clear-buffer))))
(define-key inferior-python-mode-map (kbd "C-c M-l") 'comint-clear-buffer)
;; fix for issue #2569 (https://github.com/syl20bnr/spacemacs/issues/2569)
;; use `semantic-create-imenu-index' only when `semantic-mode' is enabled,
;; otherwise use `python-imenu-create-index'
(defun python/imenu-create-index-python-or-semantic ()
(if (bound-and-true-p semantic-mode)
(semantic-create-imenu-index)
(python-imenu-create-index)))
(defadvice wisent-python-default-setup
(after python/set-imenu-create-index-function activate)
(setq imenu-create-index-function
#'python/imenu-create-index-python-or-semantic)))))
(defun python/post-init-flycheck ()
(add-hook 'python-mode-hook 'flycheck-mode))