view man/entering.texi @ 83310:e58cb448e07c

Merged from miles@gnu.org--gnu-2005 (patch 80-82, 350-422) Patches applied: * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-350 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-351 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-352 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-353 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-354 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-355 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-356 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-357 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-358 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-359 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-360 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-361 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-362 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-363 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-364 Remove "-face" suffix from widget faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365 Remove "-face" suffix from custom faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-366 Remove "-face" suffix from change-log faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-367 Remove "-face" suffix from compilation faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-368 Remove "-face" suffix from diff-mode faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-369 lisp/longlines.el (longlines-visible-face): Face removed * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-370 Remove "-face" suffix from woman faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-371 Remove "-face" suffix from whitespace-highlight face * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-372 Remove "-face" suffix from ruler-mode faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-373 Remove "-face" suffix from show-paren faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-374 Remove "-face" suffix from log-view faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-375 Remove "-face" suffix from smerge faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-376 Remove "-face" suffix from show-tabs faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-377 Remove "-face" suffix from highlight-changes faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-378 Remove "-face" suffix from and downcase info faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-379 Remove "-face" suffix from pcvs faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-380 Update uses of renamed pcvs faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-381 Tweak ChangeLog * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-382 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-383 Remove "-face" suffix from strokes-char face * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-384 Remove "-face" suffix from compare-windows face * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-385 Remove "-face" suffix from calendar faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-386 Remove "-face" suffix from diary-button face * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-387 Remove "-face" suffix from testcover faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-388 Remove "-face" suffix from viper faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-389 Remove "-face" suffix from org faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-390 Remove "-face" suffix from sgml-namespace face * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-391 Remove "-face" suffix from table-cell face * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-392 Remove "-face" suffix from tex-mode faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-393 Remove "-face" suffix from texinfo-heading face * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-394 Remove "-face" suffix from flyspell faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-395 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-396 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-397 Remove "-face" suffix from gomoku faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-398 Remove "-face" suffix from mpuz faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-399 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-400 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-401 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-402 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-403 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-404 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-405 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-406 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-407 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-408 Remove "-face" suffix from Buffer-menu-buffer face * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-409 Remove "-face" suffix from antlr-mode faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-410 Remove "-face" suffix from ebrowse faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-411 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-412 Remove "-face" suffix from flymake faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-413 Remove "-face" suffix from idlwave faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-414 Remove "-face" suffix from sh-script faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-415 Remove "-face" suffix from vhdl-mode faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-416 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-417 Remove "-face" suffix from which-func face * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-418 Remove "-face" suffix from cperl-mode faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-419 Remove "-face" suffix from ld-script faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-420 Fix cperl-mode font-lock problem * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-421 Tweak which-func face * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-422 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-80 Merge from emacs--cvs-trunk--0 * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-81 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-82 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-350
author Karoly Lorentey <lorentey@elte.hu>
date Wed, 15 Jun 2005 12:57:51 +0000
parents e0bfdf477815
children 3723093a21fd 3ebd9bdb4fe5
line wrap: on
line source

@c This is part of the Emacs manual.
@c Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995 Free Software Foundation, Inc.
@c See file emacs.texi for copying conditions.
@node Entering Emacs, Exiting, Text Characters, Top
@chapter Entering and Exiting Emacs
@cindex entering Emacs
@cindex starting Emacs

  The usual way to invoke Emacs is with the shell command @command{emacs}.
Emacs clears the screen and then displays an initial help message and
copyright notice.  Some operating systems discard all type-ahead when
Emacs starts up; they give Emacs no way to prevent this.  Therefore, it
is advisable to wait until Emacs clears the screen before typing your
first editing command.

  If you run Emacs from a shell window under the X Window System, run it
in the background with @command{emacs&}.  This way, Emacs does not tie up
the shell window, so you can use that to run other shell commands while
Emacs operates its own X windows.  You can begin typing Emacs commands
as soon as you direct your keyboard input to the Emacs frame.

@vindex initial-major-mode
  When Emacs starts up, it creates a buffer named @samp{*scratch*}.
That's the buffer you start out in.  The @samp{*scratch*} buffer uses Lisp
Interaction mode; you can use it to type Lisp expressions and evaluate
them, or you can ignore that capability and simply doodle.  (You can
specify a different major mode for this buffer by setting the variable
@code{initial-major-mode} in your init file.  @xref{Init File}.)

  It is possible to specify files to be visited, Lisp files to be
loaded, and functions to be called, by giving Emacs arguments in the
shell command line.  @xref{Emacs Invocation}.  But we don't recommend
doing this.  The feature exists mainly for compatibility with other
editors.

  Many other editors are designed to be started afresh each time you
want to edit.  You edit one file and then exit the editor.  The next
time you want to edit either another file or the same one, you must run
the editor again.  With these editors, it makes sense to use a
command-line argument to say which file to edit.

  But starting a new Emacs each time you want to edit a different file
does not make sense.  This would fail to take advantage of Emacs's
ability to visit more than one file in a single editing session, and
it would lose the other accumulated context, such as the kill ring,
registers, undo history, and mark ring, that are useful for operating
on multiple files.

  The recommended way to use GNU Emacs is to start it only once, just
after you log in, and do all your editing in the same Emacs session.
Each time you want to edit a different file, you visit it with the
existing Emacs, which eventually comes to have many files in it ready
for editing.  Usually you do not kill the Emacs until you are about to
log out.  @xref{Files}, for more information on visiting more than one
file.

  If you want to edit a file from another program and already have
Emacs running, you can use the @command{emacsclient} program to open a
file in the already running Emacs.  @xref{Emacs Server}, for more
information on editing files with Emacs from other programs.

@ifnottex
@raisesections
@end ifnottex

@node Exiting, Basic, Entering Emacs, Top
@section Exiting Emacs
@cindex exiting
@cindex killing Emacs
@cindex suspending
@cindex leaving Emacs
@cindex quitting Emacs

  There are two commands for exiting Emacs because there are three
kinds of exiting: @dfn{suspending} Emacs, @dfn{Iconifying} Emacs, and
@dfn{killing} Emacs.

  @dfn{Suspending} means stopping Emacs temporarily and returning
control to its parent process (usually a shell), allowing you to resume
editing later in the same Emacs job, with the same buffers, same kill
ring, same undo history, and so on.  This is the usual way to exit Emacs
when running on a text terminal.

  @dfn{Iconifying} means replacing the Emacs frame with a small box
somewhere on the screen.  This is the usual way to exit Emacs when you're
using a graphics terminal.

  @dfn{Killing} Emacs means destroying the Emacs job.  You can run Emacs
again later, but you will get a fresh Emacs; there is no way to resume
the same editing session after it has been killed.

@table @kbd
@item C-z
Suspend Emacs (@code{suspend-emacs}) or iconify a frame
(@code{iconify-or-deiconify-frame}).
@item C-x C-c
Kill Emacs (@code{save-buffers-kill-emacs}).
@end table

@kindex C-z
@findex suspend-emacs
  To suspend or iconify Emacs, type @kbd{C-z} (@code{suspend-emacs}).
On text terminals, this suspends Emacs.  On graphics terminals,
it iconifies the Emacs frame.

  Suspending Emacs takes you back to the shell from which you invoked
Emacs.  You can resume Emacs with the shell command @command{%emacs}
in most common shells.  On systems that don't support suspending
programs, @kbd{C-z} starts an inferior shell that communicates
directly with the terminal.  Emacs waits until you exit the subshell.
(The way to do that is probably with @kbd{C-d} or @command{exit}, but
it depends on which shell you use.)  The only way on these systems to
get back to the shell from which Emacs was run (to log out, for
example) is to kill Emacs.

  Suspending can fail if you run Emacs under a shell that doesn't
support suspending programs, even if the system itself does support
it.  In such a case, you can set the variable @code{cannot-suspend} to
a non-@code{nil} value to force @kbd{C-z} to start an inferior shell.
(One might also describe Emacs's parent shell as ``inferior'' for
failing to support job control properly, but that is a matter of
taste.)

  On graphics terminals, @kbd{C-z} has a different meaning: it runs
the command @code{iconify-or-deiconify-frame}, which temporarily
iconifies (or ``minimizes'') the selected Emacs frame
(@pxref{Frames}).  Then you can use the window manager to get back to
a shell window.

@kindex C-x C-c
@findex save-buffers-kill-emacs
  To exit and kill Emacs, type @kbd{C-x C-c}
(@code{save-buffers-kill-emacs}).  A two-character key is used for
this to make it harder to type by accident.  This command first offers
to save any modified file-visiting buffers.  If you do not save them
all, it asks for reconfirmation with @kbd{yes} before killing Emacs,
since any changes not saved will be lost forever.  Also, if any
subprocesses are still running, @kbd{C-x C-c} asks for confirmation
about them, since killing Emacs will also kill the subprocesses.

@vindex confirm-kill-emacs
  If the value of the variable @code{confirm-kill-emacs} is
non-@code{nil}, @kbd{C-x C-c} assumes that its value is a predicate
function, and calls that function.  If the result is non-@code{nil}, the
session is killed, otherwise Emacs continues to run.  One convenient
function to use as the value of @code{confirm-kill-emacs} is the
function @code{yes-or-no-p}.  The default value of
@code{confirm-kill-emacs} is @code{nil}.

  There is no way to resume an Emacs session once you have killed it.
You can, however, arrange for Emacs to record certain session
information when you kill it, such as which files are visited, so that
the next time you start Emacs it will try to visit the same files and
so on.  @xref{Saving Emacs Sessions}.

  The operating system usually listens for certain special characters
whose meaning is to kill or suspend the program you are running.
@b{This operating system feature is turned off while you are in Emacs.}
The meanings of @kbd{C-z} and @kbd{C-x C-c} as keys in Emacs were
inspired by the use of @kbd{C-z} and @kbd{C-c} on several operating
systems as the characters for stopping or killing a program, but that is
their only relationship with the operating system.  You can customize
these keys to run any commands of your choice (@pxref{Keymaps}).

@ifnottex
@lowersections
@end ifnottex

@ignore
   arch-tag: df798d8b-f253-4113-b585-f528f078a944
@end ignore