@env{SHELL} environment variable when Emacs is started. If the file
name is relative, Emacs searches the directories in the list
@code{exec-path}; this list is initialized based on the environment
-variable @env{PATH} when Emacs is started. Your @file{.emacs} file
-can override either or both of these default initializations.
+variable @env{PATH} when Emacs is started. Your init file can
+override either or both of these default initializations (@pxref{Init
+File}).
Both @kbd{M-!} and @kbd{M-|} wait for the shell command to complete,
unless you end the command with @samp{&} to make it asynchronous. To
@subsection Interactive Inferior Shell
@findex shell
- To run a subshell interactively, putting its typescript in an Emacs
-buffer, use @kbd{M-x shell}. This creates (or reuses) a buffer named
-@samp{*shell*} and runs a subshell with input coming from and output going
-to that buffer. That is to say, any ``terminal output'' from the subshell
-goes into the buffer, advancing point, and any ``terminal input'' for
-the subshell comes from text in the buffer. To give input to the subshell,
-go to the end of the buffer and type the input, terminated by @key{RET}.
+ To run a subshell interactively, use @kbd{M-x shell}. This creates
+(or reuses) a buffer named @samp{*shell*} and runs a subshell with
+input coming from and output going to that buffer. That is to say,
+any ``terminal output'' from the subshell goes into the buffer,
+advancing point, and any ``terminal input'' for the subshell comes
+from text in the buffer. To give input to the subshell, go to the end
+of the buffer and type the input, terminated by @key{RET}.
Emacs does not wait for the subshell to do anything. You can switch
windows or buffers and edit them while the shell is waiting, or while it is
@cindex @env{ESHELL} environment variable
@cindex @env{SHELL} environment variable
The file name used to load the subshell is the value of the variable
-@code{explicit-shell-file-name}, if that is non-@code{nil}. Otherwise,
-the environment variable @env{ESHELL} is used, or the environment
-variable @env{SHELL} if there is no @env{ESHELL}. If the file name
-specified is relative, the directories in the list @code{exec-path} are
-searched; this list is initialized based on the environment variable
-@env{PATH} when Emacs is started. Your @file{.emacs} file can override
-either or both of these default initializations.
+@code{explicit-shell-file-name}, if that is non-@code{nil}.
+Otherwise, the environment variable @env{ESHELL} is used, or the
+environment variable @env{SHELL} if there is no @env{ESHELL}. If the
+file name specified is relative, the directories in the list
+@code{exec-path} are searched; this list is initialized based on the
+environment variable @env{PATH} when Emacs is started. Your init file
+can override either or both of these default initializations.
+(@pxref{Init File}).
Emacs sends the new shell the contents of the file
@file{~/.emacs_@var{shellname}} as input, if it exists, where
@kindex C-c RET @r{(Shell mode)}
@findex comint-copy-old-input
@item C-c @key{RET}
-Copy the input command which point is in, inserting the copy at the end
-of the buffer (@code{comint-copy-old-input}). This is useful if you
-move point back to a previous command. After you copy the command, you
-can submit the copy as input with @key{RET}. If you wish, you can
-edit the copy before resubmitting it. If you use this command on an
-output line, it copies that line to the end of the buffer.
+Copy the input command at point, inserting the copy at the end of the
+buffer (@code{comint-copy-old-input}). This is useful if you move
+point back to a previous command. After you copy the command, you can
+submit the copy as input with @key{RET}. If you wish, you can edit
+the copy before resubmitting it. If you use this command on an output
+line, it copies that line to the end of the buffer.
@item Mouse-2
If @code{comint-use-prompt-regexp} is @code{nil} (the default), copy
@subsection Emacs Terminal Emulator
@findex term
- To run a subshell in a terminal emulator, putting its typescript in
-an Emacs buffer, use @kbd{M-x term}. This creates (or reuses) a
-buffer named @samp{*terminal*}, and runs a subshell with input coming
-from your keyboard, and output going to that buffer.
+ To run a subshell in a terminal emulator, use @kbd{M-x term}. This
+creates (or reuses) a buffer named @samp{*terminal*}, and runs a
+subshell with input coming from your keyboard, and output going to
+that buffer.
The terminal emulator uses Term mode, which has two input modes. In
line mode, Term basically acts like Shell mode; see @ref{Shell Mode}.
You can actually run Emacs inside an Emacs Term window.
You can use Term mode to communicate with a device connected to a
-serial port of your computer, see @ref{Serial Terminal}.
+serial port of your computer. @xref{Serial Terminal}.
The file name used to load the subshell is determined the same way
as for Shell mode. To make multiple terminal emulators, rename the
@item -a @var{command}
@itemx --alternate-editor=@var{command}
Specify a command to run if @code{emacsclient} fails to contact Emacs.
-This is useful when running @code{emacsclient} in a script. If
-@var{command} is the empty string, then start Emacs in daemon mode and
-try connecting again. For example, the following setting for the
-@env{EDITOR} environment variable will always give you an editor, even
-if no Emacs server is running:
+This is useful when running @code{emacsclient} in a script. For
+example, the following setting for the @env{EDITOR} environment
+variable will always give you an editor, even if no Emacs server is
+running:
@example
EDITOR="emacsclient --alternate-editor emacs +%d %s"
@end example
@noindent
+As a special exception, if @var{command} is the empty string, then
+@code{emacsclient} starts Emacs in daemon mode and then tries
+connecting again.
+
@cindex @env{ALTERNATE_EDITOR} environment variable
-The environment variable @env{ALTERNATE_EDITOR} has the same effect,
-with the value of the @samp{--alternate-editor} option taking
+The environment variable @env{ALTERNATE_EDITOR} has the same effect as
+the @samp{-a} option. If both are present, the latter takes
precedence.
@item -c
when you exit Emacs, and automatic restoration of the last saved
desktop when Emacs starts: use the Customization buffer (@pxref{Easy
Customization}) to set @code{desktop-save-mode} to @code{t} for future
-sessions, or add this line in your @file{~/.emacs} file:
+sessions, or add this line in your init file (@pxref{Init File}):
@example
(desktop-save-mode 1)
@findex desktop-change-dir
@findex desktop-revert
- If you turn on @code{desktop-save-mode} in your @file{~/.emacs},
-then when Emacs starts, it looks for a saved desktop in the current
-directory. Thus, you can have separate saved desktops in different
-directories, and the starting directory determines which one Emacs
-reloads. You can save the current desktop and reload one saved in
-another directory by typing @kbd{M-x desktop-change-dir}. Typing
-@kbd{M-x desktop-revert} reverts to the desktop previously reloaded.
+ If you turn on @code{desktop-save-mode} in your init file, then when
+Emacs starts, it looks for a saved desktop in the current directory.
+Thus, you can have separate saved desktops in different directories,
+and the starting directory determines which one Emacs reloads. You
+can save the current desktop and reload one saved in another directory
+by typing @kbd{M-x desktop-change-dir}. Typing @kbd{M-x
+desktop-revert} reverts to the desktop previously reloaded.
Specify the option @samp{--no-desktop} on the command line when you
don't want it to reload any saved desktop. This turns off
@code{desktop-save-mode} for the current session. Starting Emacs with
the @samp{--no-init-file} option also disables desktop reloading,
-since it bypasses the @file{.emacs} init file, where
-@code{desktop-save-mode} is usually turned on.
+since it bypasses the init file, where @code{desktop-save-mode} is
+usually turned on.
@vindex desktop-restore-eager
By default, all the buffers in the desktop are restored at one go.