This article will describe using auto-complete package which is common package for auto complete.
Table of Contents
1 Install auto-complete package
Install auto-complete package with M-x package-list-packages.
auto-complete 1.5.0 installed Auto Completion for GNU Emacs
2 ${HOME}/.emacs
Load auto-complete and auto-complete-config with require.
(require 'auto-complete) (require 'auto-complete-config)
Enabling global-auto-complete-mode will call auto-complete automatically. And binding ac-next to "\M-TAB" will call auto-complete manually. This is useful for calling auto-complete again when canceled auto-complete.
(global-auto-complete-mode t) (global ac-complete-mode-map "\M-TAB" 'ac-next)
Binding ac-next and ac-previous will select candidate list.
(define-key ac-complete-mode-map "\C-n" 'ac-next) (define-key ac-complete-mode-map "\C-p" 'ac-previous)
3 Execution result
When there are foo and foobar function, "fo" will call candidate list of "foo" and "foobar".