[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Shell buffers use Shell mode, which defines several special keys attached to the C-c prefix. They are chosen to resemble the usual editing and job control characters present in shells that are not under Emacs, except that you must type C-c first. Here is a complete list of the special key bindings of Shell mode:
comint-send-input
). When a line is
copied, any prompt at the beginning of the line (text output by
programs preceding your input) is omitted. (See also the variable
comint-use-prompt-regexp-instead-of-fields
.)
comint-dynamic-complete
). TAB also completes history
references (see section AC.15.4.3 Shell History References) and environment variable names.
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.
comint-dynamic-list-filename-completions
).
comint-delchar-or-maybe-eof
). Typed at the end of the shell
buffer, C-d sends EOF to the subshell. Typed at any other
position in the buffer, C-d deletes a character as usual.
comint-bol-or-process-mark
). If you repeat this command twice
in a row, the second time it moves back to the process mark, which is
the beginning of the input that you have not yet sent to the subshell.
(Normally that is the same place--the end of the prompt on this
line--but after C-c SPC the process mark may be in a
previous line.)
comint-kill-input
).
backward-kill-word
).
comint-interrupt-subjob
). This command also kills
any shell input pending in the shell buffer and not yet sent.
comint-stop-subjob
).
This command also kills any shell input pending in the shell buffer and
not yet sent.
comint-quit-subjob
). This command also kills any shell input
pending in the shell buffer and not yet sent.
comint-delete-output
). This is useful if a shell command spews
out lots of output that just gets in the way. This command used to be
called comint-kill-output
.
comint-write-output
). With a prefix argument, the file is
appended to instead. Any prompt at the end of the output is not
written.
comint-show-output
).
comint-show-maximum-output
).
shell-forward-command
). The variable shell-command-regexp
specifies how to recognize the end of a command.
shell-backward-command
).
comint-dynamic-list-input-ring
).
Alternatively, you can arrange for Emacs to notice password prompts and turn off echoing for them, as follows:
(add-hook 'comint-output-filter-functions 'comint-watch-for-password-prompt) |
(add-hook 'comint-output-filter-functions 'comint-strip-ctrl-m) |
comint-buffer-maximum-size
.
Here's how to do this automatically each time you get output from the
subshell:
(add-hook 'comint-output-filter-functions 'comint-truncate-buffer) |
Shell mode also customizes the paragraph commands so that only shell prompts start new paragraphs. Thus, a paragraph consists of an input command plus the output that follows it in the buffer.
Shell mode is a derivative of Comint mode, a general-purpose mode for communicating with interactive subprocesses. Most of the features of Shell mode actually come from Comint mode, as you can see from the command names listed above. The special features of Shell mode include the directory tracking feature, and a few user commands.
Other Emacs features that use variants of Comint mode include GUD (see section V.5 Running Debuggers Under Emacs) and M-x run-lisp (see section V.10 Running an External Lisp).
You can use M-x comint-run to execute any program of your choice in a subprocess using unmodified Comint mode--without the specializations of Shell mode.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |