0
|
1
|
|
2 @node Entering Emacs, Exiting, Pull-down Menus, Top
|
|
3 @chapter Entering and Exiting Emacs
|
|
4 @cindex entering Emacs
|
|
5 @cindex entering XEmacs
|
|
6
|
|
7 The usual way to invoke Emacs is to type @kbd{emacs @key{RET}} at the
|
|
8 shell (for XEmacs, type @kbd{xemacs @key{RET}}). Emacs clears the
|
|
9 screen and then displays an initial advisory message and copyright
|
|
10 notice. You can begin typing Emacs commands immediately afterward.
|
|
11
|
|
12 Some operating systems insist on discarding all type-ahead when Emacs
|
|
13 starts up; they give Emacs no way to prevent this. Therefore, it is
|
|
14 wise to wait until Emacs clears the screen before typing the first
|
|
15 editing command.
|
|
16
|
|
17 @vindex initial-major-mode
|
|
18 Before Emacs reads the first command, you have not had a chance to
|
|
19 give a command to specify a file to edit. Since Emacs must always have a
|
|
20 current buffer for editing, it presents a buffer, by default, a buffer named
|
|
21 @samp{*scratch*}. The buffer is in Lisp Interaction
|
|
22 mode; you can use it to type Lisp expressions and evaluate them, or you
|
|
23 can ignore that capability and simply doodle. You can specify a
|
|
24 different major mode for this buffer by setting the variable
|
|
25 @code{initial-major-mode} in your init file. @xref{Init File}.
|
|
26
|
|
27 It is possible to give Emacs arguments in the shell command line to
|
|
28 specify files to visit, Lisp files to load, and functions to call.
|
|
29
|
|
30 @node Exiting, Command Switches, Entering Emacs, Top
|
|
31 @section Exiting Emacs
|
|
32 @cindex exiting
|
|
33 @cindex killing Emacs
|
|
34 @cindex suspending
|
|
35 @cindex shrinking XEmacs frame
|
|
36
|
|
37 There are two commands for exiting Emacs because there are two kinds
|
|
38 of exiting: @dfn{suspending} Emacs and @dfn{killing} Emacs.
|
|
39 @dfn{Suspending} means stopping Emacs temporarily and returning control
|
|
40 to its superior (usually the shell), allowing you to resume editing
|
|
41 later in the same Emacs job, with the same files, same kill ring, same
|
|
42 undo history, and so on. This is the usual way to exit. @dfn{Killing}
|
|
43 Emacs means destroying the Emacs job. You can run Emacs again later,
|
|
44 but you will get a fresh Emacs; there is no way to resume the same
|
|
45 editing session after it has been killed.
|
|
46
|
|
47 @table @kbd
|
|
48 @item C-z
|
|
49 Suspend Emacs (@code{suspend-emacs}). If used under the X window system,
|
|
50 shrink the X window containing the Emacs frame to an icon (see below).
|
|
51 @item C-x C-c
|
|
52 Kill Emacs (@code{save-buffers-kill-emacs}).
|
|
53 @end table
|
|
54
|
|
55 If you use XEmacs under the X window system, @kbd{C-z} shrinks
|
|
56 the X window containing the Emacs frame to an icon. The Emacs process
|
|
57 is stopped temporarily, and control is returned to the window manager.
|
|
58 If more than one frame is associated with the Emacs process, only the
|
|
59 frame from which you used @kbd{C-z} is retained. The X windows
|
|
60 containing the other Emacs frames are closed.
|
|
61
|
|
62 To activate the "suspended" Emacs, use the appropriate window manager
|
|
63 mouse gestures. Usually left-clicking on the icon reactivates and
|
|
64 reopens the X window containing the Emacs frame, but the window manager
|
|
65 you use determines what exactly happens. To actually kill the Emacs
|
|
66 process, use @kbd{C-x C-c} or the @b{Exit Emacs} item on the @b{File}
|
|
67 menu.
|
|
68
|
|
69 @kindex C-z
|
|
70 @findex suspend-emacs
|
|
71 On systems that do not permit programs to be suspended, @kbd{C-z} runs
|
|
72 an inferior shell that communicates directly with the terminal, and
|
|
73 Emacs waits until you exit the subshell. On these systems, the only way
|
|
74 to return to the shell from which Emacs was started (to log out, for
|
|
75 example) is to kill Emacs. @kbd{C-d} or @code{exit} are typical
|
|
76 commands to exit a subshell.
|
|
77
|
|
78 @kindex C-x C-c
|
|
79 @findex save-buffers-kill-emacs
|
|
80 To kill Emacs, type @kbd{C-x C-c} (@code{save-buffers-kill-emacs}). A
|
|
81 two-character key is used for this to make it harder to type. In
|
|
82 XEmacs, selecting the @b{Exit Emacs} option of the @b{File} menu is an
|
|
83 alternate way of issuing the command.
|
|
84
|
|
85 Unless a numeric argument is used, this command first offers to save any
|
|
86 modified buffers. If you do not save all buffers, you are asked for
|
|
87 reconfirmation with @kbd{yes} before killing Emacs, since any changes
|
|
88 not saved will be lost. If any subprocesses are still running, @kbd{C-x
|
|
89 C-c} asks you to confirm killing them, since killing Emacs kills the
|
|
90 subprocesses simultaneously.
|
|
91
|
|
92 In most programs running on Unix, certain characters may instantly
|
|
93 suspend or kill the program. (In Berkeley Unix these characters are
|
|
94 normally @kbd{C-z} and @kbd{C-c}.) @i{This Unix feature is turned off
|
|
95 while you are in Emacs.} The meanings of @kbd{C-z} and @kbd{C-x C-c} as
|
|
96 keys in Emacs were inspired by the standard Berkeley Unix meanings of
|
|
97 @kbd{C-z} and @kbd{C-c}, but that is their only relationship with Unix.
|
|
98 You could customize these keys to do anything (@pxref{Keymaps}).
|
|
99
|
|
100 @c ??? What about system V here?
|