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 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499
|
@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, 86, 87, 93, 94, 95, 1997 Free Software Foundation, Inc.
@c See file emacs.texi for copying conditions.
@iftex
@c @chapter Characters, Keys and Commands
@chapter $BJ8;z!"%-!<!"%3%^%s%I(B
@c This chapter explains the character sets used by Emacs for input
@c commands and for the contents of files, and also explains the concepts
@c of @dfn{keys} and @dfn{commands}, which are fundamental for understanding
@c how Emacs interprets your keyboard and mouse input.
$BK\>O$G$O!"(BEmacs$B$,F~NO%3%^%s%I$d%U%!%$%k$NFbMF$KBP$7$FMQ$$$k(B
$BJ8;z=89g$K$D$$$F@bL@$7$^$9!#(B
$B$^$?!"(B@dfn{$B%-!<(B}$B!J(Bkeys$B!K$H(B@dfn{$B%3%^%s%I(B}
$B!J(Bcommands$B!K$N35G0$K$D$$$F$b@bL@$7$^$9!#(B
$B%-!<$d%3%^%s%I$O!"%-!<%\!<%IF~NO$d%^%&%9F~NO$r(B
Emacs$B$,$I$N$h$&$K2r<a$9$k$N$+$rM}2r$9$k$&$($G$N4pAC$H$J$j$^$9!#(B
@end iftex
@node User Input, Keys, Screen, Top
@c @section Kinds of User Input
@section $B%f!<%6!<F~NO$N<oN`(B
@c @cindex input with the keyboard
@c @cindex keyboard input
@c @cindex character set (keyboard)
@cindex $B%-!<%\!<%I$+$i$NF~NO(B
@cindex $B%-!<%\!<%IF~NO(B
@cindex $BJ8;z=89g!J%-!<%\!<%I!K(B
@cindex ASCII
@cindex C-
@c @cindex Control
@c @cindex control characters
@cindex $B%3%s%H%m!<%k(B
@cindex $B%3%s%H%m!<%kJ8;z(B
@c GNU Emacs uses an extension of the ASCII character set for keyboard
@c input; it also accepts non-character input events including function
@c keys and mouse button actions.
GNU Emacs$B$O!"%-!<%\!<%IF~NO$KBP$7$F$O3HD%(BASCII$BJ8;z=89g$r;H$$$^$9!#(B
$B$^$?!"%U%!%s%/%7%g%s%-!<$d%^%&%9%\%?%sA`:n$N$h$&$JJ8;z0J30$N(B
$BF~NO%$%Y%s%H$b<u$1IU$1$^$9!#(B
@c ASCII consists of 128 character codes. Some of these codes are
@c assigned graphic symbols such as @samp{a} and @samp{=}; the rest are
@c control characters, such as @kbd{Control-a} (usually written @kbd{C-a}
@c for short). @kbd{C-a} gets its name from the fact that you type it by
@c holding down the @key{CTRL} key while pressing @kbd{a}.
ASCII$B$O!"(B128$B$NJ8;z%3!<%I$+$i@.$j$^$9!#(B
$B$3$l$i$N%3!<%I$NCf$K$O!"(B@samp{a}$B$d(B@samp{=}$B$N$h$&$J(B
$B?^7A5-9f$K3d$jEv$F$i$l$F$$$k$b$N$b$"$j$^$9!#(B
$B$=$l0J30$O!"(B@kbd{Control-a}$B$N$h$&$J%3%s%H%m!<%kJ8;z$G$9(B
$B!JDL>o!"(B@kbd{C-a}$B$HN,5-!K!#(B
@kbd{C-a}$B$NL>A0$O!"(B@key{CTRL}$B%-!<$r2!$72<$2$?$^$^(B@kbd{a}$B$r(B
$B2!$9$3$H$+$i$-$F$$$^$9!#(B
@c Some ASCII control characters have special names, and most terminals
@c have special keys you can type them with: for example, @key{RET},
@c @key{TAB}, @key{DEL} and @key{ESC}. The space character is usually
@c referred to below as @key{SPC}, even though strictly speaking it is a
@c graphic character whose graphic happens to be blank. Some keyboards
@c have a key labeled ``linefeed'' which is an alias for @kbd{C-j}.
ASCII$B%3%s%H%m!<%kJ8;z$NCf$K$O!"FCJL$JL>A0$,IU$$$?$b$N$b$"$j$^$9!#(B
$BB?$/$NC<Kv$G$O!"%3%s%H%m!<%kJ8;z$rBG$D$?$a$NFCJL$J%-!<$rHw$($F$$$^$9!#(B
$B$?$H$($P!"(B@key{RET}$B!"(B@key{TAB}$B!"(B@key{DEL}$B!"(B@key{ESC}$B$,$=$&$G$9!#(B
$B6uGrJ8;z$O!"0J2<$G$OIaDL(B@key{SPC}$B$HI=5-$7$^$9!#(B
$B87L)$K$$$($P!"I=<($7$??^7A$,6uGr$G$"$k?^7AJ8;z$G$9!#(B
@kbd{C-j}$B$KBP$9$kJLL>$G$"$k!X(Blinefeed$B!Y!J%i%$%s%U%#!<%I!K(B
@footnote{$B!ZLuCm![F1$80UL#$G!"2~9T!J(Bnewline$B!K$b;H$&!#(B}$B$H$$$&(B
$B%i%Y%k$,IU$$$?%-!<$rHw$($?%-!<%\!<%I$b$"$j$^$9!#(B
@c Emacs extends the ASCII character set with thousands more printing
@c characters (@pxref{International}), additional control characters, and a
@c few more modifiers that can be combined with any character.
Emacs$B$G$O!"?t@i$N0u;zJ8;z!J(B@pxref{International}$B!K!"(B
$BDI2C$N%3%s%H%m!<%kJ8;z!"G$0U$NJ8;z$HAH$_9g$o$;2DG=$J=$>~;R$rF3F~$7$F!"(B
ASCII$BJ8;z=89g$r3HD%$7$F$$$^$9!#(B
@c On ASCII terminals, there are only 32 possible control characters.
@c These are the control variants of letters and @samp{@@[]\^_}. In
@c addition, the shift key is meaningless with control characters:
@c @kbd{C-a} and @kbd{C-A} are the same character, and Emacs cannot
@c distinguish them.
ASCII$BC<Kv$G$O!"MxMQ2DG=$J%3%s%H%m!<%kJ8;z$O(B32$B8D$7$+$"$j$^$;$s!#(B
$B$3$l$i$O!"1Q;z$H(B@samp{@@[]\^_}$B$N%3%s%H%m!<%kJQ<o$G$9!#(B
$B$5$i$K!"%3%s%H%m!<%kJ8;z$G$O!"%7%U%H%-!<$O0UL#$r;}$A$^$;$s!#(B
$B$D$^$j!"(B@kbd{C-a}$B$H(B@kbd{C-A}$B$OF1$8J8;z$G$"$j!"(BEmacs$B$O6hJL$G$-$^$;$s!#(B
@c But the Emacs character set has room for control variants of all
@c printing characters, and for distinguishing between @kbd{C-a} and
@c @kbd{C-A}. X Windows makes it possible to enter all these characters.
@c For example, @kbd{C--} (that's Control-Minus) and @kbd{C-5} are
@c meaningful Emacs commands under X.
$B$7$+$7!"(BEmacs$B$NJ8;z=89g<+BN$K$O!"(B
$B$9$Y$F$N0u;zJ8;z$K%3%s%H%m!<%kJQ<o$rMQ0U$9$kM>CO$,$"$j!"(B
@kbd{C-a}$B$H(B@kbd{C-A}$B$r6hJL$G$-$^$9!#(B
X$B%&%#%s%I%&%7%9%F%`$G$O!"$3$l$i$9$Y$F$NJ8;z$rF~NO$G$-$^$9!#(B
$B$?$H$($P!"(B@kbd{C--}$B!J%3%s%H%m!<%k%^%$%J%9!K$H(B@kbd{C-5}$B$O!"(B
X$B%&%#%s%I%&%7%9%F%`>e$G$O0UL#$r;}$D(BEmacs$B%3%^%s%I$G$9!#(B
@c Another Emacs character-set extension is additional modifier bits.
@c Only one modifier bit is commonly used; it is called Meta. Every
@c character has a Meta variant; examples include @kbd{Meta-a} (normally
@c written @kbd{M-a}, for short), @kbd{M-A} (not the same character as
@c @kbd{M-a}, but those two characters normally have the same meaning in
@c Emacs), @kbd{M-@key{RET}}, and @kbd{M-C-a}. For reasons of tradition,
@c we usually write @kbd{C-M-a} rather than @kbd{M-C-a}; logically
@c speaking, the order in which the modifier keys @key{CTRL} and @key{META}
@c are mentioned does not matter.
Emacs$B$NJ8;z=89g$KBP$9$k$b$&(B1$B$D$N3HD%$O!"=$>~%S%C%H$NDI2C$G$9!#(B
$BDL>o$O(B1$B%S%C%H$N=$>~%S%C%H$@$1$r;H$$!"(B
$B$3$N%S%C%H$r%a%?!J(BMeta$B!K$H8F$S$^$9!#(B
$B$9$Y$F$NJ8;z$K$O%a%?JQ<o$,$"$j$^$9!#(B
$B$?$H$($P!"(B@kbd{Meta-a}$B!JDL>o$O(B@kbd{M-a}$B$HN,5-!K$d(B
@kbd{M-A}$B!J(B@kbd{M-a}$B$H$O0[$J$kJ8;z$@$,!"(BEmacs$B$G$ODL>o!"F1$80UL#!K!"(B
@kbd{M-@key{RET}}$B!"(B@kbd{M-C-a}$B$G$9!#(B
$BEAE}E*$JM}M3$G!"DL>o!"(B@kbd{M-C-a}$B$h$j$`$7$m(B@kbd{C-M-a}$B$H=q$-$^$9!#(B
$BO@M}E*$K$O!"(B2$B$D$N=$>~%-!<(B@key{CTRL}$B$H(B@key{META}$B$N=g=x$O4X78$"$j$^$;$s!#(B
@c @cindex Meta
@cindex $B%a%?(B
@cindex M-
@c @cindex @key{ESC} replacing @key{META} key
@cindex @key{META}$B%-!<$K$+$o$k(B@key{ESC}
@c Some terminals have a @key{META} key, and allow you to type Meta
@c characters by holding this key down. Thus, @kbd{Meta-a} is typed by
@c holding down @key{META} and pressing @kbd{a}. The @key{META} key works
@c much like the @key{SHIFT} key. Such a key is not always labeled
@c @key{META}, however, as this function is often a special option for a key
@c with some other primary purpose.@refill
$BC<Kv$NCf$K$O(B@key{META}$B%-!<$rHw$($?$b$N$b$"$j!"(B
$B$3$N%-!<$r2!$72<$2$k$3$H$G%a%?J8;z$rBG$F$^$9!#(B
$B$?$H$($P!"(B@kbd{Meta-a}$B$O!"(B@key{META}$B$r2!$72<$2$?$^$^(B
@kbd{a}$B$r2!$7$FF~NO$7$^$9!#(B
@key{META}$B%-!<$O(B@key{SHIFT}$B%-!<$HF1$8$h$&$KF/$-$^$9!#(B
$B$7$+$7!"$3$N$h$&$J%-!<$N%i%Y%k$,$D$M$K(B@key{META}$B$G$"$k$H$O8B$j$^$;$s!#(B
$B$H$$$&$N$O!"$3$N5!G=$O!"JL$N<gL\E*$r;}$D%-!<$H$9$k$?$a$N(B
$BFCJL$J%*%W%7%g%s$G$"$k$3$H$,$^$^$"$k$+$i$G$9!#(B
@c If there is no @key{META} key, you can still type Meta characters
@c using two-character sequences starting with @key{ESC}. Thus, to enter
@c @kbd{M-a}, you could type @kbd{@key{ESC} a}. To enter @kbd{C-M-a}, you
@c would type @kbd{@key{ESC} C-a}. @key{ESC} is allowed on terminals with
@c @key{META} keys, too, in case you have formed a habit of using it.
@key{META}$B%-!<$,$J$/$F$b!"(B@key{ESC}$B$G;O$^$k(B2$BJ8;zNs$r;H$C$F(B
$B%a%?J8;z$rF~NO$G$-$^$9!#(B
$B$D$^$j!"(B@kbd{M-a}$B$rF~NO$9$k$K$O!"(B
@kbd{@key{ESC} a}$B$HBG$A$^$9!#(B
@kbd{C-M-a}$B$rF~NO$9$k$K$O!"(B@kbd{@key{ESC} C-a}$B$HBG$A$^$9!#(B
$B$3$NJ}K!$K47$l$F$$$k$N$G$"$l$P!"(B
@key{META}$B$,$"$kC<Kv$G$b!"(B@key{ESC}$B$r;H$C$F$+$^$$$^$;$s!#(B
@c X Windows provides several other modifier keys that can be applied to
@c any input character. These are called @key{SUPER}, @key{HYPER} and
@c @key{ALT}. We write @samp{s-}, @samp{H-} and @samp{A-} to say that a
@c character uses these modifiers. Thus, @kbd{s-H-C-x} is short for
@c @kbd{Super-Hyper-Control-x}. Not all X terminals actually provide keys
@c for these modifier flags---in fact, many terminals have a key labeled
@c @key{ALT} which is really a @key{META} key. The standard key bindings
@c of Emacs do not include any characters with these modifiers. But you
@c can assign them meanings of your own by customizing Emacs.
X$B%&%#%s%I%&%7%9%F%`$K$O!"B>$K$b$$$/$D$+$N=$>~%-!<$,$"$j!"(B
$B$9$Y$F$NF~NOJ8;z$KE,MQ$G$-$^$9!#(B
$B$3$l$i$O!"(B@key{SUPER}$B!"(B@key{HYPER}$B!"(B@key{ALT}$B$H8F$P$l$^$9!#(B
$BJ8;z$K$3$l$i$N=$>~;R$,IU$$$F$$$k$3$H$r<($90UL#$G!"(B
@samp{s-}$B!"(B@samp{H-}$B!"(B@samp{A-}$B$H=q$-$^$9!#(B
$B$D$^$j!"(B@kbd{s-H-C-x}$B$O!"(B@kbd{Super-Hyper-Control-x}$B$r>JN,$7$?$b$N$G$9!#(B
$B$9$Y$F$N(BX$BC<Kv$K!"<B:]$K$3$l$i$N=$>~;RMQ$N%-!<$,$"$k$o$1$G$O$"$j$^$;$s!#(B
$B<B:]!"(B@key{ALT}$B$H%i%Y%k$5$l$F$$$k$K$b4X$o$i$:!"(B
$B<B$O(B@key{META}$B$H$7$F5!G=$9$k%-!<$r;}$DC<Kv$,B?$/$"$j$^$9!#(B
Emacs$B$NI8=`%-!<%P%$%s%G%#%s%0$K$O!"(B
$B$3$l$i$N=$>~;R$,IU$$$?J8;z$O$"$j$^$;$s!#(B
$B$7$+$7!"(BEmacs$B$r%+%9%?%^%$%:$7$F!"$=$l$i$KFH<+$N0UL#$r3d$jEv$F$k$3$H$,$G$-$^$9!#(B
@c Keyboard input includes keyboard keys that are not characters at all:
@c for example function keys and arrow keys. Mouse buttons are also
@c outside the gamut of characters. You can modify these events with the
@c modifier keys @key{CTRL}, @key{META}, @key{SUPER}, @key{HYPER} and
@c @key{ALT}, just like keyboard characters.
$B%-!<%\!<%IF~NO$K$O!"(B
$B%U%!%s%/%7%g%s%-!<$dLp0u%-!<$N$h$&$JJ8;z0J30$N%-!<$b4^$^$l$^$9!#(B
$B%^%&%9%\%?%s$bJ8;z$NHO0O$K$OF~$j$^$;$s!#(B
$B$3$l$i$N%$%Y%s%H$b!"=$>~%-!<(B@key{CTRL}$B!"(B@key{META}$B!"(B
@key{SUPER}$B!"(B@key{HYPER}$B!"(B@key{ALT}$B$r;H$C$F!"(B
$B%-!<%\!<%IJ8;z$HF1$8$h$&$K=$>~$G$-$^$9!#(B
@c @cindex input event
@cindex $BF~NO%$%Y%s%H(B
@c Input characters and non-character inputs are collectively called
@c @dfn{input events}. @xref{Input Events,,, elisp, The Emacs Lisp
@c Reference Manual}, for more information. If you are not doing Lisp
@c programming, but simply want to redefine the meaning of some characters
@c or non-character events, see @ref{Customization}.
$BJ8;zF~NO$HHsJ8;zF~NO$NN><T$r9g$o$;$F!"(B
@dfn{$BF~NO%$%Y%s%H(B}$B!J(Binput events$B!K$H8F$S$^$9!#(B
$B$h$j>\$7$/$O!"(B@xref{Input Events,,, elisp, The Emacs Lisp Reference Manual}$B!#(B
Lisp$B$N%W%m%0%i%_%s%0H4$-$K!"(B
$BJ8;z%$%Y%s%H$dHsJ8;z%$%Y%s%H$N0UL#$r:FDj5A$7$?$$>l9g$K$O!"(B
@ref{Customization}$B$r;2>H$7$F$/$@$5$$!#(B
@c ASCII terminals cannot really send anything to the computer except
@c ASCII characters. These terminals use a sequence of characters to
@c represent each function key. But that is invisible to the Emacs user,
@c because the keyboard input routines recognize these special sequences
@c and convert them to function key events before any other part of Emacs
@c gets to see them.
ASCII$BC<Kv$G$O!"(BASCII$BJ8;z$@$1$7$+%3%s%T%e!<%?$KAw$l$^$;$s!#(B
$B$3$l$i$NC<Kv$G$O!"J8;z$NJB$S$r;H$C$F3F%U%!%s%/%7%g%s%-!<$rI=8=$7$^$9!#(B
$B$?$@$7!"%-!<%\!<%IF~NO%k!<%A%s$,$3$l$i$NFCJL$JJ8;z$NJB$S$rG'<1$7$F!"(B
Emacs$B$NB>$NItJ,$KEO$9$^$($K%U%!%s%/%7%g%s%-!<%$%Y%s%H$KJQ49$7$F$7$^$&$N$G!"(B
$B$3$l$i$NJ8;z$NJB$S$,(BEmacs$B%f!<%6!<$NL\$K$U$l$k$3$H$O$"$j$^$;$s!#(B
@node Keys, Commands, User Input, Top
@c @section Keys
@section $B%-!<(B
@c @cindex key sequence
@c @cindex key
@cindex $B%-!<Ns(B
@cindex $B%-!<(B
@c A @dfn{key sequence} (@dfn{key}, for short) is a sequence of input
@c events that are meaningful as a unit---as ``a single command.''
@c Some Emacs command sequences are just one character or one event; for
@c example, just @kbd{C-f} is enough to move forward one character. But
@c Emacs also has commands that take two or more events to invoke.
@dfn{$B%-!<Ns(B}$B!J(Bkey sequence$B!K!J(B@dfn{$B%-!<(B}$B$HN,5-!K$O!"(B
$B0l2t$G!X(B1$B$D$N%3%^%s%I!Y$H$7$F$N0UL#$r;}$DF~NO%$%Y%s%H$NNs$G$9!#(B
Emacs$B$N%3%^%s%INs$NCf$K$O!"(B1$BJ8;z$N$_!"$D$^$j!"(B
1$B%$%Y%s%H$N$_$G$"$k$b$N$b$"$j$^$9!#(B
$B$?$H$($P!"(B@kbd{C-f}$B$O%]%$%s%H$r(B1$BJ8;z@h$X?J$a$^$9!#(B
$B$7$+$7!"$J$+$K$O!"5/F0$K(B2$B$D0J>e$N%$%Y%s%H$rI,MW$H$9$k%3%^%s%I$b$"$j$^$9!#(B
@c @cindex complete key
@c @cindex prefix key
@cindex $B407k%-!<(B
@cindex $B%W%l%U%#%C%/%9%-!<(B
@c If a sequence of events is enough to invoke a command, it is a
@c @dfn{complete key}. Examples of complete keys include @kbd{C-a},
@c @kbd{X}, @key{RET}, @key{NEXT} (a function key), @key{DOWN} (an arrow
@c key), @kbd{C-x C-f}, and @kbd{C-x 4 C-f}. If it isn't long enough to be
@c complete, we call it a @dfn{prefix key}. The above examples show that
@c @kbd{C-x} and @kbd{C-x 4} are prefix keys. Every key sequence is either
@c a complete key or a prefix key.
$B$"$k%$%Y%s%HNs$,(B1$B$D$N%3%^%s%I$r5/F0$9$k$N$K==J,$G$"$k>l9g!"(B
$B$=$l$i$r(B@dfn{$B407k%-!<(B}$B!J(Bcomplete key$B!K$H8F$S$^$9!#(B
$B407k%-!<$NNc$H$7$F$O!"(B@kbd{C-a}$B!"(B@kbd{X}$B!"(B@key{RET}$B!"(B
@key{NEXT}$B!J%U%!%s%/%7%g%s%-!<$N(B1$B$D!K!"(B@key{DOWN}$B!JLp0u%-!<!K!"(B@kbd{C-x C-f}$B!"(B
@kbd{C-x 4 C-f}$B$,$"$j$^$9!#(B
$B407k$9$k$[$I==J,$KD9$/$J$$%$%Y%s%HNs$r!"(B
@dfn{$B%W%l%U%#%C%/%9%-!<(B}$B!J(Bprefix key$B!K$H8F$S$^$9!#(B
$B>e$NNc$G$O!"(B@kbd{C-x}$B$d(B@kbd{C-x 4}$B$,!"%W%l%U%#%C%/%9%-!<$G$9!#(B
$B$9$Y$F$N%-!<F~NONs$O!"407k%-!<$+%W%l%U%#%C%/%9%-!<$N$I$A$i$+$G$9!#(B
@c Most single characters constitute complete keys in the standard Emacs
@c command bindings. A few of them are prefix keys. A prefix key combines
@c with the following input event to make a longer key sequence, which may
@c itself be complete or a prefix. For example, @kbd{C-x} is a prefix key,
@c so @kbd{C-x} and the next input event combine to make a two-character
@c key sequence. Most of these key sequences are complete keys, including
@c @kbd{C-x C-f} and @kbd{C-x b}. A few, such as @kbd{C-x 4} and @kbd{C-x
@c r}, are themselves prefix keys that lead to three-character key
@c sequences. There's no limit to the length of a key sequence, but in
@c practice people rarely use sequences longer than four events.
Emacs$BI8=`$N%3%^%s%I3d$jEv$F$G$O!"$[$H$s$I$N(B1$BJ8;z$O407k%-!<$G$9!#(B
$B;D$j$N>/?t$O%W%l%U%#%C%/%9%-!<$G$9!#(B
$B%W%l%U%#%C%/%9%-!<$O!"8eB3$NF~NO%$%Y%s%H$H7k$SIU$$$F!"(B
$B$=$l<+BN$,407k%-!<$d%W%l%U%#%C%/%9%-!<$H$J$k!"(B
$B$5$i$KD9$$%-!<$NNs$r:n$j$^$9!#(B
$B$?$H$($P!"(B@kbd{C-x}$B$O%W%l%U%#%C%/%9%-!<$J$N$G!"(B
@kbd{C-x}$B$KB3$/F~NO%$%Y%s%H$H7k$SIU$$$F(B2$BJ8;z$N%-!<Ns$r:n$j$^$9!#(B
@kbd{C-x C-f}$B$d(B@kbd{C-x b}$B$r4^$a$F!"(B
$B$3$l$i$N%-!<Ns$N$[$H$s$I$O407k%-!<$K$J$j$^$9!#(B
@kbd{C-x 4}$B$d(B@kbd{C-x r}$B$N$h$&$K!"(B
$B$$$/$D$+$N%-!<Ns$O$=$l<+BN$,%W%l%U%#%C%/%9%-!<$H$J$j!"(B
3$BJ8;z$N%-!<Ns$r:n$j$^$9!#(B
$B%-!<Ns$ND9$5$K@)8B$O$"$j$^$;$s$,!"(B
$B<BMQ>e$O(B4$BJ8;z$rD6$($kD9$5$N%-!<Ns$r;H$&$3$H$O$a$C$?$K$"$j$^$;$s!#(B
@c By contrast, you can't add more events onto a complete key. For
@c example, the two-character sequence @kbd{C-f C-k} is not a key, because
@c the @kbd{C-f} is a complete key in itself. It's impossible to give
@c @kbd{C-f C-k} an independent meaning as a command. @kbd{C-f C-k} is two
@c key sequences, not one.@refill
$B$3$l$KBP$7$F!"407k%-!<$K$OF~NO%$%Y%s%H$rIU$12C$($k$3$H$,$G$-$^$;$s!#(B
$B$?$H$($P!"(B2$BJ8;z$NNs(B@kbd{C-f C-k}$B$O%-!<$G$O$"$j$^$;$s!#(B
$B$H$$$&$N$O!"(B@kbd{C-f}$B$,$=$l<+BN$G407k%-!<$@$+$i$G$9!#(B
@kbd{C-f C-k}$B$K%3%^%s%I$H$7$F$NFHN)$7$?0UL#IU$1$r$9$k$3$H$OIT2DG=$G$9!#(B
@kbd{C-f C-k}$B$O!"(B2$B$D$N%-!<Ns$G$"$C$F!"(B1$B$D$N%-!<Ns$G$O$"$j$^$;$s!#(B
@c All told, the prefix keys in Emacs are @kbd{C-c}, @kbd{C-h},
@c @kbd{C-x}, @kbd{C-x @key{RET}}, @kbd{C-x @@}, @kbd{C-x a}, @kbd{C-x n}, @w{@kbd{C-x
@c r}}, @kbd{C-x v}, @kbd{C-x 4}, @kbd{C-x 5}, @kbd{C-x 6}, @key{ESC},
@c @kbd{M-g} and @kbd{M-j}. But this list is not cast in concrete; it is
@c just a matter of Emacs's standard key bindings. If you customize Emacs,
@c you can make new prefix keys, or eliminate these. @xref{Key Bindings}.
Emacs$B$N%W%l%U%#%C%/%9%-!<$O!"(B@kbd{C-c}$B!"(B@kbd{C-h}$B!"(B@kbd{C-x}$B!"(B
@kbd{C-x @key{RET}}$B!"(B@kbd{C-x @@}$B!"(B@kbd{C-x a}$B!"(B@kbd{C-x n}$B!"(B
@w{@kbd{C-x r}}$B!"(B@kbd{C-x v}$B!"(B@kbd{C-x 4}$B!"(B@kbd{C-x 5}$B!"(B
@kbd{C-x 6}$B!"(B@key{ESC}$B!"(B@kbd{M-g}$B!"(B@kbd{M-j}$B$G$9!#(B
$B$7$+$7!"$3$l$i$O8GDj$5$l$F$$$k$o$1$G$O$J$/!"(B
Emacs$B$N%-!<3d$jEv$F$NI8=`@_Dj$H$J$C$F$$$k$@$1$G$9!#(B
Emacs$B$r%+%9%?%^%$%:$9$l$P!"?7$7$$%W%l%U%#%C%/%9%-!<$r@_Dj$7$?$j!"(B
$B$3$l$i$r2r=|$7$?$j$G$-$^$9!#(B
@xref{Key Bindings}$B!#(B
@c If you do make or eliminate prefix keys, that changes the set of
@c possible key sequences. For example, if you redefine @kbd{C-f} as a
@c prefix, @kbd{C-f C-k} automatically becomes a key (complete, unless you
@c define it too as a prefix). Conversely, if you remove the prefix
@c definition of @kbd{C-x 4}, then @kbd{C-x 4 f} (or @kbd{C-x 4
@c @var{anything}}) is no longer a key.
$B%W%l%U%#%C%/%9%-!<$r@_Dj$7$?$j2r=|$7$?$j$9$k$H!"(B
$B2DG=$J%-!<Ns$N=89g$rJQ$($k$3$H$K$J$j$^$9!#(B
$B$?$H$($P!"(B@kbd{C-f}$B$r%W%l%U%#%C%/%9%-!<$H$7$F:FDj5A$9$k$H!"(B
@kbd{C-f C-k}$B$O<+F0E*$K(B
$B!J$3$l$r$5$i$K%W%l%U%#%C%/%9$H$7$FDj5A$7$J$$8B$j407k$7$?!K%-!<$K$J$j$^$9!#(B
$B5U$K!"(B@kbd{C-x 4}$B$r%W%l%U%#%C%/%9$G$J$/$9$k$H!"(B@kbd{C-x 4 f}
$B!J$^$?$O(B@kbd{C-x 4 @var{anything}}$B!K$O!"$b$O$d%-!<$G$O$J$/$J$j$^$9!#(B
@c Typing the help character (@kbd{C-h} or @key{F1}) after a prefix
@c character displays a list of the commands starting with that prefix.
@c There are a few prefix characters for which @kbd{C-h} does not
@c work---for historical reasons, they have other meanings for @kbd{C-h}
@c which are not easy to change. But @key{F1} should work for all prefix
@c characters.
$B%W%l%U%#%C%/%9%-!<$N$"$H$K%X%k%WJ8;z!J(B@kbd{C-h}$B$d(B@key{F1}$B!K$rBG$D$H!"(B
$B$=$N%W%l%U%#%C%/%9$G;O$^$k%3%^%s%I0lMw$rI=<($G$-$^$9!#(B
$BNr;KE*$JGX7J$+$i!"(B@kbd{C-h}$B$,5!G=$7$J$$%W%l%U%#%C%/%9J8;z$bB8:_$7$^$9!#(B
$B$3$l$i$NJ8;z$G$O!"(B@kbd{C-h}$B$,JL$N0UL#$K3d$jEv$F$i$l$F$$$F!"(B
$BMF0W$K$OJQ99$G$-$J$$$N$G$9!#(B
$B$7$+$7!"(B@key{F1}$B$O$9$Y$F$N%W%l%U%#%C%/%9$KBP$7$F;H$($k$O$:$G$9!#(B
@node Commands, Text Characters, Keys, Top
@c @section Keys and Commands
@section $B%-!<$H%3%^%s%I(B
@c @cindex binding
@c @cindex function
@c @cindex command
@c @cindex function definition
@cindex $B%P%$%s%G%#%s%0(B
@cindex $B4X?t(B
@cindex $B%3%^%s%I(B
@cindex $B4X?tDj5A(B
@c This manual is full of passages that tell you what particular keys
@c do. But Emacs does not assign meanings to keys directly. Instead,
@c Emacs assigns meanings to named @dfn{commands}, and then gives keys
@c their meanings by @dfn{binding} them to commands.
$BK\=q$O!"FCDj$N%-!<$N5!G=$r>\$7$/@bL@$7$?%Z!<%8$P$+$j$G$9!#(B
$B$7$+$7!"(BEmacs$B$OD>@\%-!<$K0UL#$rM?$($F$O$$$^$;$s!#(B
$B$=$N$+$o$j$K!"(BEmacs$B$OL>A0$rIU$1$?(B@dfn{$B%3%^%s%I(B}$B!J(Bcommands$B!K$K0UL#$r;}$?$;!"(B
$B%-!<$H%3%^%s%I$r(B@dfn{$B%P%$%s%G%#%s%0(B}$B!J(Bbinding$B!"7k$SIU$1$k!K(B
$B$9$k$3$H$K$h$C$F!"%-!<$K0UL#$rM?$($F$$$^$9!#(B
@c Every command has a name chosen by a programmer. The name is usually
@c made of a few English words separated by dashes; for example,
@c @code{next-line} or @code{forward-word}. A command also has a
@c @dfn{function definition} which is a Lisp program; this is what makes
@c the command do what it does. In Emacs Lisp, a command is actually a
@c special kind of Lisp function; one which specifies how to read arguments
@c for it and call it interactively. For more information on commands and
@c functions, see @ref{What Is a Function,, What Is a Function, elisp, The
@c Emacs Lisp Reference Manual}. (The definition we use in this manual is
@c simplified slightly.)
$B$9$Y$F$N%3%^%s%I$K$O!"%W%m%0%i%^$,A*$s$@L>A0$,IU$$$F$$$^$9!#(B
$B$=$NL>A0$O!"$?$$$F$$%@%C%7%e$G6h@Z$C$??t8l$N1QC18l$G$9!#(B
$B$?$H$($P!"(B@code{next-line}$B$d(B@code{forward-word}$B$,$=$&$G$9!#(B
$B%3%^%s%I$O!"(BLisp$B%W%m%0%i%`$G$"$k(B@dfn{$B4X?tDj5A(B}
$B!J(Bfunction definition$B!"(Bdefun$B!K$r;}$A$^$9!#(B
$B$3$l$,!"%3%^%s%I$,9T$&$Y$-$3$H$r9T$($k$h$&$K$7$F$$$^$9!#(B
Emacs Lisp$B$G$O!"%3%^%s%I$O<B:]$K$OFCJL$J<oN`$N4X?t$G$9!#(B
$B$D$^$j!"0z?t$NFI$_<h$jJ}$dBPOCE*$J8F$S=P$7J}$,5,Dj$5$l$?(BLisp$B4X?t$G$9!#(B
$B%3%^%s%I$H4X?t$K4X$7$F$h$j>\$7$/$O!"(B@ref{What Is a Function,,
What Is a Function, elisp, The Emacs Lisp Reference Manual}$B$r(B
$B;2>H$7$F$/$@$5$$!#!JK\=q$G$NDj5A$O>/!94J0W2=$7$F$"$k!#!K(B
@c The bindings between keys and commands are recorded in various tables
@c called @dfn{keymaps}. @xref{Keymaps}.
$B%-!<$H%3%^%s%I$N%P%$%s%G%#%s%0$O!"(B
@dfn{$B%-!<%^%C%W(B}$B!J(Bkeymaps$B!K$H$$$&I=$K5-O?$5$l$F$$$^$9!#(B
@xref{Keymaps}$B!#(B
@c When we say that ``@kbd{C-n} moves down vertically one line'' we are
@c glossing over a distinction that is irrelevant in ordinary use but is vital
@c in understanding how to customize Emacs. It is the command
@c @code{next-line} that is programmed to move down vertically. @kbd{C-n} has
@c this effect @emph{because} it is bound to that command. If you rebind
@c @kbd{C-n} to the command @code{forward-word} then @kbd{C-n} will move
@c forward by words instead. Rebinding keys is a common method of
@c customization.@refill
$B!X(B@kbd{C-n}$B$O?bD>J}8~$K(B1$B9T2<$,$k!Y$H$$$&I=8=$G$O!"(B
Emacs$B$N%+%9%?%^%$%:J}K!$rM}2r$9$k$&$($G$OHs>o$K=EMW$G$"$C$F$b!"(B
$BIaCJ$N;H$$J}$G$O0UL#$N$J$$!V6hJL!W$r$"$($FL5;k$7$F$$$^$9!#(B
$B2<$,$k$h$&$K%W%m%0%i%`$5$l$F$$$k$N$O(B@code{next-line}$B$H$$$&%3%^%s%I$G$9!#(B
@kbd{C-n}$B$,$=$N%3%^%s%I$K%P%$%s%I$5$l$F$$$k$N$G!"(B
$B$=$N$h$&$J8z2L$rH/4x$9$k$N$G$9!#(B
@kbd{C-n}$B$r%3%^%s%I(B@code{forward-word}$B$K%P%$%s%I$7D>$9$H!"(B
@kbd{C-n}$B$O!"$+$o$j$K(B1$BC18l$:$D@h$X?J$`$h$&$K$J$j$^$9!#(B
$B%-!<$N:F%P%$%s%G%#%s%0$O!"%+%9%?%^%$%:$N0lHLE*$JJ}K!$G$9!#(B
@c In the rest of this manual, we usually ignore this subtlety to keep
@c things simple. To give the information needed for customization, we
@c state the name of the command which really does the work in parentheses
@c after mentioning the key that runs it. For example, we will say that
@c ``The command @kbd{C-n} (@code{next-line}) moves point vertically
@c down,'' meaning that @code{next-line} is a command that moves vertically
@c down and @kbd{C-n} is a key that is standardly bound to it.
$BK\=q$G$O!":#8e!"OC$rC1=c$K$9$k$?$a$K!"(B
$BIaCJ$O$3$N0c$$$rL5;k$9$k$3$H$K$7$^$9!#(B
$B%+%9%?%^%$%:$KI,MW$J>pJs$r<($9>l9g!"(B
$B%3%^%s%I$r<B9T$9$k%-!<$r5-$7$?$"$H$K!"(B
$B<B:]$K$=$NF0:n$r9T$&%3%^%s%I$NL>A0$r3g8L$K3g$C$F<($7$^$9!#(B
$B$?$H$($P!"!X%3%^%s%I(B@kbd{C-n}$B!J(B@code{next-line}$B!K$O!"(B
$B%]%$%s%H$r2<8~$-$K0\F0$9$k!Y$H$$$&I=8=$G$O!"(B
$B2<8~$-$K0\F0$9$k%3%^%s%I$O(B@code{next-line}$B$G$"$j!"(B
$BI8=`$G$O%-!<(B@kbd{C-n}$B$K%P%$%s%I$5$l$F$$$k$3$H$r0UL#$7$^$9!#(B
@c While we are on the subject of information for customization only,
@c it's a good time to tell you about @dfn{variables}. Often the
@c description of a command will say, ``To change this, set the variable
@c @code{mumble-foo}.'' A variable is a name used to remember a value.
@c Most of the variables documented in this manual exist just to facilitate
@c customization: some command or other part of Emacs examines the variable
@c and behaves differently according to the value that you set. Until you
@c are interested in customizing, you can ignore the information about
@c variables. When you are ready to be interested, read the basic
@c information on variables, and then the information on individual
@c variables will make sense. @xref{Variables}.
$B$3$l$^$G%+%9%?%^%$%:$K4X$7$F=R$Y$F$-$^$7$?$N$G!"(B
@dfn{$BJQ?t(B}$B$K$D$$$F$U$l$F$*$/;~4|$G$7$g$&!#(B
$B%3%^%s%I$N@bL@$G$O!"(B
$B!X$3$l$rJQ99$9$k$K$O!"JQ?t(B@code{mumble-foo}$B$r@_Dj$9$k!Y$H(B
$B5-=R$9$k$3$H$,$"$j$^$9!#(B
$BJQ?t$H$O!"CM$r5-21$7$F$*$/$?$a$K;H$&L>A0$N$3$H$G$9!#(B
$BK\=q$K5-:\$5$l$?JQ?t$NBgItJ,$O!"%+%9%?%^%$%:$N$?$a$K;H$o$l$^$9!#(B
$B$$$/$D$+$N%3%^%s%I$d(BEmacs$B$NB>$NItJ,$G$O!"(B
$BJQ?t$rD4$Y$F@_Dj$5$l$?CM$K=>$C$F$=$N$U$k$^$$$rJQ$($F$$$-$^$9!#(B
$B%+%9%?%^%$%:$K6=L#$,=P$F$/$k$^$G$O!"(B
$BJQ?t$K4X$9$k5-=R$OL5;k$7$F$+$^$$$^$;$s!#(B
$B%+%9%?%^%$%:$7$F$_$?$$$H;W$C$?$i!"(B
$BJQ?t$K4X$9$k4pAC$rFI$s$G$/$@$5$$!#(B
$B$=$&$9$l$P!"8D!9$NJQ?t$K4X$9$k>pJs$rM}2r$G$-$k$G$7$g$&!#(B
@xref{Variables}$B!#(B
@node Text Characters, Entering Emacs, Commands, Top
@c @section Character Set for Text
@section $B%F%-%9%HMQ$NJ8;z=89g(B
@c @cindex characters (in text)
@cindex $BJ8;z!J%F%-%9%HCf$N!K(B
@c Text in Emacs buffers is a sequence of 8-bit bytes. Each byte can
@c hold a single ASCII character. Both ASCII control characters (octal
@c codes 000 through 037, and 0177) and ASCII printing characters (codes
@c 040 through 0176) are allowed; however, non-ASCII control characters
@c cannot appear in a buffer. The other modifier flags used in keyboard
@c input, such as Meta, are not allowed in buffers either.
Emacs$B%P%C%U%!Fb$N%F%-%9%H$O!"(B1$B%P%$%H(B8$B%S%C%H$N%P%$%H$NNs$G$9!#(B
$B3F%P%$%H$G!"(B1$B$D$N(BASCII$BJ8;z$rI=8=$G$-$^$9!#(B
ASCII$B%3%s%H%m!<%kJ8;z!J(B8$B?J?t(B000$B!A(B037$B!"(B0177$B!K$H(B
ASCII$B0u;zJ8;z!J(B8$B?J?t(B040$B!A(B0176$B!K$NN>J}$r;H$($^$9!#(B
$B$7$+$7!"Hs(BASCII$B%3%s%H%m!<%kJ8;z$O%P%C%U%!$K$O8=$l$^$;$s!#(B
$B%a%?$N$h$&$J%-!<%\!<%IF~NO$GMQ$$$i$l$k$=$NB>$N=$>~%U%i%0$b(B
$B%P%C%U%!Fb$G$O5v$5$l$^$;$s!#(B
@c Some ASCII control characters serve special purposes in text, and have
@c special names. For example, the newline character (octal code 012) is
@c used in the buffer to end a line, and the tab character (octal code 011)
@c is used for indenting to the next tab stop column (normally every 8
@c columns). @xref{Text Display}.
$B$$$/$D$+$N(BASCII$B%3%s%H%m!<%kJ8;z$O!"(B
$B%F%-%9%HCf$G$OFCJL$JL\E*$N$?$a$KMQ$$$i$l$F$$$F!"FCJL$JL>A0$,IU$$$F$$$^$9!#(B
$B$?$H$($P!"2~9TJ8;z!J(B8$B?J?t(B012$B!K$O!"%P%C%U%!Fb$N(B1$B9T$N=*$j$K;H$o$l$^$9!#(B
$B$^$?!"%?%VJ8;z!J(B8$B?J?t(B011$B!K$O!"$D$.$N%?%V%9%H%C%W0LCV!JDL>o(B8$B7e$4$H!K$^$G(B
$B%F%-%9%H$r;z2<$2$9$k$?$a$K;H$o$l$^$9!#(B
@xref{Text Display}$B!#(B
@c Non-ASCII printing characters can also appear in buffers. When
@c multibyte characters are enabled, you can use any of the non-ASCII
@c printing characters that Emacs supports. They have character codes
@c starting at 256, octal 0400, and each one is represented as a sequence
@c of two or more bytes. @xref{International}.
$BHs(BASCII$B0u;zJ8;z$b%P%C%U%!Fb$KB8:_$G$-$^$9!#(B
$B%^%k%A%P%$%HJ8;z$r;HMQ2D$K$7$F$"$l$P!"(B
Emacs$B$,07$($kG$0U$NHs(BASCII$B0u;zJ8;z$r;H$($^$9!#(B
$B$=$l$i$NJ8;z$NJ8;z%3!<%I$O(B256$B!J(B8$B?J$G(B0400$B!K$+$i;O$^$j!"(B
$B3FJ8;z$O(B2$B%P%$%H!"$"$k$$$O$=$l0J>e$N%P%$%HNs$H$7$FI=8=$5$l$^$9!#(B
@xref{International}$B!#(B
@c If you disable multibyte characters, then you can use only one
@c alphabet of non-ASCII characters, but they all fit in one byte. They
@c use codes 0200 through 0377. @xref{Single-Byte European Support}.
$B%^%k%A%P%$%HJ8;z$r;HMQIT2D$K$7$F$$$k>l9g!"(B
$BHs(BASCII$BJ8;z$N$&$A$N(B1$B<oN`$N%"%k%U%!%Y%C%H$@$1$r;H$($^$9$,!"(B
$B$=$l$i$O$9$Y$F(B1$B%P%$%H$K<}$^$k$b$N$G$9!#(B
$BJ8;z%3!<%I$O(B0200$B$+$i(B0377$B$r;H$$$^$9!#(B
@xref{Single-Byte European Support}$B!#(B
|