3

Could anyone help me out in configuring auto-complete-clang for Emacs on Ubuntu? I am a newbie to Emacs. I have auto-complete working, and Yasnippet, and i can also compile code with clang++, i just can't get auto-complete-clang to work. Any help in this configuration would be appreciated.

right now my .emacs file looks like:

;; Auto Complete
(add-to-list 'load-path
        "~/.emacs.d/elpa/auto-complete-20130724.1750/")
(require 'auto-complete-config)
(add-to-list 'load-path
        "~/.emacs.d/elpa/auto-complete-20130724.1750/dict/")
(ac-config-default)
;; Yasnippet
(add-to-list 'load-path
        "~/.emacs.d/elpa/yasnippet-20131014.928/")
(require 'yasnippet)
(yas-global-mode 1)
;; Autocomplete Clang
(add-to-list 'load-path
        "~/.emacs.d/elpa/auto-complete-clang-20120612.2224/")
(require 'auto-complete-config)
(require 'auto-complete-clang)
paprika
  • 2,424
  • 26
  • 46
anacy
  • 399
  • 4
  • 14
  • Can you show your steps which you followed to configure? So that here others can help you. – Smile Oct 23 '13 at 04:10
  • the auto-complete in emacs? – anacy Oct 23 '13 at 04:19
  • I dont know why it's running all the code together like this – anacy Oct 23 '13 at 04:24
  • You're welcome. If you prefix all that with `(setq package-enable-at-startup nil) (package-initialize)` you should then be able to *remove* all of those `load-path` manipulations (and possibly the `require`s as well, although I'm not certain about that). See [Emacs 24 Package System Initialization Problems](http://stackoverflow.com/questions/11127109/emacs-24-package-system-initialization-problems). You should also elaborate on exactly what doesn't work. – phils Oct 23 '13 at 04:54
  • 1
    oh, ok... It just doesnt seem to give me any clang auto-complete options. The auto-complete works the same even if i take out the auto-complete-clang file – anacy Oct 23 '13 at 05:06
  • 2
    Some reading on clang autocompletion suggests that you'd need to have a project / makefile for the compiler to make some sense of your code. Some more debugging you could do, in the buffer with your code: `M-: ac-sources` if it lists something that has `clang` in it, you are fine. Another thing to try: `C-h f ac-clang-candidate` then instrument it for debugging: `C-u C-c f` and see if it is entered when autocompleting something in your code. –  Oct 23 '13 at 10:53
  • ok cool, thank you i appreciate it.. i may have gotten it working, but im not sure... i dont know what i really did, but last night it seemed like it was mainly giving me c++ autocomplete options... I'll wait till tonight to try out @wvxvw's suggestion before i close the questoin though – anacy Oct 23 '13 at 20:26

1 Answers1

0

Im not really sure what i did, but it is working now.. I reall just changed the key-binding to call auto-complete clang, and added auto-complete-clang to my autocomplete sources( which wasn't working initially ), but all seems to be well now.. Thanks for all the advice.

anacy
  • 399
  • 4
  • 14