Mercurial > emacs
annotate man/entering.texi @ 74405:8289a04178f1
*** empty log message ***
author | Kim F. Storm <storm@cua.dk> |
---|---|
date | Mon, 04 Dec 2006 12:26:35 +0000 |
parents | b327bddebef6 |
children | 523d34e0b6b3 6823a91487f2 |
rev | line source |
---|---|
25829 | 1 @c This is part of the Emacs manual. |
64890
3723093a21fd
Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
59950
diff
changeset
|
2 @c Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 2002, 2003, 2004, |
68639
dc2d5a6655a3
Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
68458
diff
changeset
|
3 @c 2005, 2006 Free Software Foundation, Inc. |
25829 | 4 @c See file emacs.texi for copying conditions. |
5 @node Entering Emacs, Exiting, Text Characters, Top | |
6 @chapter Entering and Exiting Emacs | |
7 @cindex entering Emacs | |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46913
diff
changeset
|
8 @cindex starting Emacs |
25829 | 9 |
68458 | 10 The usual way to invoke Emacs is with the shell command |
70359 | 11 @command{emacs}. Emacs clears the screen, then displays an initial |
12 help message and copyright notice. Some operating systems discard | |
13 your type-ahead when Emacs starts up; they give Emacs no way to | |
14 prevent this. On those systems, wait for Emacs to clear the screen | |
15 before you start typing. | |
25829 | 16 |
70359 | 17 From a shell window under the X Window System, run Emacs in the |
18 background with @command{emacs&}. This way, Emacs won't tie up the | |
19 shell window, so you can use it to run other shell commands while | |
20 Emacs is running. You can type Emacs commands as soon as you direct | |
21 your keyboard input to an Emacs frame. | |
25829 | 22 |
23 @vindex initial-major-mode | |
38954 | 24 When Emacs starts up, it creates a buffer named @samp{*scratch*}. |
68458 | 25 That's the buffer you start out in. The @samp{*scratch*} buffer uses |
26 Lisp Interaction mode; you can use it to type Lisp expressions and | |
70359 | 27 evaluate them. You can also ignore that capability and just write notes |
28 there. You can specify a different major mode for this buffer by | |
68458 | 29 setting the variable @code{initial-major-mode} in your init file. |
70359 | 30 @xref{Init File}. |
25829 | 31 |
32 It is possible to specify files to be visited, Lisp files to be | |
70359 | 33 loaded, and functions to be called through Emacs command-line |
34 arguments. @xref{Emacs Invocation}. The feature exists mainly for | |
35 compatibility with other editors, and for scripts. | |
25829 | 36 |
70359 | 37 Many editors are designed to edit one file. When done with that |
38 file, you exit the editor. The next time you want to edit a file, you | |
39 must start the editor again. Working this way, it is convenient to | |
40 use a command-line argument to say which file to edit. | |
25829 | 41 |
70359 | 42 It's not smart to start Emacs afresh for every file you edit. Emacs |
43 can visit more than one file in a single editing session, and upon | |
44 exit Emacs loses valuable accumulated context, such as the kill ring, | |
45 registers, undo history, and mark ring. These features are useful for | |
46 operating on multiple files, or even one. If you kill Emacs after | |
47 each file, you don't take advantage of them. | |
25829 | 48 |
49 The recommended way to use GNU Emacs is to start it only once, just | |
50 after you log in, and do all your editing in the same Emacs session. | |
70359 | 51 Each time you edit a file, you visit it with the existing Emacs, which |
52 eventually has many files in it ready for editing. Usually you do not | |
53 kill Emacs until you are about to log out. @xref{Files}, for more | |
54 information on visiting more than one file. | |
25829 | 55 |
70359 | 56 To edit a file from another program while Emacs is running, you can |
57 use the @command{emacsclient} helper program to open a file in the | |
58 already running Emacs. @xref{Emacs Server}. | |
46913
861d4dd87bd7
Mention emacsclient, with xref.
Richard M. Stallman <rms@gnu.org>
parents:
38954
diff
changeset
|
59 |
56810
24bffa640391
Adapt sectioning in Info to the node structure.
Luc Teirlinck <teirllm@auburn.edu>
parents:
52401
diff
changeset
|
60 @ifnottex |
24bffa640391
Adapt sectioning in Info to the node structure.
Luc Teirlinck <teirllm@auburn.edu>
parents:
52401
diff
changeset
|
61 @raisesections |
24bffa640391
Adapt sectioning in Info to the node structure.
Luc Teirlinck <teirllm@auburn.edu>
parents:
52401
diff
changeset
|
62 @end ifnottex |
24bffa640391
Adapt sectioning in Info to the node structure.
Luc Teirlinck <teirllm@auburn.edu>
parents:
52401
diff
changeset
|
63 |
25829 | 64 @node Exiting, Basic, Entering Emacs, Top |
65 @section Exiting Emacs | |
66 @cindex exiting | |
67 @cindex killing Emacs | |
68 @cindex suspending | |
69 @cindex leaving Emacs | |
70 @cindex quitting Emacs | |
71 | |
72522
b327bddebef6
(Exiting): Rewrite to give graphical displays priority over text terminals.
Richard M. Stallman <rms@gnu.org>
parents:
70359
diff
changeset
|
72 There are two commands for exiting Emacs, and three kinds of |
b327bddebef6
(Exiting): Rewrite to give graphical displays priority over text terminals.
Richard M. Stallman <rms@gnu.org>
parents:
70359
diff
changeset
|
73 exiting: @dfn{iconifying} Emacs, @dfn{suspending} Emacs, and |
b327bddebef6
(Exiting): Rewrite to give graphical displays priority over text terminals.
Richard M. Stallman <rms@gnu.org>
parents:
70359
diff
changeset
|
74 @dfn{killing} Emacs. |
b327bddebef6
(Exiting): Rewrite to give graphical displays priority over text terminals.
Richard M. Stallman <rms@gnu.org>
parents:
70359
diff
changeset
|
75 |
b327bddebef6
(Exiting): Rewrite to give graphical displays priority over text terminals.
Richard M. Stallman <rms@gnu.org>
parents:
70359
diff
changeset
|
76 @dfn{Iconifying} means replacing the Emacs frame with a small box or |
b327bddebef6
(Exiting): Rewrite to give graphical displays priority over text terminals.
Richard M. Stallman <rms@gnu.org>
parents:
70359
diff
changeset
|
77 ``icon'' on the screen. This is the usual way to exit Emacs when |
b327bddebef6
(Exiting): Rewrite to give graphical displays priority over text terminals.
Richard M. Stallman <rms@gnu.org>
parents:
70359
diff
changeset
|
78 you're using a graphical display---if you bother to ``exit'' at all. |
b327bddebef6
(Exiting): Rewrite to give graphical displays priority over text terminals.
Richard M. Stallman <rms@gnu.org>
parents:
70359
diff
changeset
|
79 (Just switching to another application is usually sufficient.) |
25829 | 80 |
81 @dfn{Suspending} means stopping Emacs temporarily and returning | |
72522
b327bddebef6
(Exiting): Rewrite to give graphical displays priority over text terminals.
Richard M. Stallman <rms@gnu.org>
parents:
70359
diff
changeset
|
82 control to its parent process (usually a shell), allowing you to |
b327bddebef6
(Exiting): Rewrite to give graphical displays priority over text terminals.
Richard M. Stallman <rms@gnu.org>
parents:
70359
diff
changeset
|
83 resume editing later in the same Emacs job. This is the usual way to |
b327bddebef6
(Exiting): Rewrite to give graphical displays priority over text terminals.
Richard M. Stallman <rms@gnu.org>
parents:
70359
diff
changeset
|
84 exit Emacs when running it on a text terminal. |
25829 | 85 |
86 @dfn{Killing} Emacs means destroying the Emacs job. You can run Emacs | |
87 again later, but you will get a fresh Emacs; there is no way to resume | |
88 the same editing session after it has been killed. | |
89 | |
90 @table @kbd | |
91 @item C-z | |
92 Suspend Emacs (@code{suspend-emacs}) or iconify a frame | |
93 (@code{iconify-or-deiconify-frame}). | |
94 @item C-x C-c | |
95 Kill Emacs (@code{save-buffers-kill-emacs}). | |
96 @end table | |
97 | |
98 @kindex C-z | |
72522
b327bddebef6
(Exiting): Rewrite to give graphical displays priority over text terminals.
Richard M. Stallman <rms@gnu.org>
parents:
70359
diff
changeset
|
99 @findex iconify-or-deiconify-frame |
b327bddebef6
(Exiting): Rewrite to give graphical displays priority over text terminals.
Richard M. Stallman <rms@gnu.org>
parents:
70359
diff
changeset
|
100 On graphical displays, @kbd{C-z} runs the command |
b327bddebef6
(Exiting): Rewrite to give graphical displays priority over text terminals.
Richard M. Stallman <rms@gnu.org>
parents:
70359
diff
changeset
|
101 @code{iconify-or-deiconify-frame}, which temporarily iconifies (or |
b327bddebef6
(Exiting): Rewrite to give graphical displays priority over text terminals.
Richard M. Stallman <rms@gnu.org>
parents:
70359
diff
changeset
|
102 ``minimizes'') the selected Emacs frame (@pxref{Frames}). You can |
b327bddebef6
(Exiting): Rewrite to give graphical displays priority over text terminals.
Richard M. Stallman <rms@gnu.org>
parents:
70359
diff
changeset
|
103 then use the window manager to select some other application. (You |
b327bddebef6
(Exiting): Rewrite to give graphical displays priority over text terminals.
Richard M. Stallman <rms@gnu.org>
parents:
70359
diff
changeset
|
104 could select another application without iconifying Emacs first, but |
b327bddebef6
(Exiting): Rewrite to give graphical displays priority over text terminals.
Richard M. Stallman <rms@gnu.org>
parents:
70359
diff
changeset
|
105 getting the Emacs frame out of the way can make it more convenient to |
b327bddebef6
(Exiting): Rewrite to give graphical displays priority over text terminals.
Richard M. Stallman <rms@gnu.org>
parents:
70359
diff
changeset
|
106 find the other application.) |
b327bddebef6
(Exiting): Rewrite to give graphical displays priority over text terminals.
Richard M. Stallman <rms@gnu.org>
parents:
70359
diff
changeset
|
107 |
25829 | 108 @findex suspend-emacs |
72522
b327bddebef6
(Exiting): Rewrite to give graphical displays priority over text terminals.
Richard M. Stallman <rms@gnu.org>
parents:
70359
diff
changeset
|
109 On a text terminal, @kbd{C-z} runs the command @code{suspend-emacs}. |
b327bddebef6
(Exiting): Rewrite to give graphical displays priority over text terminals.
Richard M. Stallman <rms@gnu.org>
parents:
70359
diff
changeset
|
110 Suspending Emacs takes you back to the shell from which you invoked |
59950
e0bfdf477815
(Entering Emacs): Update rationale at start.
Richard M. Stallman <rms@gnu.org>
parents:
58789
diff
changeset
|
111 Emacs. You can resume Emacs with the shell command @command{%emacs} |
e0bfdf477815
(Entering Emacs): Update rationale at start.
Richard M. Stallman <rms@gnu.org>
parents:
58789
diff
changeset
|
112 in most common shells. On systems that don't support suspending |
e0bfdf477815
(Entering Emacs): Update rationale at start.
Richard M. Stallman <rms@gnu.org>
parents:
58789
diff
changeset
|
113 programs, @kbd{C-z} starts an inferior shell that communicates |
70359 | 114 directly with the terminal, and Emacs waits until you exit the |
115 subshell. (The way to do that is probably with @kbd{C-d} or | |
116 @command{exit}, but it depends on which shell you use.) On these | |
117 systems, you can only get back to the shell from which Emacs was run | |
118 (to log out, for example) when you kill Emacs. | |
25829 | 119 |
72522
b327bddebef6
(Exiting): Rewrite to give graphical displays priority over text terminals.
Richard M. Stallman <rms@gnu.org>
parents:
70359
diff
changeset
|
120 @vindex cannot-suspend |
59950
e0bfdf477815
(Entering Emacs): Update rationale at start.
Richard M. Stallman <rms@gnu.org>
parents:
58789
diff
changeset
|
121 Suspending can fail if you run Emacs under a shell that doesn't |
72522
b327bddebef6
(Exiting): Rewrite to give graphical displays priority over text terminals.
Richard M. Stallman <rms@gnu.org>
parents:
70359
diff
changeset
|
122 support suspendion of its subjobs, even if the system itself does |
b327bddebef6
(Exiting): Rewrite to give graphical displays priority over text terminals.
Richard M. Stallman <rms@gnu.org>
parents:
70359
diff
changeset
|
123 support it. In such a case, you can set the variable |
b327bddebef6
(Exiting): Rewrite to give graphical displays priority over text terminals.
Richard M. Stallman <rms@gnu.org>
parents:
70359
diff
changeset
|
124 @code{cannot-suspend} to a non-@code{nil} value to force @kbd{C-z} to |
b327bddebef6
(Exiting): Rewrite to give graphical displays priority over text terminals.
Richard M. Stallman <rms@gnu.org>
parents:
70359
diff
changeset
|
125 start an inferior shell. |
25829 | 126 |
127 @kindex C-x C-c | |
128 @findex save-buffers-kill-emacs | |
38954 | 129 To exit and kill Emacs, type @kbd{C-x C-c} |
70359 | 130 (@code{save-buffers-kill-emacs}). A two-character key is used to make |
131 it harder to type by accident. This command first offers to save any | |
132 modified file-visiting buffers. If you do not save them all, it asks | |
133 for confirmation with @kbd{yes} before killing Emacs, since any | |
134 changes not saved now will be lost forever. Also, if any subprocesses are | |
135 still running, @kbd{C-x C-c} asks for confirmation about them, since | |
136 killing Emacs will also kill the subprocesses. | |
25829 | 137 |
38920
caf015ed2aea
Document confirm-kill-emacs.
Eli Zaretskii <eliz@gnu.org>
parents:
38172
diff
changeset
|
138 @vindex confirm-kill-emacs |
caf015ed2aea
Document confirm-kill-emacs.
Eli Zaretskii <eliz@gnu.org>
parents:
38172
diff
changeset
|
139 If the value of the variable @code{confirm-kill-emacs} is |
caf015ed2aea
Document confirm-kill-emacs.
Eli Zaretskii <eliz@gnu.org>
parents:
38172
diff
changeset
|
140 non-@code{nil}, @kbd{C-x C-c} assumes that its value is a predicate |
caf015ed2aea
Document confirm-kill-emacs.
Eli Zaretskii <eliz@gnu.org>
parents:
38172
diff
changeset
|
141 function, and calls that function. If the result is non-@code{nil}, the |
caf015ed2aea
Document confirm-kill-emacs.
Eli Zaretskii <eliz@gnu.org>
parents:
38172
diff
changeset
|
142 session is killed, otherwise Emacs continues to run. One convenient |
caf015ed2aea
Document confirm-kill-emacs.
Eli Zaretskii <eliz@gnu.org>
parents:
38172
diff
changeset
|
143 function to use as the value of @code{confirm-kill-emacs} is the |
caf015ed2aea
Document confirm-kill-emacs.
Eli Zaretskii <eliz@gnu.org>
parents:
38172
diff
changeset
|
144 function @code{yes-or-no-p}. The default value of |
caf015ed2aea
Document confirm-kill-emacs.
Eli Zaretskii <eliz@gnu.org>
parents:
38172
diff
changeset
|
145 @code{confirm-kill-emacs} is @code{nil}. |
caf015ed2aea
Document confirm-kill-emacs.
Eli Zaretskii <eliz@gnu.org>
parents:
38172
diff
changeset
|
146 |
70359 | 147 You can't resume an Emacs session after killing it. Emacs can, |
148 however, record certain session information when you kill it, such as | |
149 which files you visited, so the next time you start Emacs it will try | |
150 to visit the same files. @xref{Saving Emacs Sessions}. | |
25829 | 151 |
152 The operating system usually listens for certain special characters | |
153 whose meaning is to kill or suspend the program you are running. | |
154 @b{This operating system feature is turned off while you are in Emacs.} | |
155 The meanings of @kbd{C-z} and @kbd{C-x C-c} as keys in Emacs were | |
156 inspired by the use of @kbd{C-z} and @kbd{C-c} on several operating | |
157 systems as the characters for stopping or killing a program, but that is | |
158 their only relationship with the operating system. You can customize | |
159 these keys to run any commands of your choice (@pxref{Keymaps}). | |
52401 | 160 |
56810
24bffa640391
Adapt sectioning in Info to the node structure.
Luc Teirlinck <teirllm@auburn.edu>
parents:
52401
diff
changeset
|
161 @ifnottex |
24bffa640391
Adapt sectioning in Info to the node structure.
Luc Teirlinck <teirllm@auburn.edu>
parents:
52401
diff
changeset
|
162 @lowersections |
24bffa640391
Adapt sectioning in Info to the node structure.
Luc Teirlinck <teirllm@auburn.edu>
parents:
52401
diff
changeset
|
163 @end ifnottex |
24bffa640391
Adapt sectioning in Info to the node structure.
Luc Teirlinck <teirllm@auburn.edu>
parents:
52401
diff
changeset
|
164 |
52401 | 165 @ignore |
166 arch-tag: df798d8b-f253-4113-b585-f528f078a944 | |
167 @end ignore |