27.8 Completion for Symbol Names

Completion is normally done in the minibuffer (see Completion), but you can also complete symbol names in ordinary Emacs buffers.

In most programming language modes, C-M-i (or M-TAB16) invokes the command completion-at-point, which generates the list of possible completions for the symbol at point. This command uses the available support facilities to come up with the completion candidates:

In all other respects, in-buffer symbol completion behaves like minibuffer completion. For instance, if Emacs cannot complete to a unique symbol, it displays a list of completion alternatives in another window. Then you can use the keys M-DOWN and M-UP to navigate through the completions displayed in the completions buffer without leaving the original buffer, and the key M-RET to insert the currently highlighted completion to the buffer. See Completion.

In Text mode and related modes, M-TAB completes words based on the spell-checker’s dictionary. See Checking and Correcting Spelling.



On graphical displays, the M-TAB key is usually reserved by the window manager for switching graphical windows, so you should type C-M-i or ESC TAB instead.