comparison man/xemacs/entering.texi @ 412:697ef44129c6 r21-2-14

Import from CVS: tag r21-2-14
author cvs
date Mon, 13 Aug 2007 11:20:41 +0200
parents 501cfd01ee6d
children
comparison
equal deleted inserted replaced
411:12e008d41344 412:697ef44129c6
1 @c This is part of the XEmacs manual. 1
2 @c Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995 Free Software Foundation, Inc.
3 @c See file xemacs.texi for copying conditions.
4 @node Entering Emacs, Exiting, Pull-down Menus, Top 2 @node Entering Emacs, Exiting, Pull-down Menus, Top
5 @chapter Entering and Exiting Emacs 3 @chapter Entering and Exiting Emacs
4 @cindex entering Emacs
6 @cindex entering XEmacs 5 @cindex entering XEmacs
7 @cindex starting XEmacs
8 6
9 The usual way to invoke XEmacs is to type @kbd{xemacs @key{RET}} at 7 The usual way to invoke Emacs is to type @kbd{emacs @key{RET}} at the
10 the shell. XEmacs clears the screen and then displays an initial 8 shell (for XEmacs, type @kbd{xemacs @key{RET}}). Emacs clears the
11 advisory message and copyright notice. You can begin typing XEmacs 9 screen and then displays an initial advisory message and copyright
12 commands immediately afterward. 10 notice. You can begin typing Emacs commands immediately afterward.
13 11
14 Some operating systems insist on discarding all type-ahead when XEmacs 12 Some operating systems insist on discarding all type-ahead when Emacs
15 starts up; they give XEmacs no way to prevent this. Therefore, it is 13 starts up; they give Emacs no way to prevent this. Therefore, it is
16 advisable to wait until XEmacs clears the screen before typing your first 14 wise to wait until Emacs clears the screen before typing the first
17 editing command. 15 editing command.
18
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.
24 16
25 @vindex initial-major-mode 17 @vindex initial-major-mode
26 Before Emacs reads the first command, you have not had a chance to 18 Before Emacs reads the first command, you have not had a chance to
27 give a command to specify a file to edit. Since Emacs must always have 19 give a command to specify a file to edit. Since Emacs must always have a
28 a current buffer for editing, it presents a buffer, by default, a buffer 20 current buffer for editing, it presents a buffer, by default, a buffer named
29 named @samp{*scratch*}. The buffer is in Lisp Interaction mode; you can 21 @samp{*scratch*}. The buffer is in Lisp Interaction
30 use it to type Lisp expressions and evaluate them, or you can ignore 22 mode; you can use it to type Lisp expressions and evaluate them, or you
31 that capability and simply doodle. (You can specify a different major 23 can ignore that capability and simply doodle. You can specify a
32 mode for this buffer by setting the variable @code{initial-major-mode} 24 different major mode for this buffer by setting the variable
33 in your init file. @xref{Init File}.) 25 @code{initial-major-mode} in your init file. @xref{Init File}.
34 26
35 It is possible to specify files to be visited, Lisp files to be 27 It is possible to give Emacs arguments in the shell command line to
36 loaded, and functions to be called, by giving Emacs arguments in the 28 specify files to visit, Lisp files to load, and functions to call.
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.
40
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.
61 29
62 @node Exiting, Command Switches, Entering Emacs, Top 30 @node Exiting, Command Switches, Entering Emacs, Top
63 @section Exiting Emacs 31 @section Exiting Emacs
64 @cindex exiting 32 @cindex exiting
65 @cindex killing Emacs 33 @cindex killing Emacs
66 @cindex suspending 34 @cindex suspending
67 @cindex leaving Emacs
68 @cindex quitting Emacs
69 @cindex shrinking XEmacs frame 35 @cindex shrinking XEmacs frame
70 36
71 There are two commands for exiting Emacs because there are two kinds 37 There are two commands for exiting Emacs because there are two kinds
72 of exiting: @dfn{suspending} Emacs and @dfn{killing} Emacs. 38 of exiting: @dfn{suspending} Emacs and @dfn{killing} Emacs.
73 39 @dfn{Suspending} means stopping Emacs temporarily and returning control
74 @dfn{Suspending} means stopping Emacs temporarily and returning 40 to its superior (usually the shell), allowing you to resume editing
75 control to its parent process (usually a shell), allowing you to resume 41 later in the same Emacs job, with the same files, same kill ring, same
76 editing later in the same Emacs job, with the same buffers, same kill 42 undo history, and so on. This is the usual way to exit. @dfn{Killing}
77 ring, same undo history, and so on. This is the usual way to exit. 43 Emacs means destroying the Emacs job. You can run Emacs again later,
78 44 but you will get a fresh Emacs; there is no way to resume the same
79 @dfn{Killing} Emacs means destroying the Emacs job. You can run Emacs 45 editing session after it has been killed.
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.
82 46
83 @table @kbd 47 @table @kbd
84 @item C-z 48 @item C-z
85 Suspend Emacs or iconify a frame 49 Suspend Emacs (@code{suspend-emacs}). If used under the X window system,
86 (@code{suspend-emacs-or-iconify-frame}). If used under the X window 50 shrink the X window containing the Emacs frame to an icon (see below).
87 system, shrink the X window containing the Emacs frame to an icon (see
88 below).
89 @item C-x C-c 51 @item C-x C-c
90 Kill Emacs (@code{save-buffers-kill-emacs}). 52 Kill Emacs (@code{save-buffers-kill-emacs}).
91 @end table 53 @end table
92 54
93 If you use XEmacs under the X window system, @kbd{C-z} shrinks 55 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 56 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. 57 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 58 If more than one frame is associated with the Emacs process, only the
97 frame from which you used @kbd{C-z} is iconified. 59 frame from which you used @kbd{C-z} is retained. The X windows
60 containing the other Emacs frames are closed.
98 61
99 To activate the "suspended" Emacs, use the appropriate window manager 62 To activate the "suspended" Emacs, use the appropriate window manager
100 mouse gestures. Usually left-clicking on the icon reactivates and 63 mouse gestures. Usually left-clicking on the icon reactivates and
101 reopens the X window containing the Emacs frame, but the window manager 64 reopens the X window containing the Emacs frame, but the window manager
102 you use determines what exactly happens. To actually kill the Emacs 65 you use determines what exactly happens. To actually kill the Emacs
103 process, use @kbd{C-x C-c} or the @b{Exit XEmacs} item on the @b{File} 66 process, use @kbd{C-x C-c} or the @b{Exit Emacs} item on the @b{File}
104 menu. 67 menu.
105 68
106 @kindex C-z 69 @kindex C-z
107 @findex suspend-emacs 70 @findex suspend-emacs
108 To suspend Emacs, type @kbd{C-z} (@code{suspend-emacs}). This takes 71 On systems that do not permit programs to be suspended, @kbd{C-z} runs
109 you back to the shell from which you invoked Emacs. You can resume 72 an inferior shell that communicates directly with the terminal, and
110 Emacs with the shell command @samp{%xemacs} in most common shells. 73 Emacs waits until you exit the subshell. On these systems, the only way
111 74 to return to the shell from which Emacs was started (to log out, for
112 On systems that do not support suspending programs, @kbd{C-z} starts 75 example) is to kill Emacs. @kbd{C-d} or @code{exit} are typical
113 an inferior shell that communicates directly with the terminal. 76 commands to exit a subshell.
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.
132 77
133 @kindex C-x C-c 78 @kindex C-x C-c
134 @findex save-buffers-kill-emacs 79 @findex save-buffers-kill-emacs
135 To kill Emacs, type @kbd{C-x C-c} (@code{save-buffers-kill-emacs}). A 80 To kill Emacs, type @kbd{C-x C-c} (@code{save-buffers-kill-emacs}). A
136 two-character key is used for this to make it harder to type. Selecting 81 two-character key is used for this to make it harder to type. In
137 the @b{Exit XEmacs} option of the @b{File} menu is an alternate way of 82 XEmacs, selecting the @b{Exit Emacs} option of the @b{File} menu is an
138 issuing the command. 83 alternate way of issuing the command.
139 84
140 Unless a numeric argument is used, this command first offers to save any 85 Unless a numeric argument is used, this command first offers to save any
141 modified file-visiting buffers. If you do not save all buffers, you are 86 modified buffers. If you do not save all buffers, you are asked for
142 asked for reconfirmation with @kbd{yes} before killing Emacs, since any 87 reconfirmation with @kbd{yes} before killing Emacs, since any changes
143 changes not saved will be lost forever. If any subprocesses are still 88 not saved will be lost. If any subprocesses are still running, @kbd{C-x
144 running, @kbd{C-x C-c} asks you to confirm killing them, since killing 89 C-c} asks you to confirm killing them, since killing Emacs kills the
145 Emacs will kill the subprocesses immediately. 90 subprocesses simultaneously.
146 91
147 There is no way to restart an Emacs session once you have killed it. 92 In most programs running on Unix, certain characters may instantly
148 You can, however, arrange for Emacs to record certain session 93 suspend or kill the program. (In Berkeley Unix these characters are
149 information, such as which files are visited, when you kill it, so that 94 normally @kbd{C-z} and @kbd{C-c}.) @i{This Unix feature is turned off
150 the next time you restart Emacs it will try to visit the same files and 95 while you are in Emacs.} The meanings of @kbd{C-z} and @kbd{C-x C-c} as
151 so on. 96 keys in Emacs were inspired by the standard Berkeley Unix meanings of
152 @c @xref{Saving Emacs Sessions}. 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}).
153 99
154 The operating system usually listens for certain special characters 100 @c ??? What about system V here?
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}).