Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Emacs disable auto-complete in python-mode

Tags:

emacs

I am using Emacs 24 and would like to disable auto-complete mode while in python-mode so it does not conflict with jedi. How do I go about doing this (sadly I do not know Emacs Lisp). Below are my current settings regarding auto-complete in init.el:

;; auto-complete settings
(require 'auto-complete)
(add-to-list 'ac-dictionary-directories "~/.emacs.d/ac-dict")
(require 'auto-complete-config)
(ac-config-default)
; Start auto-completion after 2 characters of a word
(setq ac-auto-start 2)
; case sensitivity is important when finding matches
(setq ac-ignore-case nil)

Thanks.

like image 282
i_trope Avatar asked Jul 17 '14 23:07

i_trope


2 Answers

(ac-config-default) turns on global-auto-complete-mode, to stop (auto-complete-mode) from being called in python mode you can write an advice for it.

(defadvice auto-complete-mode (around disable-auto-complete-for-python)
  (unless (eq major-mode 'python-mode) ad-do-it))

(ad-activate 'auto-complete-mode)

Also I am not sure this is what you want, since Jedi use auto-complete-mode as Dmitry pointed out in the comment, there should not be conflicts.

like image 67
yngccc Avatar answered Oct 21 '22 16:10

yngccc


I think I had a similar problem: my yellow Jedi popups with Python-specific content were taken over by grey popups from a more general auto-complete feature. Hence, I could choose non-Python related options, but not the Python-specific ones.

What helped for me was ensuring that auto-complete-mode is disabled in Python mode:

(add-hook 'python-mode-hook (lambda () (auto-complete-mode -1)))
like image 5
AstroFloyd Avatar answered Oct 21 '22 16:10

AstroFloyd