File: entering.texi

package info (click to toggle)
emacs-manual-ja 20.5-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 2,964 kB
  • ctags: 12
  • sloc: lisp: 119; ansic: 69; makefile: 43; sh: 28
file content (262 lines) | stat: -rw-r--r-- 14,563 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
@c =============================================================
@c = $B85(B $BK](B $BLu(B: $B9b<.0l5*!wEE5$DL?.Bg3X(B
@c = $B2CI.=$@5(B: $BBgLZFXM:!wBgDM(B.$BC^GHBg3X(B = 1998/11/25
@c =============================================================
@c This is part of the Emacs manual.
@c Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995 Free Software Foundation, Inc.
@c See file emacs.texi for copying conditions.
@node Entering Emacs, Exiting, Text Characters, Top
@c @chapter Entering and Exiting Emacs
@chapter Emacs$B$N5/F0$H=*N;(B
@c @cindex entering Emacs
@c @cindex starting Emacs 
@cindex Emacs$B$N5/F0(B
@cindex Emacs$B$N;OF0(B

@c   The usual way to invoke Emacs is with the shell command @samp{emacs}.
@c Emacs clears the screen and then displays an initial help message and
@c copyright notice.  Some operating systems discard all type-ahead when
@c Emacs starts up; they give Emacs no way to prevent this.  Therefore, it
@c is advisable to wait until Emacs clears the screen before typing your
@c first editing command.
Emacs$B$r5/F0$9$kIaDL$NJ}K!$O!"%7%'%k%3%^%s%I$N(B@samp{emacs}$B$G$9!#(B
Emacs$B$O!"2hLL$r%/%j%"$7!"=i4|%X%k%W%a%C%;!<%8$H%3%T!<%i%$%H$rI=<($7$^$9!#(B
$B%*%Z%l!<%F%#%s%0%7%9%F%`$K$h$C$F$O!"(BEmacs$B$,5/F0$9$k$^$G$K(B
$B@hBG$A$7$?F~NO$r$9$Y$FGK4~$7$F$7$^$&$3$H$,$"$j$^$9!#(B
Emacs$BB&$G$O$3$l$rKI$0$3$H$O$G$-$^$;$s!#(B
$B$7$?$,$C$F!"JT=8%3%^%s%I$rBG$A;O$a$k$^$($K!"(B
Emacs$B$,2hLL$r%/%j%"$9$k$^$GBT$D$h$&$K?d>)$7$^$9!#(B

@c   If you run Emacs from a shell window under the X Window System, run it
@c in the background with @samp{emacs&}.  This way, Emacs does not tie up
@c the shell window, so you can use that to run other shell commands while
@c Emacs operates its own X windows.  You can begin typing Emacs commands
@c as soon as you direct your keyboard input to the Emacs frame.
X$B%&%#%s%I%&%7%9%F%`>e$N%7%'%k%&%#%s%I%&$+$i(BEmacs$B$r5/F0$9$k$N$G$"$l$P!"(B
@samp{emacs&}$B$N$h$&$K%P%C%/%0%i%&%s%I$G<B9T$9$k$h$&$K$7$^$7$g$&!#(B
$B$3$&$9$l$P!"(BEmacs$B$,%7%'%k%&%#%s%I%&$r94B+$9$k$3$H$,$J$$$N$G!"(B
Emacs$B$,@lMQ$N(BX$B$N%&%#%s%I%&$GF0:nCf$G$b!"(B
$BJL$N%7%'%k%3%^%s%I$r<B9T$G$-$^$9!#(B
$B%-!<%\!<%IF~NO$r(BEmacs$B$N%U%l!<%`$K8~$1$l$P!"(B
$B$?$@$A$K(BEmacs$B%3%^%s%I$rBG$A;O$a$i$l$^$9!#(B

@vindex initial-major-mode
@c   When Emacs starts up, it makes a buffer named @samp{*scratch*}.
@c That's the buffer you start out in.  The @samp{*scratch*} buffer uses Lisp
@c Interaction mode; you can use it to type Lisp expressions and evaluate
@c them, or you can ignore that capability and simply doodle.  (You can
@c specify a different major mode for this buffer by setting the variable
@c @code{initial-major-mode} in your init file.  @xref{Init File}.)
Emacs$B$,F0$-;O$a$k$H!"(B@samp{*scratch*}$B$H$$$&L>A0$N%P%C%U%!$r:n$j$^$9!#(B
$B%f!<%6!<$O$3$N%P%C%U%!$+$i;O$a$^$9!#(B
$B%P%C%U%!(B@samp{*scratch*}$B$O!"(BLisp$BBPOC!J(Blisp-interaction$B!K%b!<%I$G$9$+$i!"(B
Lisp$B<0$rBG$A9~$s$G$=$l$rI>2A$G$-$^$9$7!"$"$k$$$O!"(B
$B$3$N5!G=$rL5;k$7$FC1$J$kMn=qMQ$H$7$F;H$C$F$b$+$^$$$^$;$s!#(B
$B!J8D?M$N=i4|2=%U%!%$%kCf$GJQ?t(B@code{initial-major-mode}$B$r@_Dj$9$l$P!"(B
$B$3$N%P%C%U%!$KJL$N%a%8%c!<%b!<%I$r;XDj$G$-$k!#(B
@pxref{Init File}$B!#!K(B

@c   It is possible to specify files to be visited, Lisp files to be
@c loaded, and functions to be called, by giving Emacs arguments in the
@c shell command line.  @xref{Command Arguments}.  But we don't recommend
@c doing this.  The feature exists mainly for compatibility with other
@c editors.
$B%7%'%k$N%3%^%s%I9T$G(BEmacs$B$K0z?t$rM?$($F!"(B
$BK,Ld$9$k%U%!%$%k!"%m!<%I$9$k(BLisp$B%U%!%$%k!"8F$S=P$94X?t$r;XDj$G$-$^$9!#(B
@xref{Command Arguments}$B!#(B
$B$?$@$7!"$3$l$O$*4+$a$7$^$;$s!#(B
$B$3$N5!G=$O!"<g$K!"B>$N%(%G%#%?$H$N8_49@-$N$?$a$K$"$k$N$G$9!#(B

@c   Many other editors are designed to be started afresh each time you
@c want to edit.  You edit one file and then exit the editor.  The next
@c time you want to edit either another file or the same one, you must run
@c the editor again.  With these editors, it makes sense to use a
@c command-line argument to say which file to edit.
$BB>$N%(%G%#%?$NB?$/$O!"JT=8$r9T$&$?$S$K?7$?$K5/F0$9$k$h$&$K@_7W$5$l$F$$$^$9!#(B
1$B$D$N%U%!%$%k$rJT=8$7=*$($k$H!"%(%G%#%?$r=*N;$7$^$9!#(B
$B$D$.$KJL$N%U%!%$%k$dF1$8%U%!%$%k$rJT=8$7$?$1$l$P!"(B
$B:FEY!"%(%G%#%?$r5/F0$9$kI,MW$,$"$j$^$9!#(B
$B$3$l$i$N%(%G%#%?$G$O!"(B
$B%3%^%s%I9T$N0z?t$GJT=8$9$k%U%!%$%k$r;XDj$9$k0UL#$,$"$j$^$9!#(B

@c   But starting a new Emacs each time you want to edit a different file
@c does not make sense.  For one thing, this would be annoyingly slow.  For
@c another, this would fail to take advantage of Emacs's ability to visit
@c more than one file in a single editing session.  And it would lose the
@c other accumulated context, such as registers, undo history, and the mark
@c ring.
$B$7$+$7!"JL$N%U%!%$%k$rJT=8$9$k$?$S$K?7$?$K(BEmacs$B$r5/F0$9$k$N$O%J%s%;%s%9$G$9!#(B
1$B$D$K$O!"5/F0$O$8$l$C$?$$$[$ICY$$$G$7$g$&!#(B
$B$^$?!"$3$N$h$&$K$9$k$H!"(B1$B$D$NJT=8%;%C%7%g%s$GJ#?t$N%U%!%$%k$r(B
$B07$($k(BEmacs$B$NMxE@$r3h$+$;$^$;$s!#(B
$B$5$i$K!"%l%8%9%?$d%"%s%I%%MzNr!"%^!<%/%j%s%0$H$$$C$?!"(B
$B$=$l$^$G$KC_@Q$7$?FbMF$b<:$C$F$7$^$$$^$9!#(B

@c   The recommended way to use GNU Emacs is to start it only once, just
@c after you log in, and do all your editing in the same Emacs session.
@c Each time you want to edit a different file, you visit it with the
@c existing Emacs, which eventually comes to have many files in it ready
@c for editing.  Usually you do not kill the Emacs until you are about to
@c log out.  @xref{Files}, for more information on visiting more than one
@c file.
GNU Emacs$B$N?d>)$5$l$k;H$$J}$O!"%m%0%$%s8e$K(B1$BEY$@$1(BEmacs$B$r5/F0$7$F!"(B
$B$9$Y$F$NJT=8$rF1$8(BEmacs$B%;%C%7%g%s$G9T$&$3$H$G$9!#(B
$BJL$N%U%!%$%k$rJT=8$9$k$K$O!"4{B8$N(BEmacs$B$G$=$N%U%!%$%k$rK,Ld$7$^$9!#(B
$B$=$&$9$k$H!"$D$$$K$O!"B?$/$N%U%!%$%k$r$9$0$KJT=8$G$-$k>uBV$G(B
$BJ];}$9$k$3$H$K$J$j$^$9!#(B
$BDL>o!"%m%0%"%&%H$9$k$^$G!"(BEmacs$B$r=*N;$9$kI,MW$O$"$j$^$;$s!#(B
$BJ#?t$N%U%!%$%k$rK,Ld$9$k$3$H$K4X$7$F>\$7$/$O!"(B@xref{Files}$B!#(B

@node Exiting, Basic, Entering Emacs, Top
@c @section Exiting Emacs
@section Emacs$B$N=*N;(B
@c @cindex exiting
@c @cindex killing Emacs
@c @cindex suspending
@c @cindex leaving Emacs
@c @cindex quitting Emacs
@cindex $B=*N;(B
@cindex Emacs$B$N=*N;(B
@cindex $B5Y;_(B
@cindex Emacs$B$N5Y;_(B

@c   There are two commands for exiting Emacs because there are two kinds
@c of exiting: @dfn{suspending} Emacs and @dfn{killing} Emacs.
Emacs$B$NH4$1J}$K$O!"(B@dfn{$B5Y;_(B}$B!J(Bsuspending$B!K$9$k!"(B
@dfn{$B=*N;(B}$B!J(Bkilling$B!K$9$k$N(B2$B<oN`$,$"$k$N$G!"(B
Emacs$B$rH4$1$k%3%^%s%I$b(B2$B$D$"$j$^$9!#(B

@c   @dfn{Suspending} means stopping Emacs temporarily and returning
@c control to its parent process (usually a shell), allowing you to resume
@c editing later in the same Emacs job, with the same buffers, same kill
@c ring, same undo history, and so on.  This is the usual way to exit.
@dfn{$B5Y;_(B}$B!J(Bsuspending$B!K$O!"0l;~E*$K(BEmacs$B$r;_$a$F!"(B
$B?F%W%m%;%9!JDL>o$O%7%'%k!K$K@)8f$rLa$7$^$9!#(B
$B$3$&$9$k$H!"F1$8%P%C%U%!!"F1$8%-%k%j%s%0!"F1$8%"%s%I%%MzNr$rJ];}$7$?$^$^$N(B
$BF1$8(BEmacs$B%8%g%V$r$"$H$G:F3+$G$-$^$9!#(B
$B$3$l$,DL>o$NH4$1J}(B
@footnote{$B!ZLuCm![$3$l$O!"2hLLC<Kv$r;H$C$F$$$k>l9g$NOC!#(B}$B$G$9!#(B

@c   @dfn{Killing} Emacs means destroying the Emacs job.  You can run Emacs
@c again later, but you will get a fresh Emacs; there is no way to resume
@c the same editing session after it has been killed.
@dfn{$B=*N;(B}$B!J(Bkilling$B!K$O!"(BEmacs$B%8%g%V$NGK2u$r0UL#$7$^$9!#(B
$B$"$H$G$^$?(BEmacs$B$r5/F0$G$-$^$9$,!"?7$?$J(BEmacs$B4D6-$G$9!#(B
$B=*N;$7$?$"$H$G$O!"F1$8JT=8%;%C%7%g%s$r:F3+$9$kJ}K!$O$"$j$^$;$s!#(B

@table @kbd
@item C-z
@c Suspend Emacs (@code{suspend-emacs}) or iconify a frame
@c (@code{iconify-or-deiconify-frame}).
Emacs$B$r5Y;_$9$k!"$"$k$$$O!"%U%l!<%`$r%"%$%3%s2=$9$k(B
$B!J(B@code{iconify-or-deiconify-frame}$B!K!#(B
@item C-x C-c
@c Kill Emacs (@code{save-buffers-kill-emacs}).
Emacs$B$r=*N;$9$k!J(B@code{save-buffers-kill-emacs}$B!K!#(B
@end table

@kindex C-z
@findex suspend-emacs
@c   To suspend Emacs, type @kbd{C-z} (@code{suspend-emacs}).  This takes
@c you back to the shell from which you invoked Emacs.  You can resume
@c Emacs with the shell command @samp{%emacs} in most common shells.
Emacs$B$r5Y;_$9$k$K$O!"(B@kbd{C-z}$B!J(B@code{suspend-emacs}$B!K$HBG$A$^$9!#(B
$B$9$k$H!"(BEmacs$B$r5/F0$7$?%7%'%k$KLa$j$^$9!#(B
$B$[$H$s$I$N0lHLE*$J%7%'%k$G$O!"(B
$B%7%'%k%3%^%s%I(B@samp{%emacs}$B$G(BEmacs$B$r:F3+$G$-$^$9!#(B

@c   On systems that do not support suspending programs, @kbd{C-z} starts
@c an inferior shell that communicates directly with the terminal.
@c Emacs waits until you exit the subshell.  (The way to do that is
@c probably with @kbd{C-d} or @samp{exit}, but it depends on which shell
@c you use.)  The only way on these systems to get back to the shell from
@c which Emacs was run (to log out, for example) is to kill Emacs.
$B%W%m%0%i%`$r5Y;_$G$-$J$$%7%9%F%`$G$O!"(B
@kbd{C-z}$B$O!"C<Kv$HD>@\$d$j$H$j$9$k2<0L%7%'%k$r5/F0$7$^$9!#(B
Emacs$B$O!"%f!<%6!<$,$3$N%5%V%7%'%k$+$iH4$1=P$k$^$GBT$A$^$9!#(B
$B!JIaDL!"(B@kbd{C-d}$B$d(B@samp{exit}$B$G%5%V%7%'%k$r=*N;$9$k$O$:$@$,!"(B
$B;H$C$F$$$k%7%'%k$K0MB8$9$k!#!K(B
$B$3$N$h$&$J%7%9%F%`$G$O!"(B
Emacs$B$r5/F0$7$?%7%'%k$K!J$?$H$($P%m%0%"%&%H$N$?$a$K!KLa$k$K$O!"(B
Emacs$B$r=*N;$9$k0J30$KJ}K!$O$"$j$^$;$s!#(B

@c   Suspending also fails if you run Emacs under a shell that doesn't
@c support suspending programs, even if the system itself does support it.
@c In such a case, you can set the variable @code{cannot-suspend} to a
@c non-@code{nil} value to force @kbd{C-z} to start an inferior shell.
@c (One might also describe Emacs's parent shell as ``inferior'' for
@c failing to support job control properly, but that is a matter of taste.)
$B%W%m%0%i%`$r5Y;_$G$-$k%7%9%F%`$G$"$C$F$b!"(B
$B%W%m%0%i%`$r5Y;_$G$-$J$$%7%'%k>e$G<B9T$7$F$$$k(BEmacs$B$O5Y;_$G$-$^$;$s!#(B
$B$3$N$h$&$J>l9g!"JQ?t(B@code{cannot-suspend}$B$K(B@code{nil}$B0J30$NCM$r@_Dj$7$F!"(B
@kbd{C-z}$B$K2<0L%7%'%k$N<B9T$r6/@)$G$-$^$9!#(B
$B!JE,@Z$J%8%g%V@)8f$r$G$-$J$$(BEmacs$B$N?F%7%'%k$r(B
$B!X2<0L!Y$H8F$V$3$H$b$G$-$k$,!"$3$l$O9%$_$NLdBj!#!K(B

@c   When Emacs communicates directly with an X server and creates its own
@c dedicated X windows, @kbd{C-z} has a different meaning.  Suspending an
@c applications that uses its own X windows is not meaningful or useful.
@c Instead, @kbd{C-z} runs the command @code{iconify-or-deiconify-frame},
@c which temporarily closes up the selected Emacs frame (@pxref{Frames}).
@c The way to get back to a shell window is with the window manager.
Emacs$B$,(BX$B%5!<%P!<$HD>@\DL?.$7$F@lMQ$N(BX$B$N%&%#%s%I%&$r:n$C$F$$$k>l9g$K$O!"(B
@kbd{C-z}$B$OJL$N0UL#$K$J$j$^$9!#(B
$B@lMQ$N(BX$B$N%&%#%s%I%&$r;}$D%"%W%j%1!<%7%g%s$r5Y;_$7$F$b!"(B
$B$"$^$j0UL#$,$"$j$^$;$s$7!"JXMx$J$o$1$G$b$"$j$^$;$s!#(B
$B$=$N$+$o$j!"(B@kbd{C-z}$B$O!"A*Br$5$l$F$$$k(BEmacs$B%U%l!<%`!J(B@pxref{Frames}$B!K$r(B
$B0l;~E*$KJD$8$k%3%^%s%I(B@code{iconify-or-deiconify-frame}$B$r<B9T$7$^$9!#(B
$B%7%'%k%&%#%s%I%&$KLa$k$K$O!"%&%#%s%I%&%^%M!<%8%c$N5!G=$r;H$$$^$9!#(B

@kindex C-x C-c
@findex save-buffers-kill-emacs
@c   To kill Emacs, type @kbd{C-x C-c} (@code{save-buffers-kill-emacs}).  A
@c two-character key is used for this to make it harder to type.  This
@c command first offers to save any modified file-visiting buffers.  If you
@c do not save them all, it asks for reconfirmation with @kbd{yes} before
@c killing Emacs, since any changes not saved will be lost forever.  Also,
@c if any subprocesses are still running, @kbd{C-x C-c} asks for
@c confirmation about them, since killing Emacs will kill the subprocesses
@c immediately.
Emacs$B$r=*N;$9$k$K$O!"(B@kbd{C-x C-c}
$B!J(B@code{save-buffers-kill-emacs}$B!K$HBG$A$^$9!#(B
$B$3$l$r(B2$BJ8;z$N%-!<$K$7$F$"$k$N$O!">/!9BG$A$E$i$/(B@footnote{$B!ZLuCm![(B
$B4JC1$K=*N;$7$F$7$^$C$F$O!":$$k$N$G!#(B}$B$9$k$?$a$G$9!#(B
$B$3$N%3%^%s%I$O!"$^$:!"JQ99$7$?%P%C%U%!$rJ]B8$9$k$+$I$&$+J9$$$F$-$^$9!#(B
$BL$J]B8$N$b$N$,$"$k$H$=$l$i$r1J5W$K<:$&$3$H$K$J$k$N$G!"(B
Emacs$B$r=*N;$9$k$^$($K(B@kbd{yes}$B$G$N:F3NG'$r5a$a$F$-$^$9!#(B
Emacs$B$r=*N;$9$k$H%5%V%W%m%;%9$b$?$@$A$K=*N;$5$l$i$l$F$7$^$&$?$a!"(B
$B%5%V%W%m%;%9$,Av$C$F$$$k>l9g$K$b!"$=$l$i$K4X$7$F3NG'$r5a$a$F$-$^$9!#(B

@c   There is no way to restart an Emacs session once you have killed it.
@c You can, however, arrange for Emacs to record certain session
@c information, such as which files are visited, when you kill it, so that
@c the next time you restart Emacs it will try to visit the same files and
@c so on.  @xref{Saving Emacs Sessions}.
$B0lEY(BEmacs$B$r=*N;$7$F$7$^$&$H!"(BEmacs$B%;%C%7%g%s$r:F3+$9$kJ}K!$O$"$j$^$;$s!#(B
$B$7$+$7$J$,$i!"=*N;;~$KK,Ld$7$F$$$?%U%!%$%k$J$I$N(B
$BFCDj$N%;%C%7%g%s>pJs$r5-O?$9$k$h$&$K(BEmacs$B$K;X<($7$F$*$1$P!"(B
$B$D$.$K(BEmacs$B$r5/F0$7D>$7$?$H$-$K!"(B
$BF1$8%U%!%$%k$rK,Ld$9$k$J$I$r;n$_$k$h$&$K$J$j$^$9!#(B
@xref{Saving Emacs Sessions}$B!#(B

@c   The operating system usually listens for certain special characters
@c whose meaning is to kill or suspend the program you are running.
@c @b{This operating system feature is turned off while you are in Emacs.}
@c The meanings of @kbd{C-z} and @kbd{C-x C-c} as keys in Emacs were
@c inspired by the use of @kbd{C-z} and @kbd{C-c} on several operating
@c systems as the characters for stopping or killing a program, but that is
@c their only relationship with the operating system.  You can customize
@c these keys to run any commands of your choice (@pxref{Keymaps}).
$B%*%Z%l!<%F%#%s%0%7%9%F%`$O!"DL>o!"<B9TCf$N%W%m%0%i%`$r=*N;$5$;$?$j(B
$B5Y;_$5$;$?$j$9$kFCDj$NFC<lJ8;z$r4F;k$7$F$$$^$9!#(B
@b{Emacs$B$r;H$C$F$$$k$H$-$K$O!"(B
$B%*%Z%l!<%F%#%s%0%7%9%F%`$N$3$N5!G=$O%*%U$K$J$C$F$$$^$9(B
@footnote{$B!ZLuCm![(BEmacs$B$,@lMQ$N(BX$B$N%&%#%s%I%&$r;H$C$F$$$k>l9g$O4X78$J$$!#(B}
$B!#(B}
Emacs$B$N%-!<$H$7$F$N(B@kbd{C-z}$B$d(B@kbd{C-x C-c}$B$N0UL#$O!"(B
$B$$$/$D$+$N%*%Z%l!<%F%#%s%0%7%9%F%`$G%W%m%0%i%`$r(B
$B5Y;_$5$;$?$j=*N;$5$;$?$j$9$k$?$a$KMQ$$$kJ8;z!"(B
@kbd{C-z}$B$H(B@kbd{C-c}$B$K%R%s%H$rF@$?$b$N$G$9$,!"(B
$B%*%Z%l!<%F%#%s%0%7%9%F%`$H$N4X78$O$=$l$@$1$G$9!#(B
$B$3$l$i$N%-!<$G9%$-$J%3%^%s%I$r<B9T$9$k$h$&$K%+%9%?%^%$%:$G$-$^$9(B
$B!J(B@pxref{Keymaps}$B!K!#(B