0

I do not remember changing any thing in my auto-complete package settings beside hooking it with html-mode. The mode starts as expected, when I run some C or C++ code but after typing any thing the mode turns off. I get no errors or warnings.

Here is the related code:

(require 'auto-complete)
(require 'auto-complete-config)
(ac-config-default)

;; initialize auto-complete-c-headers and gets called for c/c++ hooks
(defun my:ac-c-header-init ()
  (require 'auto-complete-c-headers)
  (add-to-list 'ac-sources 'ac-source-c-headers)
  (add-to-list 'ac-sources `ac-source-c))
;; fuction call from c/c++ hooks
(add-hook 'c++-mode-hook 'my:ac-c-header-init)
(add-hook 'c-mode-hook 'my:ac-c-header-init)
(add-hook 'html-mode 'auto-complete-mode)
0

I find this line to be failing: (add-to-list 'ac-sourcesac-source-c))`

The correct code looks like:

(require 'auto-complete)
(require 'auto-complete-config)
(ac-config-default)

;; initialize auto-complete-c-headers and gets called for c/c++ hooks
(defun my:ac-c-header-init ()
  (require 'auto-complete-c-headers)
  (add-to-list 'ac-sources 'ac-source-c-headers))
;; fuction call from c/c++ hooks
(add-hook 'c++-mode-hook 'my:ac-c-header-init)
(add-hook 'c-mode-hook 'my:ac-c-header-init)
(add-hook 'html-mode 'auto-complete-mode)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.