GNU Emacs
Emacs
Dashboard

Completion for Symbol Names

Completion is normally done in the minibuffer (Completion), but you can also complete symbol names in ordinary Emacs buffers. In most programming language modes, C-M-i (or M-=TAB==(On graphical displays)) 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:

  • If Eglot is activated for the current buffer's project (Projects) and the current buffer's major mode, the command tries to use the corresponding language server for producing the list of completion candidates. Eglot Features.
  • If Semantic mode is enabled (Semantic), the command tries to use the Semantic parser data for completion.
  • If Semantic mode is not enabled or fails at performing completion, the command tries to complete using the selected tags table (Tags Tables); you need to visit the tags table with M-x visit-tags-table for that to work.
  • In Emacs Lisp mode, the command performs completion using the function, variable, or property names defined in the current Emacs session.

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. Completion. In Text mode and related modes, M-=TAB= completes words based on the spell-checker's dictionary. Spelling. Completion Preview mode is a minor mode that shows completion suggestions as you type. You can enable it for the current buffer with M-x completion-preview-mode, or globally with M-x global-completion-preview-mode. When Completion Preview mode is on, Emacs automatically displays the suggested completion for text around point as an in-line preview right after point; type TAB to accept the suggestion.