I installed auto-complete using the marmalade repo. Everything installed correctly and after moving stuff around I managed to start up and run auto-correct without any errors with the following code in my init.el:
;; auto-complete
(add-to-list 'load-path "~/.emacs.d/elpa/auto-complete")
(require 'auto-complete-config)
(add-to-list 'ac-dictionary-directories "~/.emacs.d/elpa/auto-complete/dict")
(ac-config-default)
Now I can use auto-complete with no hick-ups with Emacs Lisp but whenever I use any other mode, like, Java, C, or C++ it doesn't work at all.
I have yasnippet installed too (it works perfectly), not sure if that might have anything to do with it. Here's the relevant code in my init.el:
;;yasnippet
(add-to-list 'load-path
"~/.emacs.d/plugins/yasnippet")
(require 'yasnippet)
(yas-global-mode 1)
I am in the process of learning Emacs and currently I'm still a noob. I've been looking all over the documentation and SO but haven't found anything. I'd really appreciate any help whatsoever on this.
You may need to add completion sources. Here's what's in my config:
(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))
Update: ac-config-default
should cover this, but if autocomplete isn't activating for those modes, try putting the following in your init.el:
(dolist (m '(c-mode c++-mode java-mode))
(add-to-list 'ac-modes m))
(global-auto-complete-mode t)
Update2: I've posted a gist that adapts your init.el to pull autocomplete using package-install
.
I can't tell what version of auto-complete you were referencing, but the latest is working fine for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With