Next: , Previous: Minibuffer Edit, Up: Minibuffer


9.3 Completion

For certain kinds of arguments, you can use completion to enter the argument value. Completion means that you type part of the argument, then Emacs visibly fills in the rest, or as much as can be determined from the part you have typed.

When completion is available, certain keys—<TAB>, <RET>, and <SPC>—are rebound to complete the text in the minibuffer before point into a longer string that it stands for, by matching it against a set of completion alternatives provided by the command reading the argument. ? is defined to display a list of possible completions of what you have inserted.

For example, when M-x uses the minibuffer to read the name of a command, it provides a list of all available Emacs command names to complete against. The completion keys match the minibuffer text against all the command names, find any additional name characters implied by the ones already present in the minibuffer, and add those characters to the ones you have given. This is what makes it possible to type M-x ins <SPC> b <RET> instead of M-x insert-buffer <RET> (for example). (<SPC> does not do completion in reading file names, because it is common to use spaces in file names on some systems.)

Case is normally significant in completion, because it is significant in most of the names that you can complete (buffer names, file names and command names). Thus, ‘fo’ does not complete to ‘Foo’. Completion does ignore case distinctions for certain arguments in which case does not matter.

Completion acts only on the text before point. If there is text in the minibuffer after point—i.e., if you move point backward after typing some text into the minibuffer—it remains unchanged.