Next: , Previous: , Up: Commands   [Contents][Index]

2.7 Completion

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 elisp-mode and lisp-interaction-mode. For glob patterns, If there are few enough possible completions of the patterns, they will be cycled when TAB is pressed, otherwise it will be removed from the input line and the possible completions will be listed.

If you want to see the entire list of possible completions when it’s below the cycling threshold, press M-?.

2.7.1 pcomplete

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 defun) named pcomplete/COMMAND, where COMMAND is the name of the command for which this function provides completions; you can also name the function pcomplete/MAJOR-MODE/COMMAND to define completions for a specific major mode.



Command completion as opposed to code completion, which is a beyond the scope of pcomplete.