408
|
1 @c This is part of the XEmacs manual.
|
|
2 @c Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995 Free Software Foundation, Inc.
|
|
3 @c See file xemacs.texi for copying conditions.
|
0
|
4 @node Entering Emacs, Exiting, Pull-down Menus, Top
|
|
5 @chapter Entering and Exiting Emacs
|
|
6 @cindex entering XEmacs
|
408
|
7 @cindex starting XEmacs
|
|
8
|
|
9 The usual way to invoke XEmacs is to type @kbd{xemacs @key{RET}} at
|
|
10 the shell. XEmacs clears the screen and then displays an initial
|
|
11 advisory message and copyright notice. You can begin typing XEmacs
|
|
12 commands immediately afterward.
|
0
|
13
|
408
|
14 Some operating systems insist on discarding all type-ahead when XEmacs
|
|
15 starts up; they give XEmacs no way to prevent this. Therefore, it is
|
|
16 advisable to wait until XEmacs clears the screen before typing your first
|
|
17 editing command.
|
0
|
18
|
408
|
19 If you run XEmacs from a shell window under the X Window System, run it
|
|
20 in the background with @samp{xemacs&}. This way, XEmacs does not tie up
|
|
21 the shell window, so you can use that to run other shell commands while
|
|
22 XEmacs operates its own X windows. You can begin typing XEmacs commands
|
|
23 as soon as you direct your keyboard input to the XEmacs frame.
|
0
|
24
|
|
25 @vindex initial-major-mode
|
|
26 Before Emacs reads the first command, you have not had a chance to
|
408
|
27 give a command to specify a file to edit. Since Emacs must always have
|
|
28 a current buffer for editing, it presents a buffer, by default, a buffer
|
|
29 named @samp{*scratch*}. The buffer is in Lisp Interaction mode; you can
|
|
30 use it to type Lisp expressions and evaluate them, or you can ignore
|
|
31 that capability and simply doodle. (You can specify a different major
|
|
32 mode for this buffer by setting the variable @code{initial-major-mode}
|
|
33 in your init file. @xref{Init File}.)
|
|
34
|
|
35 It is possible to specify files to be visited, Lisp files to be
|
|
36 loaded, and functions to be called, by giving Emacs arguments in the
|
|
37 shell command line. @xref{Command Switches}. But we don't recommend
|
|
38 doing this. The feature exists mainly for compatibility with other
|
|
39 editors.
|
0
|
40
|
408
|
41 Many other editors are designed to be started afresh each time you
|
|
42 want to edit. You edit one file and then exit the editor. The next
|
|
43 time you want to edit either another file or the same one, you must run
|
|
44 the editor again. With these editors, it makes sense to use a
|
|
45 command-line argument to say which file to edit.
|
|
46
|
|
47 But starting a new Emacs each time you want to edit a different file
|
|
48 does not make sense. For one thing, this would be annoyingly slow. For
|
|
49 another, this would fail to take advantage of Emacs's ability to visit
|
|
50 more than one file in a single editing session. And it would lose the
|
|
51 other accumulated context, such as registers, undo history, and the mark
|
|
52 ring.
|
|
53
|
|
54 The recommended way to use XEmacs is to start it only once, just
|
|
55 after you log in, and do all your editing in the same Emacs session.
|
|
56 Each time you want to edit a different file, you visit it with the
|
|
57 existing Emacs, which eventually comes to have many files in it ready
|
|
58 for editing. Usually you do not kill the Emacs until you are about to
|
|
59 log out. @xref{Files}, for more information on visiting more than one
|
|
60 file.
|
0
|
61
|
|
62 @node Exiting, Command Switches, Entering Emacs, Top
|
|
63 @section Exiting Emacs
|
|
64 @cindex exiting
|
|
65 @cindex killing Emacs
|
|
66 @cindex suspending
|
408
|
67 @cindex leaving Emacs
|
|
68 @cindex quitting Emacs
|
0
|
69 @cindex shrinking XEmacs frame
|
|
70
|
|
71 There are two commands for exiting Emacs because there are two kinds
|
|
72 of exiting: @dfn{suspending} Emacs and @dfn{killing} Emacs.
|
408
|
73
|
|
74 @dfn{Suspending} means stopping Emacs temporarily and returning
|
|
75 control to its parent process (usually a shell), allowing you to resume
|
|
76 editing later in the same Emacs job, with the same buffers, same kill
|
|
77 ring, same undo history, and so on. This is the usual way to exit.
|
|
78
|
|
79 @dfn{Killing} Emacs means destroying the Emacs job. You can run Emacs
|
|
80 again later, but you will get a fresh Emacs; there is no way to resume
|
|
81 the same editing session after it has been killed.
|
0
|
82
|
|
83 @table @kbd
|
|
84 @item C-z
|
408
|
85 Suspend Emacs or iconify a frame
|
|
86 (@code{suspend-emacs-or-iconify-frame}). If used under the X window
|
|
87 system, shrink the X window containing the Emacs frame to an icon (see
|
|
88 below).
|
0
|
89 @item C-x C-c
|
|
90 Kill Emacs (@code{save-buffers-kill-emacs}).
|
|
91 @end table
|
|
92
|
|
93 If you use XEmacs under the X window system, @kbd{C-z} shrinks
|
|
94 the X window containing the Emacs frame to an icon. The Emacs process
|
|
95 is stopped temporarily, and control is returned to the window manager.
|
|
96 If more than one frame is associated with the Emacs process, only the
|
408
|
97 frame from which you used @kbd{C-z} is iconified.
|
0
|
98
|
|
99 To activate the "suspended" Emacs, use the appropriate window manager
|
|
100 mouse gestures. Usually left-clicking on the icon reactivates and
|
|
101 reopens the X window containing the Emacs frame, but the window manager
|
|
102 you use determines what exactly happens. To actually kill the Emacs
|
408
|
103 process, use @kbd{C-x C-c} or the @b{Exit XEmacs} item on the @b{File}
|
0
|
104 menu.
|
|
105
|
|
106 @kindex C-z
|
|
107 @findex suspend-emacs
|
408
|
108 To suspend Emacs, type @kbd{C-z} (@code{suspend-emacs}). This takes
|
|
109 you back to the shell from which you invoked Emacs. You can resume
|
|
110 Emacs with the shell command @samp{%xemacs} in most common shells.
|
|
111
|
|
112 On systems that do not support suspending programs, @kbd{C-z} starts
|
|
113 an inferior shell that communicates directly with the terminal.
|
|
114 Emacs waits until you exit the subshell. (The way to do that is
|
|
115 probably with @kbd{C-d} or @samp{exit}, but it depends on which shell
|
|
116 you use.) The only way on these systems to get back to the shell from
|
|
117 which Emacs was run (to log out, for example) is to kill Emacs.
|
|
118
|
|
119 Suspending also fails if you run Emacs under a shell that doesn't
|
|
120 support suspending programs, even if the system itself does support it.
|
|
121 In such a case, you can set the variable @code{cannot-suspend} to a
|
|
122 non-@code{nil} value to force @kbd{C-z} to start an inferior shell.
|
|
123 (One might also describe Emacs's parent shell as ``inferior'' for
|
|
124 failing to support job control properly, but that is a matter of taste.)
|
|
125
|
|
126 When Emacs communicates directly with an X server and creates its own
|
|
127 dedicated X windows, @kbd{C-z} has a different meaning. Suspending an
|
|
128 applications that uses its own X windows is not meaningful or useful.
|
|
129 Instead, @kbd{C-z} runs the command @code{iconify-or-deiconify-frame},
|
|
130 which temporarily closes up the selected Emacs frame.
|
|
131 The way to get back to a shell window is with the window manager.
|
0
|
132
|
|
133 @kindex C-x C-c
|
|
134 @findex save-buffers-kill-emacs
|
|
135 To kill Emacs, type @kbd{C-x C-c} (@code{save-buffers-kill-emacs}). A
|
408
|
136 two-character key is used for this to make it harder to type. Selecting
|
|
137 the @b{Exit XEmacs} option of the @b{File} menu is an alternate way of
|
|
138 issuing the command.
|
0
|
139
|
|
140 Unless a numeric argument is used, this command first offers to save any
|
408
|
141 modified file-visiting buffers. If you do not save all buffers, you are
|
|
142 asked for reconfirmation with @kbd{yes} before killing Emacs, since any
|
|
143 changes not saved will be lost forever. If any subprocesses are still
|
|
144 running, @kbd{C-x C-c} asks you to confirm killing them, since killing
|
|
145 Emacs will kill the subprocesses immediately.
|
0
|
146
|
408
|
147 There is no way to restart an Emacs session once you have killed it.
|
|
148 You can, however, arrange for Emacs to record certain session
|
|
149 information, such as which files are visited, when you kill it, so that
|
|
150 the next time you restart Emacs it will try to visit the same files and
|
|
151 so on.
|
|
152 @c @xref{Saving Emacs Sessions}.
|
0
|
153
|
408
|
154 The operating system usually listens for certain special characters
|
|
155 whose meaning is to kill or suspend the program you are running.
|
|
156 @b{This operating system feature is turned off while you are in Emacs.}
|
|
157 The meanings of @kbd{C-z} and @kbd{C-x C-c} as keys in Emacs were
|
|
158 inspired by the use of @kbd{C-z} and @kbd{C-c} on several operating
|
|
159 systems as the characters for stopping or killing a program, but that is
|
|
160 their only relationship with the operating system. You can customize
|
|
161 these keys to run any commands of your choice (@pxref{Keymaps}).
|