1

I've installed auto-complete inside emacs using elpa and have used M-x auto-complete-mode to check that it is enabled. However when I write the following short C code in emacs and put my cursor in front of the v and press the TAB key nothing happens.

Is this not the correct key or is there something wrong with my setup?

int main(void){
  varA = 5;
  varB = 7;

 v

 return 0;

}

The contents of my .emacs.d/elpa/ directory are:

  • archives
  • auto-complete-20160329.2321
  • popup-20160409.2133

And my emacs.d/init.el contains

(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(inhibit-startup-screen t))
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 )
(require 'package) ;; You might already have this line
(add-to-list 'package-archives
             '("melpa" . "https://melpa.org/packages/"))
(when (< emacs-major-version 24)
  ;; For important compatibility libraries like cl-lib
  (add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/")))
(package-initialize) ;; You might already have this line

(require 'auto-complete)
(global-auto-complete-mode t)

(require 'auto-complete-config)
(ac-config-default)
2
  • 1
    What happens if you put the cursor after v?
    – Drew
    Apr 16, 2016 at 14:13
  • Ahhh, your comment helped me solve it, it is working, it's just that you need to type more than 1 character. Putting my cursor after v caused nothing to happen, typing va and putting my cursor after that brought up the auto-complete window, Thanks! Apr 17, 2016 at 14:49

1 Answer 1

1

Drew helped me solve it, you need to type more than 1 character for the auto-complete window to appear, it is installed ok, just wasn't using it correctly. This makes sense since you might be wanting to type int or something and wouldn't want a window to come up every time you typed a single character.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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