2
votes

While referring to this webpage, I installed auto-complete-clang-async.el to Emacs. Apparently, auto-completion works when I create a new file.(shown below) But it doesn't work when I saved the file and open it again on emacs. Does anyone know why it happens and how it should be fixed?

Any help would be appreciated. Thanks in advance.

enter image description here

I use Emacs24.3.1 on Ubuntu12.04, which is accessed from Windows 8.1 machine via ssh. clang's version is 3.5. clang-complete binary is build with llvm-config-3.5.

Here is my emacs configuration in .emacs.d/init.el.

(defun add-to-load-path (&rest paths)
  (let (path)
    (dolist (path paths paths)
      (let ((default-directory
              (expand-file-name (concat user-emacs-directory path))))
        (add-to-list 'load-path default-directory)
        (if (fboundp 'normal-top-level-add-subdirs-to-load-path)
            (normal-top-level-add-subdirs-to-load-path))))))

(add-to-load-path "elisp" "conf" "public_repos" "elpa" )

(require 'auto-complete-clang-async)

(defun ac-cc-mode-setup ()
  (setq ac-clang-complete-executable "~/.emacs.d/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)

I put the .el file in .emacs.d/elisp directory. There is clang-complete executable in .emacs.d/ directory.

1
Can you show us your auto-complete-clang-async configuration?elemakil
@elemakil Thank you for your comment. I've uploaded my configuration.yufit_in_Japan

1 Answers

2
votes

Even though I don't understand why it happens, I've discovered the solution. When auto-completion doesn't work properly, you have to save your current buffer. (Command: C-x C-s) Then the functionality will be effective again.