If I set

(ac-set-trigger-key "C-o")

in .emacs, C-o does trigger auto-completion but TAB still does too. It seems that C-o is added to the triggers, while I want it to substitute TAB, so that when I press TAB no auto-completion is performed.

With YASnippet you can do something like:

(define-key yas-minor-mode-map (kbd "TAB") nil)

So that the binding is removed, is there something similar for auto-complete?

1 Answer 1


auto-complete defines three keymaps that might be relevant here:

  • ac-mode-map: This map is active when auto-complete-mode is enabled. ac-set-trigger-key adds the binding for the trigger key to this map.

  • ac-completing-map: This map is active during completion. By default, TAB is bound to ac-expand in this map.

  • ac-menu-map: This map is active while the popup showing possible completions is displayed (in addition to ac-completing-map), but only if ac-use-menu-map is set to a non-nil value.

If you want to make sure TAB won't do anything that's even remotely related to completion, you should probably "unset" the bindings in all of these maps (using the same technique you demonstrate for yas-minor-mode-map in your question).


Here is a minimal configuration that keeps TAB from doing completion:

(require 'auto-complete-config)
(define-key ac-mode-map (kbd "TAB") nil)
(define-key ac-completing-map (kbd "TAB") nil)
(define-key ac-completing-map [tab] nil)

You can try it out by starting Emacs via emacs -Q, copying the code into the *scratch* buffer and running M-x eval-buffer RET.

  • thanks for your reply, after adding: (define-key ac-mode-map (kbd "TAB") nil) (define-key ac-completing-map (kbd "TAB") nil) (define-key ac-menu-map (kbd "TAB") nil) to my .emacs file TAB still does trigger auto-completion. Am I doing something wrong?
    – d-cmst
    Commented Nov 28, 2014 at 21:53
  • @dcmst I added a minimal configuration that does what you want to my answer.
    – itsjeyd
    Commented Nov 29, 2014 at 11:45
  • fyi for who is wondering: ‘-Q’ ‘--quick’ Start emacs with minimum customizations. This is similar to using ‘-q’, ‘--no-site-file’, ‘--no-site-lisp’, and ‘--no-splash’ together. This also stops Emacs from processing X resources by setting inhibit-x-resources to t (see Resources). From: Emacs Manual: Initial Options
    – mmlac
    Commented Feb 19, 2016 at 20:51

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.