Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

emacs 24 autocomplete yasnippet

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.

like image 469
silgon Avatar asked Apr 02 '13 21:04

silgon


1 Answers

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

(setq ac-source-yasnippet nil)
like image 84
silgon Avatar answered Oct 23 '22 21:10

silgon