I am just starting to experiment with Yasnippet, and it worked very well until I tried to combine it with auto-complete-mode
. The problem is that Auto-Complete is taking over completely. For example, in c-mode
I can type pr
and then press TAB to expand a printf
snippet, but after activating auto-complete-mode
this does not work, but auto-complete-mode
itself works just fine. Instead, I would like to have Yasnippet to have priority over Auto-Complete when I press the TAB key.
I am using Emacs 24.4 on Ubuntu 14.04, Yasnippet version: 0.8.1, and Auto-Complete version 1.5.0.
Here is minimal example
$ emacs -Q -l init.el t.c
where init.el
is:
(require 'package)
(package-initialize)
(setq package-enable-at-startup nil)
(yas-global-mode 1)
(require 'auto-complete-config)
(add-to-list 'ac-dictionary-directories "~/.emacs.d/ac-dict")
(ac-config-default)
(add-to-list 'ac-sources 'ac-source-yasnippet)
If I now type pr
and then press TAB, I get the Auto-Complete popup menu, (whereas I would like to expand the printf
snippet instead). If I type M-x auto-complete-mode
to turn off auto-complete-mode
and then type pr
and TAB, the printf
snippet expands as expected.
Other information:
C-h v RET ac-source-yasnippet
gives:
((depends yasnippet)
(candidates . ac-yasnippet-candidates)
(action . yas/expand)
(candidate-face . ac-yasnippet-candidate-face)
(selection-face . ac-yasnippet-selection-face)
(symbol . "a"))
C-h v RET ac-sources
gives:
(ac-source-yasnippet ac-source-gtags ac-source-abbrev ac-source-dictionary ac-source-words-in-same-mode-buffers)
- Clearing
ac-source-yasnippet
variable ((setq ac-source-yasnippet nil)
) does not help.
References: