Hi,
I'm using Emacs with CEDET and auto complete for code completion. Originally I set up CEDET so it loads at Emacs start up every time.
However, this took quite a long time, so i thought it would be clever to load it just if needed, i.e. - in my case - when entering C++-Mode.
So I moved the original function into a lambda
that is called when entering C++-mode:
; cscope for c(++) programming (finding symbols, etc.)
(require 'xcscope)
; C++ stuff
(add-hook 'c++-mode-hook
(lambda ()
(load-file "/usr/share/emacs/site-lisp/cedet-common/cedet.el")
(global-ede-mode 1) ; enable project management system
(semantic-load-enable-code-helpers) ; enable prototype help and smart completion
(require 'auto-complete-config)
(add-to-list 'ac-dictionary-directories "~/elisp/ac-dict")
(add-to-list 'ac-sources 'ac-source-semantic)
(local-set-key (kbd "C-:") 'semantic-ia-complete-symbol-menu) ; set shortcut for auto completion.
(local-set-key (kbd "C-.") 'ac-complete-semantic)
(ac-config-default)
)
)
There are no errors, but I have the following problem: When Emacs enters C++-mode for the first time, code completion does not work properly. But if Emacs enters C++-mode the second time, everything works just fine.
Does anybody know what I'm doing wrong?