File: shell.el.html

This file defines a shell-in-a-buffer package (shell mode) built on top of comint mode.

Since this mode is built on top of the general command-interpreter-in- a-buffer mode (comint mode), it shares a common base functionality, and a common set of bindings, with all modes derived from comint mode. This makes these modes easier to use.

For documentation on the functionality provided by comint mode, and the hooks available for customizing it, see the file comint.el. For further information on shell mode, see the comments below.

Needs fixing: When sending text from a source file to a subprocess, the process-mark can move off the window, so you can lose sight of the process interactions. Maybe I should ensure the process mark is in the window when I send text to the process? Switch selectable?

YOUR .EMACS FILE
=============================================================================
Some suggestions for your init file.

;; Define M-# to run some strange command:
(with-eval-after-load 'shell
  (keymap-set shell-mode-map "M-#" 'shells-dynamic-spell))

Brief Command Documentation:
============================================================================
Comint Mode Commands: (common to shell and all comint-derived modes)

m-p comint-previous-input Cycle backwards in input history
m-n comint-next-input Cycle forwards
m-r comint-previous-matching-input Previous input matching a regexp
m-s comint-next-matching-input Next input that matches
m-c-l comint-show-output Show last batch of process output
return comint-send-input
c-d comint-delchar-or-maybe-eof Delete char unless at end of buff.
c-c c-a comint-bol Beginning of line; skip prompt
c-c c-u comint-kill-input ^u
c-c c-w backward-kill-word ^w
c-c c-c comint-interrupt-subjob ^c
c-c c-z comint-stop-subjob ^z
c-c c-\ comint-quit-subjob ^\
c-c c-o comint-delete-output Delete last batch of process output
c-c c-r comint-show-output Show last batch of process output
c-c c-l comint-dynamic-list-input-ring List input history
        comint-send-invisible Read line without echo & send to proc
        comint-continue-subjob Useful if you accidentally suspend
                                        top-level job
comint-mode-hook is the comint mode hook.

Shell Mode Commands:
        shell Fires up the shell process
tab completion-at-point Complete filename/command/history
m-? comint-dynamic-list-filename-completions
List completions in help buffer
c-c c-f shell-forward-command Forward a shell command
c-c c-b shell-backward-command Backward a shell command
dirs Resync the buffer's dir stack
shell-dirtrack-mode Turn dir tracking on/off
        comint-strip-ctrl-m Remove trailing ^Ms from output

The shell mode hook is shell-mode-hook comint-prompt-regexp is initialized to shell-prompt-pattern, for backwards compatibility.

Read the rest of this file for more information.

Defined variables (55)

explicit-bash-argsArgs passed to inferior shell by M-x shell, if the shell is bash.
explicit-csh-argsArgs passed to inferior shell by M-x shell, if the shell is csh.
explicit-shell-file-nameIf non-nil, the file name to use for explicitly requested inferior shells.
shell--highlight-undef-exec-cacheCache of executable files found in ‘exec-path’.
shell--highlight-undef-indirectNon-nil if shell commands are fontified in ‘comint-indirect-buffer’.
shell--start-progShell file name started in ‘shell’.
shell-bookmark-defaults-functionFunction to generate a list of default shell bookmark names.
shell-bookmark-jump-non-essentialIf non-nil, new remote connections are inhibited in shell-bookmark-jump.
shell-bookmark-name-functionFunction to generate a shell bookmark name.
shell-cd-regexpRegexp to match subshell commands equivalent to cd.
shell-chdrive-regexpIf non-nil, is regexp used to track drive changes.
shell-command-mode-abbrev-tableAbbrev table for ‘shell-command-mode’.
shell-command-mode-hookHook run after entering ‘shell-command-mode’.
shell-command-mode-mapKeymap for ‘shell-command-mode’.
shell-command-mode-syntax-tableSyntax table for ‘shell-command-mode’.
shell-command-regexpRegexp to match a single command within a pipeline.
shell-command-separator-regexpRegexp to match a single command within a pipeline.
shell-completion-execonlyIf non-nil, use executable files only for completion candidates.
shell-completion-fignoreList of suffixes to be disregarded during file/command completion.
shell-delimiter-argument-listList of characters to recognize as separate arguments.
shell-dirstackList of directories saved by pushd in this buffer’s shell.
shell-dirstack-queryCommand used by ‘shell-resync-dirs’ to query the shell.
shell-dirtrack-modeNon-nil if Shell-Dirtrack mode is enabled.
shell-dirtrack-mode-hookHook run after entering or leaving ‘shell-dirtrack-mode’.
shell-dirtrack-verboseIf non-nil, show the directory stack following directory change.
shell-dirtrackpNon-nil in a shell buffer means directory tracking is enabled.
shell-dumb-shell-regexpRegexp to match shells that don’t save their command history, and
shell-dynamic-complete-functionsList of functions called to perform completion.
shell-file-name-charsString of characters valid in a file name.
shell-file-name-quote-listList of characters to quote when in a file name.
shell-font-lock-keywordsAdditional expressions to highlight in Shell mode.
shell-fontify-input-enableEnable fontification of input in shell buffers.
shell-get-old-input-include-continuation-linesWhether ‘shell-get-old-input’ includes "\" lines.
shell-has-auto-cdIf non-nil, ‘shell-mode’ handles implicit "cd" commands.
shell-highlight-undef-aliasesList of shell commands to highlight as a command alias.
shell-highlight-undef-enableEnable highlighting of undefined commands in shell buffers.
shell-highlight-undef-modeNon-nil if Shell-Highlight-Undef mode is enabled.
shell-highlight-undef-mode-hookHook run after entering or leaving ‘shell-highlight-undef-mode’.
shell-highlight-undef-remote-file-name-inhibit-cacheWhether to inhibit cache for fontifying shell commands in remote buffers.
shell-history-file-nameThe history file name used in ‘shell-mode’.
shell-indirect-setup-hookHook run in an indirect buffer for input fontification.
shell-input-autoexpandIf non-nil, expand input command history references on completion.
shell-kill-buffer-on-exitKill a shell buffer after the shell process terminates.
shell-last-dirKeep track of last directory for ksh ‘cd -’ command.
shell-mode-abbrev-tableAbbrev table for ‘shell-mode’.
shell-mode-hookHook for customizing Shell mode.
shell-mode-mapKeymap for ‘shell-mode’.
shell-mode-syntax-tableSyntax table for ‘shell-mode’.
shell-popd-regexpRegexp to match subshell commands equivalent to popd.
shell-prompt-patternRegexp to match prompts in the inferior shell.
shell-pushd-dextractIf non-nil, make "pushd +n" pop the nth dir to the stack top.
shell-pushd-duniqueIf non-nil, make pushd only add unique directories to the stack.
shell-pushd-regexpRegexp to match subshell commands equivalent to pushd.
shell-pushd-tohomeIf non-nil, make pushd with no arg behave as "pushd ~" (like cd).
shell-repeat-mapKeymap to repeat shell key sequences. Used in ‘repeat-mode’.

Defined functions (52)

dirs()
shell(&optional BUFFER FILE-NAME)
shell--command-completion-data()
shell--highlight-undef-executable-find(COMMAND)
shell--parse-pcomplete-arguments()
shell--requote-argument(UPOS QSTR)
shell--unquote&requote-argument(QSTR &optional UPOS)
shell--unquote-argument(STR)
shell-apply-ansi-color(BEG END FACE)
shell-backward-command(&optional ARG)
shell-bookmark-defaults()
shell-bookmark-jump(BOOKMARK)
shell-bookmark-make-record()
shell-bookmark-name-from-buffer-name()
shell-bookmark-name-from-default-directory()
shell-c-a-p-replace-by-expanded-directory()
shell-cd(DIR)
shell-command-completion()
shell-command-completion-function()
shell-command-mode()
shell-completion-vars()
shell-copy-environment-variable(VARIABLE)
shell-directory-tracker(STR)
shell-dirtrack-mode(&optional ARG)
shell-dynamic-complete-command()
shell-dynamic-complete-environment-variable()
shell-dynamic-complete-filename()
shell-environment-variable-completion()
shell-eval-command(COMMAND)
shell-extract-num(STR)
shell-filename-completion()
shell-filter-ctrl-a-ctrl-b(STRING)
shell-filter-ring-bell(STRING)
shell-forward-command(&optional ARG)
shell-get-old-input()
shell-highlight-undef-matcher(END)
shell-highlight-undef-mode(&optional ARG)
shell-highlight-undef-mode-restart()
shell-indirect-setup-hook()
shell-match-partial-variable()
shell-narrow-to-prompt()
shell-prefixed-directory-name(DIR)
shell-process-cd(ARG)
shell-process-popd(ARG)
shell-process-pushd(ARG)
shell-reapply-ansi-color()
shell-replace-by-expanded-directory()
shell-resync-dirs()
shell-snarf-envar(VAR)
shell-unquote-argument(STRING)
shell-write-history-on-exit(PROCESS EVENT)
split-string-shell-command(STRING)

Defined faces (3)

shell-highlight-undef-alias-faceFace used for shell command aliases.
shell-highlight-undef-defined-faceFace used for existing shell commands.
shell-highlight-undef-undefined-faceFace used for non-existent shell commands.