4.3 Auto-Completion Mode
When the auto-completion minor mode is enabled by calling the
auto-completion-mode command, predictive mode will
automatically look for completions of words as you type. This is
especially useful when used in conjunction with dynamic completion
(see Dynamic Completion). If you would like
auto-completion-mode to be enabled automatically whenever
predictive mode is enabled, set the predictive-auto-complete
variable (set by default). Otherwise, you will not only have to enable
auto-completion-mode manually, but also manually set the
auto-completion-source to the predictive
setting.
- auto-completion-mode
- Enable auto-completion Mode. In this minor mode, completions are found
automatically as words are typed.
- predictive-auto-complete
- When non-nil (the default), enabling and disabling predictive mode will
also automatically enable or disable auto-completion-mode, without
needing to run the auto-completion-mode command manually.
- auto-completion-source
- If predictive-auto-complete is not enabled, then you must
set this variable manually to the
predictive
setting in order to
use predictive auto-completion.
Word-constituent characters are added to the current word before finding
new completions. The current syntax table (see Syntax) determines which characters are word-constituents and
which are not (although the behaviour of individual characters can be
overridden).
By customizing auto-completion-syntax-alist, you can make
punctuation and white-space characters automatically accept the current
completion. If you want to exceptionally insert a punctuation character
as though it were a word-constituent (such as the ‘.’ in
‘e.g.’), you can often prefix the character key with M-. The
bindings M-. and M--
are already set up by default, but you can easily add more using the
completion-define-word-constituent-binding convenience
function in your .emacs file. See Character Syntax and Key Bindings, for more details about the syntax and key binding features.
The following variables affect the behaviour of
auto-completion-mode:
- auto-completion-syntax-alist
- Whether auto-completion-mode allows you to type normally,
ignoring the provisional completions until you want to use one (select
‘type normally’ in the customization buffer), or whether
punctuation characters automatically accept the current provisional
completion before the character is inserted (select ‘punctuation
accepts’ in the customization buffer). For full details, see
Character Syntax and Key Bindings.
- auto-completion-min-chars
- Minimum number of characters that must be typed before the various
completion mechanisms are activated when using
auto-completion-mode. Note that you can still explicitly
invoke completion on a shorter prefix using the
complete-predictive command (see Inserting Completions).
- auto-completion-delay
- Number of seconds Emacs must be idle before the various completion
mechanisms are activated when using
auto-completion-mode (see Auto-Completion Mode).
- auto-completion-backward-delete-delay
- Number of seconds Emacs must be idle after a backwards deletion
(see Deleting Characters) before the various completion mechanisms
are activated when using auto-completion-mode
(see Auto-Completion Mode). Having a small delay is useful when the
delete key is held down continuously. Default is 0.1 seconds.