Emacs semantic + auto-complete-mode for C
I am working on getting the automatic full semantics mode working, but know that I am completely stuck. I successfully got semantic autocomplete with semantic-complete character (although for some reason it can't complete malloc () which is weird).
Some snippets of .emacs:
(add-to-list 'ac-dictionary-directories "~/emacs-src/auto-complete-1.3.1/")
(ac-config-default)
(ac-set-trigger-key "TAB")
(add-to-list 'ac-sources 'ac-source-semantic)
(add-to-list 'ac-sources 'ac-source-gtags)
(add-hook 'c-mode-hook
(defun my-c-mode-hook ()
(auto-complete-mode)
(setq ac-sources '(ac-source-semantic))
(ac-complete-semantic)))
How can I work with an automatic complete way with Semantic?
source to share
If I understand you correctly, Semantic is working and you are struggling with the autocomplete setting. To do this, just start with
(require 'auto-complete-config)
(setq-default ac-sources '(ac-source-semantic-raw))
Note that you need to use "setq-default" to set AC sources. Then you can do
M-x auto-complete-mode
in C / C ++ buffer and autocomplete should ask Semantic for completions.
source to share
Try debugging autocomplete with:
M-x semantic-analyze-debug-assist RET
and see what he says. Take a look \include\stdlib.h
to see what the parser thinks about the file. If you do there:
M-x bovinate RET
then you can find if there is malloc
. If not, there may be a parsing error or some other error #define
that is not configured correctly. Using the above, you can usually search in the header file to see where things start to break down.
source to share