File: em-cmpl.el.html

Eshell, by using the pcomplete package, provides a full programmable completion facility that is comparable to shells like tcsh or zsh.

Completions are context-sensitive, which means that pressing <TAB> after the command 'rmdir' will result in a list of directories, while doing so after 'rm' will result in a list of all file entries.

Many builtin completion rules are provided, for commands such as cvs, or RedHat's rpm utility. Adding new completion rules is no more difficult than writing a plain Lisp functions, and they can be debugged, profiled, and compiled using exactly the same facilities (since in fact, they *are* just Lisp functions). See the definition of the function pcomplete/make for an example of how to write a completion function.

The completion facility is very easy to use. Just press TAB. If there are a large number of possible completions, a buffer will appear showing a list of them. Completions may be selected from that buffer using the mouse. If no completion is selected, and the user starts doing something else, the display buffer will automatically disappear.

If the list of possible completions is very small, Eshell will
"cycle" through them, selecting a different entry each time <TAB>
is pressed. <S-TAB> may be used to cycle in the opposite direction.

Glob patterns can also be cycled. For example, entering 'echo x*<tab>' will cycle through all the filenames beginning with 'x'. This is done because the glob list is treated as though it were a list of possible completions. Pressing <C-c SPC> will insert all of the matching glob patterns at point.

If a Lisp form is being entered, <TAB> will complete the Lisp symbol name, in exactly the same way that <M-TAB> does in Emacs Lisp mode.

The list of possible completions can be viewed at any point by pressing <M-?>.

Finally, context-related help can be accessed by pressing <C-c M-h>. This only works well if the completion function has provided Eshell with sufficient pointers to locate the relevant help text.

Defined variables (23)

eshell-cmpl-autolistIf non-nil, automatically list possibilities on partial completion.
eshell-cmpl-command-name-functionFunction called for determining the current command name.
eshell-cmpl-compare-entry-functionThis function is used to order file entries for completion.
eshell-cmpl-cycle-completionsIf non-nil, hitting the TAB key cycles through the completion list.
eshell-cmpl-cycle-cutoff-lengthIf the number of completions is greater than this, don’t cycle.
eshell-cmpl-dir-ignoreA regexp of names to be disregarded during directory completion.
eshell-cmpl-expand-before-completeIf non-nil, expand the current argument before completing it.
eshell-cmpl-file-ignoreA regexp of filenames to be disregarded during file completion.
eshell-cmpl-ignore-caseNon-nil means don’t consider case significant in completion.
eshell-cmpl-load-hookA list of functions to run when ‘eshell-cmpl’ is loaded.
eshell-cmpl-man-functionA function to that will be called to display a manual page.
eshell-cmpl-modeNon-nil if Eshell-Cmpl mode is enabled.
eshell-cmpl-mode-hookHook run after entering or leaving ‘eshell-cmpl-mode’.
eshell-cmpl-recexactIf non-nil, use shortest completion if characters cannot be added.
eshell-cmpl-remote-file-ignoreWhether to ignore remote file names.
eshell-cmpl-restore-window-delayThe number of seconds to wait before restoring completion windows.
eshell-cmpl-use-paringIf t, pare alternatives that have already been used.
eshell-command-completion-functionFunction called for completing the initial command argument.
eshell-command-completions-alistAn alist that defines simple argument type correlations.
eshell-default-completion-functionFunction called when no completion rule can be found.
eshell-no-completion-during-jobsIf non-nil, don’t allow completion while a process is running.
eshell-show-lisp-alternativesIf non-nil, and no other completions found, show Lisp functions.
eshell-show-lisp-completionsIf non-nil, include Lisp functions in the command completion list.

Defined functions (10)

eshell--complete-commands-list()
eshell-cmpl--custom-variable-docstring(PCOMPLETE-VAR)
eshell-cmpl-initialize()
eshell-cmpl-mode(&optional ARG)
eshell-complete--eval-argument-form(ARG)
eshell-complete-lisp-symbol()
eshell-complete-parse-arguments()
eshell-completion-command-name()
eshell-external-command-p(COMMAND)
eshell-pcomplete()

Defined faces (0)