Emacs: Name Completion

By Xah Lee. Date: . Last updated: .

Programing Language Name Completion

emacs company mode 2017 07 11
emacs company mode in action.

Best is to install company-mode from MELPA.

〔►see Emacs: How to Install Packages Using ELPA, MELPA

For specific language, such as JavaScript, python, ruby, you should install related package to have good support.

〔►see Emacs: What's the Best Setup for Python, Ruby, Java, JavaScript, etc?

Emacs Builtin Completion Commands

The following builtin commands do completion.


emacs completion at point 2017 07 11
emacs completion-at-point, with plain gnu emacs in emacs-lisp-mode.

Alt+x completion-at-pointCtrl+Alt+i】 is for completing the current name.

This works best in emacs-lisp-mode for coding emacs lisp. Usually does not work for other languages, such as JavaScript, Python, Ruby, unless you install supporting packages. (you should install company-mode instead.)


hippie-expand is for expanding any string that occurs in existing buffers. You need to give it a key.

〔►see Emacs: How to Define Keys

Press once to expand. Press again to switch to next choice. Can be used anywhere, including in minibuffer.

Here's hippie expand setup:

(setq hippie-expand-try-functions-list
        ;; try-expand-dabbrev-from-kill
        ;; try-expand-all-abbrevs
        ;; try-expand-list
        ;; try-expand-line

Abbrev Mode

abbrev-mode is for expanding any sequence of few characters to full words or template.

You define the abbrevs yourself.

Abbrev can be used for English word such as [int → international], your company name, or copyright template, or programing language function templates, or special characters such as [alpha → α].

Expansion is done when pressing Space, or Enter ↵, or any punctuation character.

see Emacs: Abbrev Mode

Completion for Minibuffer Prompts

〔►see Emacs: Ido Mode

〔►see Emacs: Icomplete Mode

〔►see Emacs: icomplete vs ido mode

2012-11-29 thanks to Ba Manzi (杨贵龙) for a tip.

Liket it? Put $5 at patreon. Or Buy Xah Emacs Tutorial. Thanks.