Closed maindoor closed 11 years ago
I tried exactly the configurations you posted without reproducing the problem you described, however I noticed a few things that worth mention.
ac-clang-cflags
is buffer local in clang-async, the equivalent code that configs clang-async looks like this:(defun ac-cc-mode-setup ()
(setq ac-clang-complete-executable "~/workset/emacs/pkgs/ac/clang-complete")
(setq ac-clang-cflags
(mapcar (lambda (item)(concat "-I" item))
(split-string
"
/usr/include/c++/4.7
/usr/include/c++/4.7/x86_64-linux-gnu
/usr/include/c++/4.7/backward
/usr/lib/gcc/x86_64-linux-gnu/4.7/include
/usr/local/include
/usr/lib/gcc/x86_64-linux-gnu/4.7/include-fixed
/usr/include/x86_64-linux-gnu
/usr/include
"
)))
(setq ac-sources '(ac-source-clang-async))
(ac-clang-launch-completion-process)
)
That's great this works. One other related question: why doesn't the completion for thread library work ? std iostream related completion works but not the std threads. when i do std::t no completion for threads startup. How to do I tell clang-async that I am passing a std=c++0x during the command line ?
The issue as reported works well. I'll open another issue for thread completion.
Setup everything as given in the help me file. 1) My auto-complete.el that I use to load is attached.
2) When I try to auto-complete I sometimes get unrelated completions as shown in snapshot1.png
2) But when I delete vec and start again, I get the right results as shown in snapshot2.png.
auto-complete.el
(add-to-list 'load-path "~/workset/emacs/pkgs/ac") (add-to-list 'load-path "~/.emacs.d/") (require 'auto-complete-config) (add-to-list 'ac-dictionary-directories "~/.emacs.d//ac-dict") (ac-config-default)
(add-to-list 'load-path "~/.emacs.d/") (require 'auto-complete-config) (add-to-list 'ac-dictionary-directories "~/.emacs.d/ac-dict") (ac-config-default) (require 'auto-complete-clang) (setq clang-completion-suppress-error 't)
;; echo "" | g++ -v -x c++ -E - (setq ac-clang-flags (mapcar (lambda (item)(concat "-I" item)) (split-string " /usr/include/c++/4.7 /usr/include/c++/4.7/x86_64-linux-gnu /usr/include/c++/4.7/backward /usr/lib/gcc/x86_64-linux-gnu/4.7/include /usr/local/include /usr/lib/gcc/x86_64-linux-gnu/4.7/include-fixed /usr/include/x86_64-linux-gnu /usr/include " )))
(defun my-ac-clang-mode-common-hook() (define-key c-mode-base-map (kbd "M-/") 'ac-complete-clang) )
(add-hook 'c-mode-common-hook 'my-ac-clang-mode-common-hook)
(require 'auto-complete-clang-async)
(defun ac-cc-mode-setup () (setq ac-clang-complete-executable "~/workset/emacs/pkgs/ac/clang-complete") (setq ac-sources '(ac-source-clang-async)) (ac-clang-launch-completion-process) )
(defun my-ac-config () (add-hook 'c-mode-common-hook 'ac-cc-mode-setup) (add-hook 'auto-complete-mode-hook 'ac-common-setup) (global-auto-complete-mode t))
(my-ac-config)
What is wrong here ?
![snapshot2](https://f.cloud.github.com/assets/3489239/130625/32329aa8-702c-11e2-8336-5f20d5ec43d3.png)