The Shell mode is usually used to run a shell process in a buffer (with
the shell command, see section Shell) but in actual fact it is
capable of running (nearly) any type of interactive process. For
example the gdb interface (see section Debugging Programs) uses the Shell
mode to handle its user interaction.
The following buffer-local variables control the Shell mode.
nil all output goes to the end of the process' buffer.
Note that this variable is only referenced when the process is started.
To use the Shell mode to create an interface with a program simply use the following steps.
buffer-file-name attribute of the buffer defines the
working directory of the subprocess.
shell-mode function.
mode-name and major-mode if
necessary and install your own keymaps.
Remember that commands essential to the Shell mode (and hence your
program) are contained in the two keymaps shell-keymap and
shell-ctrl-c-keymap. If you need to bind your own commands to
either of these prefixes make copies of these keymaps (using the
function copy-sequence) and bind to the copies.
For example the gdb interface installs its own key bindings from the
Ctrl-c prefix by doing the following in its initialisation.
(defvar gdb-ctrl-c-keymap (copy-sequence shell-ctrl-c-keymap)) (bind-keys gdb-ctrl-c-keymap ;; Gdb mode `Ctrl-c' prefix bindings follow ...
The variables shell-program, shell-program-args,
shell-prompt-regexp, shell-callback-function and
shell-output-stream control the program executed and how it will
execute.
The process object created is stored in the buffer-local variable
shell-process.
nil no such process
exists.
See the Lisp program `gdb.jl' for an example of how to use the Shell mode as the user interface with an external program.
Go to the first, previous, next, last section, table of contents.