Eshell uses the pcomplete package for programmable completion, similar
to that of other command shells. Argument completion differs depending
on the preceding command: for example, possible completions for
rmdir are only directories, while
rm completions can
be directories and files. Eshell provides predefined completions
for the built-in functions and some common external commands, and you
can define your own for any command.
Eshell completion also works for lisp forms and glob patterns. If the point is
on a lisp form, then TAB will behave similarly to completion in
lisp-interaction-mode. For glob patterns, the
pattern will be removed from the input line, and replaced by the
If you want to see the entire list of possible completions (e.g. when it’s
completion-cycle-threshold), press M-?.
Pcomplete, short for programmable completion, is the completion library originally written for Eshell, but usable for command completion5 in other modes.
Completions are defined as functions (with
COMMAND is the name of the
command for which this function provides completions; you can also name
pcomplete/MAJOR-MODE/COMMAND to define completions
for a specific major mode.
Command completion, as opposed to code completion, which is beyond the scope of pcomplete.