9

I've been having a problem for a while, and it's giving me a real headache. I'm using emacs 24.2.1

The next code is my configuration for auto-complete, and when I run it without yasnippet everything is running smoothly.

(add-to-list 'load-path "~/.emacs.d/autocomplete/")
(require 'auto-complete-config)
(add-to-list 'ac-dictionary-directories "~/.emacs.d/autocomplete/ac-dict")
(ac-config-default)

This is my configuration for yasnippets

(add-to-list 'load-path "~/.emacs.d/yasnippet")
(require 'yasnippet)
(yas/global-mode t)

After this code, yasnippet works fine but auto-complete stops working for c-mode, c++-mode, java-mode and php-mode, but it's working well with lisp and python (I've tested only with these languages).

I've tried things that I've found like this code for autocomplete

(set-default 'ac-sources
             '(ac-source-abbrev
               ac-source-dictionary
               ac-source-yasnippet
               ac-source-words-in-buffer
               ac-source-words-in-same-mode-buffers
               ac-source-semantic))

(ac-config-default)

(dolist (m '(c-mode c++-mode java-mode))
  (add-to-list 'ac-modes m))

(global-auto-complete-mode t)

After some time I realized that auto-complete was working well when I don't have yasnippet, so that's not the solution. I've also tried (yas/initialize) and (yas--initialize) but it's not making any difference. I've also launch yasnippets before and after autocomplete, and the result is the same. I've also tried modifying the yas/trigger-key variable, and always I have the same result. Hopefully you can help me.

silgon
  • 6,890
  • 7
  • 46
  • 67
  • What versions of auto-complete and yasnippet are you using? At one time, the latest yasnippet and ac-source-yasnippet did not work together, though I'm not sure if that's still the case. I set ac-source-yasnippet to nil in my init.el. – jpkotta Apr 04 '13 at 22:32
  • It's working with that!!! thanks, still I'm going to search a little bit further, because it's kind of weird to have ac-source-yasnippet set to nil. Isn't there any trouble because of that in your configuration? – silgon Apr 13 '13 at 09:49
  • It is kind of weird, but I don't think it causes problems for me. Both yasnippet and autocomplete work fine. Looking at the source code, it seems like removing it from ac-sources (which is buffer local) might be more correct. – jpkotta Apr 15 '13 at 22:18
  • Ok, not problem has been generated until now, thanks a lot! – silgon Apr 18 '13 at 13:03

1 Answers1

9

As jpkotta said, I just set my ac-source-yasnippet to nil and that was it.

(setq ac-source-yasnippet nil)
silgon
  • 6,890
  • 7
  • 46
  • 67