Usually completion happens in the minibuffer. But one kind of completion is available in all buffers: completion for symbol names.
The character M-TAB runs a command to complete the partial symbol before point against the set of meaningful symbol names. Any additional characters determined by the partial name are inserted at point.
If the partial name in the buffer has more than one possible completion and they have no additional characters in common, a list of all possible completions is displayed in another window.
There are two ways of determining the set of legitimate symbol names
to complete against. In most major modes, this uses a tags table
(see section Tags Tables); the legitimate symbol names are the tag names listed in
the tags table file. The command which implements this is
In Emacs-Lisp mode, the name space for completion normally consists of
nontrivial symbols present in Emacs--those that have function
definitions, values or properties. However, if there is an
open-parenthesis immediately before the beginning of the partial symbol,
only symbols with function definitions are considered as completions.
The command which implements this is
In Text mode and related modes, M-TAB completes words based on the spell-checker's dictionary. See section Checking and Correcting Spelling.