[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1 Entering and Exiting Emacs

The usual way to invoke Emacs is to type emacs <RET> at the shell (for XEmacs, type xemacs <RET>). Emacs clears the screen and then displays an initial advisory message and copyright notice. You can begin typing Emacs commands immediately afterward.

Some operating systems insist on discarding all type-ahead when Emacs starts up; they give Emacs no way to prevent this. Therefore, it is wise to wait until Emacs clears the screen before typing the first editing command.

Before Emacs reads the first command, you have not had a chance to give a command to specify a file to edit. Since Emacs must always have a current buffer for editing, it presents a buffer, by default, a buffer named ‘*scratch*’. The buffer is in 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 initial-major-mode in your init file. @xref{Init File}.

It is possible to give Emacs arguments in the shell command line to specify files to visit, Lisp files to load, and functions to call.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.1 Exiting Emacs

There are two commands for exiting Emacs because there are two kinds of exiting: suspending Emacs and killing Emacs. Suspending means stopping Emacs temporarily and returning control to its superior (usually the shell), allowing you to resume editing later in the same Emacs job, with the same files, same kill ring, same undo history, and so on. This is the usual way to exit. 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.

C-z

Suspend Emacs (suspend-emacs). If used under the X window system, shrink the X window containing the Emacs frame to an icon (see below).

C-x C-c

Kill Emacs (save-buffers-kill-emacs).

If you use XEmacs under the X window system, C-z shrinks the X window containing the Emacs frame to an icon. The Emacs process is stopped temporarily, and control is returned to the window manager. If more than one frame is associated with the Emacs process, only the frame from which you used C-z is retained. The X windows containing the other Emacs frames are closed.

To activate the "suspended" Emacs, use the appropriate window manager mouse gestures. Usually left-clicking on the icon reactivates and reopens the X window containing the Emacs frame, but the window manager you use determines what exactly happens. To actually kill the Emacs process, use C-x C-c or the Exit Emacs item on the File menu.

On systems that do not permit programs to be suspended, C-z runs an inferior shell that communicates directly with the terminal, and Emacs waits until you exit the subshell. On these systems, the only way to return to the shell from which Emacs was started (to log out, for example) is to kill Emacs. C-d or exit are typical commands to exit a subshell.

To kill Emacs, type C-x C-c (save-buffers-kill-emacs). A two-character key is used for this to make it harder to type. In XEmacs, selecting the Exit Emacs option of the File menu is an alternate way of issuing the command.

Unless a numeric argument is used, this command first offers to save any modified buffers. If you do not save all buffers, you are asked for reconfirmation with yes before killing Emacs, since any changes not saved will be lost. If any subprocesses are still running, C-x C-c asks you to confirm killing them, since killing Emacs kills the subprocesses simultaneously.

In most programs running on Unix, certain characters may instantly suspend or kill the program. (In Berkeley Unix these characters are normally C-z and C-c.) This Unix feature is turned off while you are in Emacs. The meanings of C-z and C-x C-c as keys in Emacs were inspired by the standard Berkeley Unix meanings of C-z and C-c, but that is their only relationship with Unix. You could customize these keys to do anything (@pxref{Keymaps}).


[Top] [Contents] [Index] [ ? ]

About This Document

This document was generated on December 6, 2024 using texi2html 5.0.

The buttons in the navigation panels have the following meaning:

Button Name Go to From 1.2.3 go to
[ << ] FastBack Beginning of this chapter or previous chapter 1
[ < ] Back Previous section in reading order 1.2.2
[ Up ] Up Up section 1.2
[ > ] Forward Next section in reading order 1.2.4
[ >> ] FastForward Next chapter 2
[Top] Top Cover (top) of document  
[Contents] Contents Table of contents  
[Index] Index Index  
[ ? ] About About (help)  

where the Example assumes that the current position is at Subsubsection One-Two-Three of a document of the following structure:


This document was generated on December 6, 2024 using texi2html 5.0.