comparison man/commands.texi @ 88155:d7ddb3e565de

sync with trunk
author Henrik Enberg <henrik.enberg@telia.com>
date Mon, 16 Jan 2006 00:03:54 +0000
parents 23a1cea22d13
children
comparison
equal deleted inserted replaced
88154:8ce476d3ba36 88155:d7ddb3e565de
1 @c This is part of the Emacs manual. 1 @c This is part of the Emacs manual.
2 @c Copyright (C) 1985, 86, 87, 93, 94, 95, 1997 Free Software Foundation, Inc. 2 @c Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1997, 2002, 2003,
3 @c 2004, 2005 Free Software Foundation, Inc.
3 @c See file emacs.texi for copying conditions. 4 @c See file emacs.texi for copying conditions.
4 @iftex 5 @iftex
5 @chapter Characters, Keys and Commands 6 @chapter Characters, Keys and Commands
6 7
7 This chapter explains the character sets used by Emacs for input 8 This chapter explains the character sets used by Emacs for input
8 commands and for the contents of files, and also explains the concepts 9 commands and for the contents of files, and also explains the concepts
9 of @dfn{keys} and @dfn{commands}, which are fundamental for understanding 10 of @dfn{keys} and @dfn{commands}, which are fundamental for understanding
10 how Emacs interprets your keyboard and mouse input. 11 how Emacs interprets your keyboard and mouse input.
11 @end iftex 12 @end iftex
12 13
14 @ifnottex
15 @raisesections
16 @end ifnottex
17
13 @node User Input, Keys, Screen, Top 18 @node User Input, Keys, Screen, Top
14 @section Kinds of User Input 19 @section Kinds of User Input
15 @cindex input with the keyboard 20 @cindex input with the keyboard
16 @cindex keyboard input 21 @cindex keyboard input
17 @cindex character set (keyboard) 22 @cindex character set (keyboard)
18 @cindex ASCII 23 @cindex @acronym{ASCII}
19 @cindex C- 24 @cindex C-
20 @cindex Control 25 @cindex Control
21 @cindex control characters 26 @cindex control characters
22 27
23 GNU Emacs uses an extension of the ASCII character set for keyboard 28 GNU Emacs uses an extension of the @acronym{ASCII} character set for keyboard
24 input; it also accepts non-character input events including function 29 input; it also accepts non-character input events including function
25 keys and mouse button actions. 30 keys and mouse button actions.
26 31
27 ASCII consists of 128 character codes. Some of these codes are 32 @acronym{ASCII} consists of 128 character codes. Some of these codes are
28 assigned graphic symbols such as @samp{a} and @samp{=}; the rest are 33 assigned graphic symbols such as @samp{a} and @samp{=}; the rest are
29 control characters, such as @kbd{Control-a} (usually written @kbd{C-a} 34 control characters, such as @kbd{Control-a} (usually written @kbd{C-a}
30 for short). @kbd{C-a} gets its name from the fact that you type it by 35 for short). @kbd{C-a} gets its name from the fact that you type it by
31 holding down the @key{CTRL} key while pressing @kbd{a}. 36 holding down the @key{CTRL} key while pressing @kbd{a}.
32 37
33 Some ASCII control characters have special names, and most terminals 38 Some @acronym{ASCII} control characters have special names, and most terminals
34 have special keys you can type them with: for example, @key{RET}, 39 have special keys you can type them with: for example, @key{RET},
35 @key{TAB}, @key{DEL} and @key{ESC}. The space character is usually 40 @key{TAB}, @key{DEL} and @key{ESC}. The space character is usually
36 referred to below as @key{SPC}, even though strictly speaking it is a 41 referred to below as @key{SPC}, even though strictly speaking it is a
37 graphic character whose graphic happens to be blank. Some keyboards 42 graphic character whose graphic happens to be blank. Some keyboards
38 have a key labeled ``linefeed'' which is an alias for @kbd{C-j}. 43 have a key labeled ``linefeed'' which is an alias for @kbd{C-j}.
39 44
40 Emacs extends the ASCII character set with thousands more printing 45 Emacs extends the @acronym{ASCII} character set with thousands more printing
41 characters (@pxref{International}), additional control characters, and a 46 characters (@pxref{International}), additional control characters, and a
42 few more modifiers that can be combined with any character. 47 few more modifiers that can be combined with any character.
43 48
44 On ASCII terminals, there are only 32 possible control characters. 49 On @acronym{ASCII} terminals, there are only 32 possible control characters.
45 These are the control variants of letters and @samp{@@[]\^_}. In 50 These are the control variants of letters and @samp{@@[]\^_}. In
46 addition, the shift key is meaningless with control characters: 51 addition, the shift key is meaningless with control characters:
47 @kbd{C-a} and @kbd{C-A} are the same character, and Emacs cannot 52 @kbd{C-a} and @kbd{C-A} are the same character, and Emacs cannot
48 distinguish them. 53 distinguish them.
49 54
115 @dfn{input events}. @xref{Input Events,,, elisp, The Emacs Lisp 120 @dfn{input events}. @xref{Input Events,,, elisp, The Emacs Lisp
116 Reference Manual}, for more information. If you are not doing Lisp 121 Reference Manual}, for more information. If you are not doing Lisp
117 programming, but simply want to redefine the meaning of some characters 122 programming, but simply want to redefine the meaning of some characters
118 or non-character events, see @ref{Customization}. 123 or non-character events, see @ref{Customization}.
119 124
120 ASCII terminals cannot really send anything to the computer except 125 @acronym{ASCII} terminals cannot really send anything to the computer except
121 ASCII characters. These terminals use a sequence of characters to 126 @acronym{ASCII} characters. These terminals use a sequence of characters to
122 represent each function key. But that is invisible to the Emacs user, 127 represent each function key. But that is invisible to the Emacs user,
123 because the keyboard input routines recognize these special sequences 128 because the keyboard input routines recognize these special sequences
124 and convert them to function key events before any other part of Emacs 129 and convert them to function key events before any other part of Emacs
125 gets to see them. 130 gets to see them.
126 131
162 the @kbd{C-f} is a complete key in itself. It's impossible to give 167 the @kbd{C-f} is a complete key in itself. It's impossible to give
163 @kbd{C-f C-k} an independent meaning as a command. @kbd{C-f C-k} is two 168 @kbd{C-f C-k} an independent meaning as a command. @kbd{C-f C-k} is two
164 key sequences, not one.@refill 169 key sequences, not one.@refill
165 170
166 All told, the prefix keys in Emacs are @kbd{C-c}, @kbd{C-h}, 171 All told, the prefix keys in Emacs are @kbd{C-c}, @kbd{C-h},
167 @kbd{C-x}, @kbd{C-x @key{RET}}, @kbd{C-x @@}, @kbd{C-x a}, @kbd{C-x n}, @w{@kbd{C-x 172 @kbd{C-x}, @kbd{C-x @key{RET}}, @kbd{C-x @@}, @kbd{C-x a}, @kbd{C-x
168 r}}, @kbd{C-x v}, @kbd{C-x 4}, @kbd{C-x 5}, @kbd{C-x 6}, @key{ESC}, and 173 n}, @w{@kbd{C-x r}}, @kbd{C-x v}, @kbd{C-x 4}, @kbd{C-x 5}, @kbd{C-x 6},
169 @kbd{M-g}. But this list is not cast in concrete; it is 174 @key{ESC}, @kbd{M-o} and @kbd{M-g}. (@key{F1} and @key{F2} are aliases for
170 just a matter of Emacs's standard key bindings. If you customize Emacs, 175 @kbd{C-h} and @kbd{C-x 6}.) But this list is not cast in concrete; it
171 you can make new prefix keys, or eliminate these. @xref{Key Bindings}. 176 is just a matter of Emacs's standard key bindings. If you customize
177 Emacs, you can make new prefix keys, or eliminate these. @xref{Key
178 Bindings}.
172 179
173 If you do make or eliminate prefix keys, that changes the set of 180 If you do make or eliminate prefix keys, that changes the set of
174 possible key sequences. For example, if you redefine @kbd{C-f} as a 181 possible key sequences. For example, if you redefine @kbd{C-f} as a
175 prefix, @kbd{C-f C-k} automatically becomes a key (complete, unless you 182 prefix, @kbd{C-f C-k} automatically becomes a key (complete, unless you
176 define that too as a prefix). Conversely, if you remove the prefix 183 define that too as a prefix). Conversely, if you remove the prefix
216 this effect @emph{because} it is bound to that command. If you rebind 223 this effect @emph{because} it is bound to that command. If you rebind
217 @kbd{C-n} to the command @code{forward-word} then @kbd{C-n} will move 224 @kbd{C-n} to the command @code{forward-word} then @kbd{C-n} will move
218 forward by words instead. Rebinding keys is a common method of 225 forward by words instead. Rebinding keys is a common method of
219 customization.@refill 226 customization.@refill
220 227
221 In the rest of this manual, we usually ignore this subtlety to keep 228 In the rest of this manual, we usually ignore this distinction to
222 things simple. To give the information needed for customization, we 229 keep things simple. We will often speak of keys like @kbd{C-n} as
223 state the name of the command which really does the work in parentheses 230 commands, even though strictly speaking a key is bound to some
231 command. To give the information needed for customization, we state
232 the name of the command which really does the work in parentheses
224 after mentioning the key that runs it. For example, we will say that 233 after mentioning the key that runs it. For example, we will say that
225 ``The command @kbd{C-n} (@code{next-line}) moves point vertically 234 ``The command @kbd{C-n} (@code{next-line}) moves point vertically
226 down,'' meaning that @code{next-line} is a command that moves vertically 235 down,'' meaning that @code{next-line} is a command that moves
227 down, and @kbd{C-n} is a key that is normally bound to it. 236 vertically down, and @kbd{C-n} is a key that is normally bound to it.
228 237
229 While we are on the subject of information for customization only, 238 While we are on the subject of information for customization only,
230 it's a good time to tell you about @dfn{variables}. Often the 239 it's a good time to tell you about @dfn{variables}. Often the
231 description of a command will say, ``To change this, set the variable 240 description of a command will say, ``To change this, set the variable
232 @code{mumble-foo}.'' A variable is a name used to remember a value. 241 @code{mumble-foo}.'' A variable is a name used to remember a value.
241 @node Text Characters, Entering Emacs, Commands, Top 250 @node Text Characters, Entering Emacs, Commands, Top
242 @section Character Set for Text 251 @section Character Set for Text
243 @cindex characters (in text) 252 @cindex characters (in text)
244 253
245 Text in Emacs buffers is a sequence of 8-bit bytes. Each byte can 254 Text in Emacs buffers is a sequence of 8-bit bytes. Each byte can
246 hold a single ASCII character. Both ASCII control characters (octal 255 hold a single @acronym{ASCII} character. Both @acronym{ASCII} control characters (octal
247 codes 000 through 037, and 0177) and ASCII printing characters (codes 256 codes 000 through 037, and 0177) and @acronym{ASCII} printing characters (codes
248 040 through 0176) are allowed; however, non-ASCII control characters 257 040 through 0176) are allowed; however, non-@acronym{ASCII} control characters
249 cannot appear in a buffer. The other modifier flags used in keyboard 258 cannot appear in a buffer. The other modifier flags used in keyboard
250 input, such as Meta, are not allowed in buffers either. 259 input, such as Meta, are not allowed in buffers either.
251 260
252 Some ASCII control characters serve special purposes in text, and have 261 Some @acronym{ASCII} control characters serve special purposes in text, and have
253 special names. For example, the newline character (octal code 012) is 262 special names. For example, the newline character (octal code 012) is
254 used in the buffer to end a line, and the tab character (octal code 011) 263 used in the buffer to end a line, and the tab character (octal code 011)
255 is used for indenting to the next tab stop column (normally every 8 264 is used for indenting to the next tab stop column (normally every 8
256 columns). @xref{Text Display}. 265 columns). @xref{Text Display}.
257 266
258 Non-ASCII printing characters can also appear in buffers. When 267 Non-@acronym{ASCII} printing characters can also appear in buffers. When
259 multibyte characters are enabled, you can use any of the non-ASCII 268 multibyte characters are enabled, you can use any of the non-@acronym{ASCII}
260 printing characters that Emacs supports. They have character codes 269 printing characters that Emacs supports. They have character codes
261 starting at 256, octal 0400, and each one is represented as a sequence 270 starting at 256, octal 0400, and each one is represented as a sequence
262 of two or more bytes. @xref{International}. Single-byte characters 271 of two or more bytes. @xref{International}. Single-byte characters
263 with codes 128 through 255 can also appear in multibyte buffers. 272 with codes 128 through 255 can also appear in multibyte buffers.
264 273
265 If you disable multibyte characters, then you can use only one 274 If you disable multibyte characters, then you can use only one
266 alphabet of non-ASCII characters, but they all fit in one byte. They 275 alphabet of non-@acronym{ASCII} characters, but they all fit in one byte. They
267 use codes 0200 through 0377. @xref{Single-Byte Character Support}. 276 use codes 0200 through 0377. @xref{Single-Byte Character Support}.
277
278 @ifnottex
279 @lowersections
280 @end ifnottex
281
282 @ignore
283 arch-tag: 9be43eef-d1f4-4d03-a916-c741ea713a45
284 @end ignore