How I can replace auto-complete-mode with company-mode in all major mode using it?

i.e. make all modes which activating auto-complete-mode (e.g. c-mode or sh-mode etc), activate company-mode instead (and don't activate auto-complete-mode).

  • c-mode and sh-mode don't activate auto-complete-mode, there must be something in your config doing that...
    – npostavs
    Commented Dec 25, 2016 at 3:50
  • maybe my distribution it configured differently (i'm using Fedora) Commented Dec 25, 2016 at 4:01
  • emacs -q ~/.emacs turns on AC, but emacs -Q ~/.emacs doesn't. Commented Dec 25, 2016 at 4:08

2 Answers 2


Uninstall emacs-auto-complete using yum or dnf and install company using the emacs package manager. Turn company on with (global-company-mode) ur use *mode-hooks to turn it on for specific modes.


Fedora supplies some system-wide init files which turns on AC mode on some major modes.
this will do what I asked in the question:

(require 'company)
(add-hook 'prog-mode-hook 'company-mode)
(defun my_auto-complete-mode-hook_1 ()
                     (when auto-complete-mode (auto-complete-mode 0))
                     (company-mode 1))
(add-hook 'auto-complete-mode-hook 'my_auto-complete-mode-hook_1)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.