comparison man/xemacs/entering.texi @ 408:501cfd01ee6d r21-2-34

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