39.7 Shell Mode Options

If the variable comint-scroll-to-bottom-on-input is non-nil, insertion and yank commands scroll the selected window to the bottom before inserting. The default is nil.

If comint-scroll-show-maximum-output is non-nil, then arrival of output when point is at the end tries to scroll the last line of text to the bottom line of the window, showing as much useful text as possible. (This mimics the scrolling behavior of most terminals.) The default is t.

By setting comint-move-point-for-output, you can opt for having point jump to the end of the buffer whenever output arrives—no matter where in the buffer point was before. If the value is this, point jumps in the selected window. If the value is all, point jumps in each window that shows the Comint buffer. If the value is other, point jumps in all nonselected windows that show the current buffer. The default value is nil, which means point does not jump to the end.

If you set comint-prompt-read-only, the prompts in the Comint buffer are read-only.

The variable comint-input-ignoredups controls whether successive identical inputs are stored in the input history. A non-nil value means to omit an input that is the same as the previous input. The default is nil, which means to store each input even if it is equal to the previous input.

Three variables customize file name completion. The variable comint-completion-addsuffix controls whether completion inserts a space or a slash to indicate a fully completed file or directory name (non-nil means do insert a space or slash). comint-completion-recexact, if non-nil, directs TAB to choose the shortest possible completion if the usual Emacs completion algorithm cannot add even a single character. comint-completion-autolist, if non-nil, says to list all the possible completions whenever completion is not exact.

Command completion normally considers only executable files. If you set shell-completion-execonly to nil, it considers nonexecutable files as well.

The variable shell-completion-fignore specifies a list of file name extensions to ignore in Shell mode completion. The default setting is nil, but some users prefer ("~" "#" "%") to ignore file names ending in ‘~’, ‘#’ or ‘%’. Other related Comint modes use the variable comint-completion-fignore instead.

Some implementation details of the shell command completion may also be found in the lisp documentation of the shell-dynamic-complete-command function.

You can configure the behavior of ‘pushd’. Variables control whether ‘pushd’ behaves like ‘cd’ if no argument is given (shell-pushd-tohome), pop rather than rotate with a numeric argument (shell-pushd-dextract), and only add directories to the directory stack if they are not already on it (shell-pushd-dunique). The values you choose should match the underlying shell, of course.

Comint mode sets the TERM environment variable to a safe default value, but this value disables some useful features. For example, color is disabled in applications that use TERM to determine if color is supported. Therefore, Emacs provides an option comint-terminfo-terminal to let you choose a terminal with more advanced features, as defined in your system’s terminfo database. Emacs will use this option as the value for TERM so long as system-uses-terminfo is non-nil.

Both comint-terminfo-terminal and system-uses-terminfo can be declared as connection-local variables to adjust these options to match what a remote system expects (see Per-Connection Local Variables).