Mercurial > emacs
annotate man/mule.texi @ 31040:5c62643e2061
Mark busy-cursor as being documented.
author | Eli Zaretskii <eliz@gnu.org> |
---|---|
date | Tue, 22 Aug 2000 10:15:49 +0000 |
parents | b72f53ea6c54 |
children | 3f11714b9e14 |
rev | line source |
---|---|
25829 | 1 @c This is part of the Emacs manual. |
2 @c Copyright (C) 1997, 1999 Free Software Foundation, Inc. | |
3 @c See file emacs.texi for copying conditions. | |
4 @node International, Major Modes, Frames, Top | |
5 @chapter International Character Set Support | |
6 @cindex MULE | |
7 @cindex international scripts | |
8 @cindex multibyte characters | |
9 @cindex encoding of characters | |
10 | |
11 @cindex Chinese | |
26140
068f7ad41d40
Describe new functions and variables for locales.
Paul Eggert <eggert@twinsun.com>
parents:
25829
diff
changeset
|
12 @cindex Cyrillic |
25829 | 13 @cindex Devanagari |
14 @cindex Hindi | |
15 @cindex Marathi | |
26140
068f7ad41d40
Describe new functions and variables for locales.
Paul Eggert <eggert@twinsun.com>
parents:
25829
diff
changeset
|
16 @cindex Ethiopic |
25829 | 17 @cindex Greek |
26140
068f7ad41d40
Describe new functions and variables for locales.
Paul Eggert <eggert@twinsun.com>
parents:
25829
diff
changeset
|
18 @cindex Hebrew |
25829 | 19 @cindex IPA |
20 @cindex Japanese | |
21 @cindex Korean | |
22 @cindex Lao | |
23 @cindex Thai | |
24 @cindex Tibetan | |
25 @cindex Vietnamese | |
26 Emacs supports a wide variety of international character sets, | |
27 including European variants of the Latin alphabet, as well as Chinese, | |
26140
068f7ad41d40
Describe new functions and variables for locales.
Paul Eggert <eggert@twinsun.com>
parents:
25829
diff
changeset
|
28 Cyrillic, Devanagari (Hindi and Marathi), Ethiopic, Greek, Hebrew, IPA, |
068f7ad41d40
Describe new functions and variables for locales.
Paul Eggert <eggert@twinsun.com>
parents:
25829
diff
changeset
|
29 Japanese, Korean, Lao, Thai, Tibetan, and Vietnamese scripts. These features |
25829 | 30 have been merged from the modified version of Emacs known as MULE (for |
31 ``MULti-lingual Enhancement to GNU Emacs'') | |
32 | |
33 @menu | |
34 * International Intro:: Basic concepts of multibyte characters. | |
35 * Enabling Multibyte:: Controlling whether to use multibyte characters. | |
36 * Language Environments:: Setting things up for the language you use. | |
37 * Input Methods:: Entering text characters not on your keyboard. | |
38 * Select Input Method:: Specifying your choice of input methods. | |
39 * Multibyte Conversion:: How single-byte characters convert to multibyte. | |
40 * Coding Systems:: Character set conversion when you read and | |
41 write files, and so on. | |
42 * Recognize Coding:: How Emacs figures out which conversion to use. | |
43 * Specify Coding:: Various ways to choose which conversion to use. | |
44 * Fontsets:: Fontsets are collections of fonts | |
45 that cover the whole spectrum of characters. | |
46 * Defining Fontsets:: Defining a new fontset. | |
27211
0699f691fac1
Don't conflate single-byte with European.
Dave Love <fx@gnu.org>
parents:
27156
diff
changeset
|
47 * Single-Byte Character Support:: |
25829 | 48 You can pick one European character set |
49 to use without multibyte characters. | |
50 @end menu | |
51 | |
52 @node International Intro | |
53 @section Introduction to International Character Sets | |
54 | |
31023
b72f53ea6c54
Document list-charset-chars.
Eli Zaretskii <eliz@gnu.org>
parents:
31021
diff
changeset
|
55 The users of international character sets and scripts have established |
b72f53ea6c54
Document list-charset-chars.
Eli Zaretskii <eliz@gnu.org>
parents:
31021
diff
changeset
|
56 many more-or-less standard coding systems for storing files. Emacs |
b72f53ea6c54
Document list-charset-chars.
Eli Zaretskii <eliz@gnu.org>
parents:
31021
diff
changeset
|
57 internally uses a single multibyte character encoding, so that it can |
b72f53ea6c54
Document list-charset-chars.
Eli Zaretskii <eliz@gnu.org>
parents:
31021
diff
changeset
|
58 intermix characters from all these scripts in a single buffer or string. |
b72f53ea6c54
Document list-charset-chars.
Eli Zaretskii <eliz@gnu.org>
parents:
31021
diff
changeset
|
59 This encoding represents each non-ASCII character as a sequence of bytes |
b72f53ea6c54
Document list-charset-chars.
Eli Zaretskii <eliz@gnu.org>
parents:
31021
diff
changeset
|
60 in the range 0200 through 0377. Emacs translates between the multibyte |
b72f53ea6c54
Document list-charset-chars.
Eli Zaretskii <eliz@gnu.org>
parents:
31021
diff
changeset
|
61 character encoding and various other coding systems when reading and |
b72f53ea6c54
Document list-charset-chars.
Eli Zaretskii <eliz@gnu.org>
parents:
31021
diff
changeset
|
62 writing files, when exchanging data with subprocesses, and (in some |
b72f53ea6c54
Document list-charset-chars.
Eli Zaretskii <eliz@gnu.org>
parents:
31021
diff
changeset
|
63 cases) in the @kbd{C-q} command (@pxref{Multibyte Conversion}). |
25829 | 64 |
65 @kindex C-h h | |
66 @findex view-hello-file | |
67 The command @kbd{C-h h} (@code{view-hello-file}) displays the file | |
68 @file{etc/HELLO}, which shows how to say ``hello'' in many languages. | |
27156
488f307b4f59
(International Intro): Add a link to to Fontsets.
Gerd Moellmann <gerd@gnu.org>
parents:
26513
diff
changeset
|
69 This illustrates various scripts. If the font you're using doesn't have |
488f307b4f59
(International Intro): Add a link to to Fontsets.
Gerd Moellmann <gerd@gnu.org>
parents:
26513
diff
changeset
|
70 characters for all those different languages, you will see some hollow |
488f307b4f59
(International Intro): Add a link to to Fontsets.
Gerd Moellmann <gerd@gnu.org>
parents:
26513
diff
changeset
|
71 boxes instead of characters; see @ref{Fontsets}. |
25829 | 72 |
31023
b72f53ea6c54
Document list-charset-chars.
Eli Zaretskii <eliz@gnu.org>
parents:
31021
diff
changeset
|
73 @findex list-charset-chars |
b72f53ea6c54
Document list-charset-chars.
Eli Zaretskii <eliz@gnu.org>
parents:
31021
diff
changeset
|
74 @cindex characters in a certain charset |
b72f53ea6c54
Document list-charset-chars.
Eli Zaretskii <eliz@gnu.org>
parents:
31021
diff
changeset
|
75 The command @kbd{M-x list-charset-chars} prompts for a name of a |
b72f53ea6c54
Document list-charset-chars.
Eli Zaretskii <eliz@gnu.org>
parents:
31021
diff
changeset
|
76 character set, and displays all the characters in that character set. |
b72f53ea6c54
Document list-charset-chars.
Eli Zaretskii <eliz@gnu.org>
parents:
31021
diff
changeset
|
77 |
25829 | 78 Keyboards, even in the countries where these character sets are used, |
79 generally don't have keys for all the characters in them. So Emacs | |
80 supports various @dfn{input methods}, typically one for each script or | |
81 language, to make it convenient to type them. | |
82 | |
83 @kindex C-x RET | |
84 The prefix key @kbd{C-x @key{RET}} is used for commands that pertain | |
85 to multibyte characters, coding systems, and input methods. | |
86 | |
87 @node Enabling Multibyte | |
88 @section Enabling Multibyte Characters | |
89 | |
90 You can enable or disable multibyte character support, either for | |
91 Emacs as a whole, or for a single buffer. When multibyte characters are | |
92 disabled in a buffer, then each byte in that buffer represents a | |
93 character, even codes 0200 through 0377. The old features for | |
94 supporting the European character sets, ISO Latin-1 and ISO Latin-2, | |
95 work as they did in Emacs 19 and also work for the other ISO 8859 | |
96 character sets. | |
97 | |
98 However, there is no need to turn off multibyte character support to | |
99 use ISO Latin; the Emacs multibyte character set includes all the | |
100 characters in these character sets, and Emacs can translate | |
101 automatically to and from the ISO codes. | |
102 | |
103 To edit a particular file in unibyte representation, visit it using | |
104 @code{find-file-literally}. @xref{Visiting}. To convert a buffer in | |
105 multibyte representation into a single-byte representation of the same | |
106 characters, the easiest way is to save the contents in a file, kill the | |
107 buffer, and find the file again with @code{find-file-literally}. You | |
108 can also use @kbd{C-x @key{RET} c} | |
109 (@code{universal-coding-system-argument}) and specify @samp{raw-text} as | |
110 the coding system with which to find or save a file. @xref{Specify | |
111 Coding}. Finding a file as @samp{raw-text} doesn't disable format | |
112 conversion, uncompression and auto mode selection as | |
113 @code{find-file-literally} does. | |
114 | |
115 @vindex enable-multibyte-characters | |
116 @vindex default-enable-multibyte-characters | |
117 To turn off multibyte character support by default, start Emacs with | |
118 the @samp{--unibyte} option (@pxref{Initial Options}), or set the | |
29107 | 119 environment variable @env{EMACS_UNIBYTE}. You can also customize |
25829 | 120 @code{enable-multibyte-characters} or, equivalently, directly set the |
121 variable @code{default-enable-multibyte-characters} in your init file to | |
122 have basically the same effect as @samp{--unibyte}. | |
123 | |
124 Multibyte strings are not created during initialization from the | |
125 values of environment variables, @file{/etc/passwd} entries etc.@: that | |
126 contain non-ASCII 8-bit characters. However, the initialization file is | |
127 normally read as multibyte---like Lisp files in general---even with | |
128 @samp{--unibyte}. To avoid multibyte strings being generated by | |
129 non-ASCII characters in it, put @samp{-*-unibyte: t;-*-} in a comment on | |
130 the first line. Do the same for initialization files for packages like | |
131 Gnus. | |
132 | |
133 The mode line indicates whether multibyte character support is enabled | |
134 in the current buffer. If it is, there are two or more characters (most | |
135 often two dashes) before the colon near the beginning of the mode line. | |
136 When multibyte characters are not enabled, just one dash precedes the | |
137 colon. | |
138 | |
139 @node Language Environments | |
140 @section Language Environments | |
141 @cindex language environments | |
142 | |
143 All supported character sets are supported in Emacs buffers whenever | |
144 multibyte characters are enabled; there is no need to select a | |
145 particular language in order to display its characters in an Emacs | |
146 buffer. However, it is important to select a @dfn{language environment} | |
147 in order to set various defaults. The language environment really | |
148 represents a choice of preferred script (more or less) rather than a | |
149 choice of language. | |
150 | |
151 The language environment controls which coding systems to recognize | |
152 when reading text (@pxref{Recognize Coding}). This applies to files, | |
153 incoming mail, netnews, and any other text you read into Emacs. It may | |
154 also specify the default coding system to use when you create a file. | |
155 Each language environment also specifies a default input method. | |
156 | |
157 @findex set-language-environment | |
26140
068f7ad41d40
Describe new functions and variables for locales.
Paul Eggert <eggert@twinsun.com>
parents:
25829
diff
changeset
|
158 @vindex current-language-environment |
068f7ad41d40
Describe new functions and variables for locales.
Paul Eggert <eggert@twinsun.com>
parents:
25829
diff
changeset
|
159 To select a language environment, customize the option |
068f7ad41d40
Describe new functions and variables for locales.
Paul Eggert <eggert@twinsun.com>
parents:
25829
diff
changeset
|
160 @code{current-language-environment} or use the command @kbd{M-x |
25829 | 161 set-language-environment}. It makes no difference which buffer is |
162 current when you use this command, because the effects apply globally to | |
163 the Emacs session. The supported language environments include: | |
164 | |
165 @quotation | |
26140
068f7ad41d40
Describe new functions and variables for locales.
Paul Eggert <eggert@twinsun.com>
parents:
25829
diff
changeset
|
166 Chinese-BIG5, Chinese-CNS, Chinese-GB, Cyrillic-ALT, Cyrillic-ISO, |
068f7ad41d40
Describe new functions and variables for locales.
Paul Eggert <eggert@twinsun.com>
parents:
25829
diff
changeset
|
167 Cyrillic-KOI8, Czech, Devanagari, English, Ethiopic, German, Greek, |
068f7ad41d40
Describe new functions and variables for locales.
Paul Eggert <eggert@twinsun.com>
parents:
25829
diff
changeset
|
168 Hebrew, IPA, Japanese, Korean, Lao, Latin-1, Latin-2, Latin-3, |
068f7ad41d40
Describe new functions and variables for locales.
Paul Eggert <eggert@twinsun.com>
parents:
25829
diff
changeset
|
169 Latin-4, Latin-5, Latin-8, Latin-9, Romanian, Slovak, Slovenian, Thai, |
068f7ad41d40
Describe new functions and variables for locales.
Paul Eggert <eggert@twinsun.com>
parents:
25829
diff
changeset
|
170 Tibetan, Turkish, and Vietnamese. |
25829 | 171 @end quotation |
172 | |
26140
068f7ad41d40
Describe new functions and variables for locales.
Paul Eggert <eggert@twinsun.com>
parents:
25829
diff
changeset
|
173 @findex set-locale-environment |
068f7ad41d40
Describe new functions and variables for locales.
Paul Eggert <eggert@twinsun.com>
parents:
25829
diff
changeset
|
174 @vindex locale-language-names |
068f7ad41d40
Describe new functions and variables for locales.
Paul Eggert <eggert@twinsun.com>
parents:
25829
diff
changeset
|
175 @vindex locale-charset-language-names |
25829 | 176 Some operating systems let you specify the language you are using by |
26140
068f7ad41d40
Describe new functions and variables for locales.
Paul Eggert <eggert@twinsun.com>
parents:
25829
diff
changeset
|
177 setting the locale environment variables @env{LC_ALL}, @env{LC_CTYPE}, |
068f7ad41d40
Describe new functions and variables for locales.
Paul Eggert <eggert@twinsun.com>
parents:
25829
diff
changeset
|
178 and @env{LANG}; the first of these which is nonempty specifies your |
068f7ad41d40
Describe new functions and variables for locales.
Paul Eggert <eggert@twinsun.com>
parents:
25829
diff
changeset
|
179 locale. Emacs handles this during startup by invoking the |
068f7ad41d40
Describe new functions and variables for locales.
Paul Eggert <eggert@twinsun.com>
parents:
25829
diff
changeset
|
180 @code{set-locale-environment} function, which matches your locale |
068f7ad41d40
Describe new functions and variables for locales.
Paul Eggert <eggert@twinsun.com>
parents:
25829
diff
changeset
|
181 against entries in the value of the variable |
068f7ad41d40
Describe new functions and variables for locales.
Paul Eggert <eggert@twinsun.com>
parents:
25829
diff
changeset
|
182 @code{locale-language-names} and selects the corresponding language |
068f7ad41d40
Describe new functions and variables for locales.
Paul Eggert <eggert@twinsun.com>
parents:
25829
diff
changeset
|
183 environment if a match is found. But if your locale also matches an |
068f7ad41d40
Describe new functions and variables for locales.
Paul Eggert <eggert@twinsun.com>
parents:
25829
diff
changeset
|
184 entry in the variable @code{locale-charset-language-names}, this entry |
068f7ad41d40
Describe new functions and variables for locales.
Paul Eggert <eggert@twinsun.com>
parents:
25829
diff
changeset
|
185 is preferred if its character set disagrees. For example, suppose the |
068f7ad41d40
Describe new functions and variables for locales.
Paul Eggert <eggert@twinsun.com>
parents:
25829
diff
changeset
|
186 locale @samp{en_GB.ISO8859-15} matches @code{"Latin-1"} in |
068f7ad41d40
Describe new functions and variables for locales.
Paul Eggert <eggert@twinsun.com>
parents:
25829
diff
changeset
|
187 @code{locale-language-names} and @code{"Latin-9"} in |
068f7ad41d40
Describe new functions and variables for locales.
Paul Eggert <eggert@twinsun.com>
parents:
25829
diff
changeset
|
188 @code{locale-charset-language-names}; since these two language |
068f7ad41d40
Describe new functions and variables for locales.
Paul Eggert <eggert@twinsun.com>
parents:
25829
diff
changeset
|
189 environments' character sets disagree, Emacs uses @code{"Latin-9"}. |
068f7ad41d40
Describe new functions and variables for locales.
Paul Eggert <eggert@twinsun.com>
parents:
25829
diff
changeset
|
190 |
26513
949ca235ee9e
Describe the relationship between set-locale-environment and
Paul Eggert <eggert@twinsun.com>
parents:
26140
diff
changeset
|
191 If all goes well, the @code{set-locale-environment} function selects |
949ca235ee9e
Describe the relationship between set-locale-environment and
Paul Eggert <eggert@twinsun.com>
parents:
26140
diff
changeset
|
192 the language environment, since language is part of locale. It also |
949ca235ee9e
Describe the relationship between set-locale-environment and
Paul Eggert <eggert@twinsun.com>
parents:
26140
diff
changeset
|
193 adjusts the display table and terminal coding system, the locale coding |
949ca235ee9e
Describe the relationship between set-locale-environment and
Paul Eggert <eggert@twinsun.com>
parents:
26140
diff
changeset
|
194 system, and the preferred coding system as needed for the locale. |
949ca235ee9e
Describe the relationship between set-locale-environment and
Paul Eggert <eggert@twinsun.com>
parents:
26140
diff
changeset
|
195 |
949ca235ee9e
Describe the relationship between set-locale-environment and
Paul Eggert <eggert@twinsun.com>
parents:
26140
diff
changeset
|
196 Since the @code{set-locale-environment} function is automatically |
949ca235ee9e
Describe the relationship between set-locale-environment and
Paul Eggert <eggert@twinsun.com>
parents:
26140
diff
changeset
|
197 invoked during startup, you normally do not need to invoke it yourself. |
949ca235ee9e
Describe the relationship between set-locale-environment and
Paul Eggert <eggert@twinsun.com>
parents:
26140
diff
changeset
|
198 However, if you modify the @env{LC_ALL}, @env{LC_CTYPE}, or @env{LANG} |
949ca235ee9e
Describe the relationship between set-locale-environment and
Paul Eggert <eggert@twinsun.com>
parents:
26140
diff
changeset
|
199 environment variables, you may want to invoke the |
949ca235ee9e
Describe the relationship between set-locale-environment and
Paul Eggert <eggert@twinsun.com>
parents:
26140
diff
changeset
|
200 @code{set-locale-environment} function afterwards. |
949ca235ee9e
Describe the relationship between set-locale-environment and
Paul Eggert <eggert@twinsun.com>
parents:
26140
diff
changeset
|
201 |
26140
068f7ad41d40
Describe new functions and variables for locales.
Paul Eggert <eggert@twinsun.com>
parents:
25829
diff
changeset
|
202 @findex set-locale-environment |
068f7ad41d40
Describe new functions and variables for locales.
Paul Eggert <eggert@twinsun.com>
parents:
25829
diff
changeset
|
203 @vindex locale-preferred-coding-systems |
068f7ad41d40
Describe new functions and variables for locales.
Paul Eggert <eggert@twinsun.com>
parents:
25829
diff
changeset
|
204 The @code{set-locale-environment} function normally uses the preferred |
068f7ad41d40
Describe new functions and variables for locales.
Paul Eggert <eggert@twinsun.com>
parents:
25829
diff
changeset
|
205 coding system established by the language environment to decode system |
068f7ad41d40
Describe new functions and variables for locales.
Paul Eggert <eggert@twinsun.com>
parents:
25829
diff
changeset
|
206 messages. But if your locale matches an entry in the variable |
068f7ad41d40
Describe new functions and variables for locales.
Paul Eggert <eggert@twinsun.com>
parents:
25829
diff
changeset
|
207 @code{locale-preferred-coding-systems}, Emacs uses the corresponding |
068f7ad41d40
Describe new functions and variables for locales.
Paul Eggert <eggert@twinsun.com>
parents:
25829
diff
changeset
|
208 coding system instead. For example, if the locale @samp{ja_JP.PCK} |
068f7ad41d40
Describe new functions and variables for locales.
Paul Eggert <eggert@twinsun.com>
parents:
25829
diff
changeset
|
209 matches @code{japanese-shift-jis} in |
068f7ad41d40
Describe new functions and variables for locales.
Paul Eggert <eggert@twinsun.com>
parents:
25829
diff
changeset
|
210 @code{locale-preferred-coding-systems}, Emacs uses that encoding even |
068f7ad41d40
Describe new functions and variables for locales.
Paul Eggert <eggert@twinsun.com>
parents:
25829
diff
changeset
|
211 though it might normally use @code{japanese-iso-8bit}. |
068f7ad41d40
Describe new functions and variables for locales.
Paul Eggert <eggert@twinsun.com>
parents:
25829
diff
changeset
|
212 |
068f7ad41d40
Describe new functions and variables for locales.
Paul Eggert <eggert@twinsun.com>
parents:
25829
diff
changeset
|
213 The environment chosen from the locale when Emacs starts is |
068f7ad41d40
Describe new functions and variables for locales.
Paul Eggert <eggert@twinsun.com>
parents:
25829
diff
changeset
|
214 overidden by any explicit use of the command |
068f7ad41d40
Describe new functions and variables for locales.
Paul Eggert <eggert@twinsun.com>
parents:
25829
diff
changeset
|
215 @code{set-language-environment} or customization of |
068f7ad41d40
Describe new functions and variables for locales.
Paul Eggert <eggert@twinsun.com>
parents:
25829
diff
changeset
|
216 @code{current-language-environment} in your init file. |
25829 | 217 |
218 @kindex C-h L | |
219 @findex describe-language-environment | |
220 To display information about the effects of a certain language | |
221 environment @var{lang-env}, use the command @kbd{C-h L @var{lang-env} | |
222 @key{RET}} (@code{describe-language-environment}). This tells you which | |
223 languages this language environment is useful for, and lists the | |
224 character sets, coding systems, and input methods that go with it. It | |
225 also shows some sample text to illustrate scripts used in this language | |
226 environment. By default, this command describes the chosen language | |
227 environment. | |
228 | |
229 @vindex set-language-environment-hook | |
230 You can customize any language environment with the normal hook | |
231 @code{set-language-environment-hook}. The command | |
232 @code{set-language-environment} runs that hook after setting up the new | |
233 language environment. The hook functions can test for a specific | |
234 language environment by checking the variable | |
235 @code{current-language-environment}. | |
236 | |
237 @vindex exit-language-environment-hook | |
238 Before it starts to set up the new language environment, | |
239 @code{set-language-environment} first runs the hook | |
240 @code{exit-language-environment-hook}. This hook is useful for undoing | |
241 customizations that were made with @code{set-language-environment-hook}. | |
242 For instance, if you set up a special key binding in a specific language | |
243 environment using @code{set-language-environment-hook}, you should set | |
244 up @code{exit-language-environment-hook} to restore the normal binding | |
245 for that key. | |
246 | |
247 @node Input Methods | |
248 @section Input Methods | |
249 | |
250 @cindex input methods | |
251 An @dfn{input method} is a kind of character conversion designed | |
252 specifically for interactive input. In Emacs, typically each language | |
253 has its own input method; sometimes several languages which use the same | |
254 characters can share one input method. A few languages support several | |
255 input methods. | |
256 | |
257 The simplest kind of input method works by mapping ASCII letters into | |
258 another alphabet. This is how the Greek and Russian input methods work. | |
259 | |
260 A more powerful technique is composition: converting sequences of | |
261 characters into one letter. Many European input methods use composition | |
262 to produce a single non-ASCII letter from a sequence that consists of a | |
263 letter followed by accent characters (or vice versa). For example, some | |
264 methods convert the sequence @kbd{a'} into a single accented letter. | |
265 These input methods have no special commands of their own; all they do | |
266 is compose sequences of printing characters. | |
267 | |
268 The input methods for syllabic scripts typically use mapping followed | |
269 by composition. The input methods for Thai and Korean work this way. | |
270 First, letters are mapped into symbols for particular sounds or tone | |
271 marks; then, sequences of these which make up a whole syllable are | |
272 mapped into one syllable sign. | |
273 | |
274 Chinese and Japanese require more complex methods. In Chinese input | |
275 methods, first you enter the phonetic spelling of a Chinese word (in | |
276 input method @code{chinese-py}, among others), or a sequence of portions | |
277 of the character (input methods @code{chinese-4corner} and | |
278 @code{chinese-sw}, and others). Since one phonetic spelling typically | |
279 corresponds to many different Chinese characters, you must select one of | |
280 the alternatives using special Emacs commands. Keys such as @kbd{C-f}, | |
281 @kbd{C-b}, @kbd{C-n}, @kbd{C-p}, and digits have special definitions in | |
282 this situation, used for selecting among the alternatives. @key{TAB} | |
283 displays a buffer showing all the possibilities. | |
284 | |
285 In Japanese input methods, first you input a whole word using | |
286 phonetic spelling; then, after the word is in the buffer, Emacs converts | |
287 it into one or more characters using a large dictionary. One phonetic | |
288 spelling corresponds to many differently written Japanese words, so you | |
289 must select one of them; use @kbd{C-n} and @kbd{C-p} to cycle through | |
290 the alternatives. | |
291 | |
292 Sometimes it is useful to cut off input method processing so that the | |
293 characters you have just entered will not combine with subsequent | |
294 characters. For example, in input method @code{latin-1-postfix}, the | |
295 sequence @kbd{e '} combines to form an @samp{e} with an accent. What if | |
296 you want to enter them as separate characters? | |
297 | |
298 One way is to type the accent twice; that is a special feature for | |
299 entering the separate letter and accent. For example, @kbd{e ' '} gives | |
300 you the two characters @samp{e'}. Another way is to type another letter | |
301 after the @kbd{e}---something that won't combine with that---and | |
302 immediately delete it. For example, you could type @kbd{e e @key{DEL} | |
303 '} to get separate @samp{e} and @samp{'}. | |
304 | |
305 Another method, more general but not quite as easy to type, is to use | |
306 @kbd{C-\ C-\} between two characters to stop them from combining. This | |
307 is the command @kbd{C-\} (@code{toggle-input-method}) used twice. | |
308 @ifinfo | |
309 @xref{Select Input Method}. | |
310 @end ifinfo | |
311 | |
312 @kbd{C-\ C-\} is especially useful inside an incremental search, | |
313 because it stops waiting for more characters to combine, and starts | |
314 searching for what you have already entered. | |
315 | |
316 @vindex input-method-verbose-flag | |
317 @vindex input-method-highlight-flag | |
318 The variables @code{input-method-highlight-flag} and | |
319 @code{input-method-verbose-flag} control how input methods explain what | |
320 is happening. If @code{input-method-highlight-flag} is non-@code{nil}, | |
321 the partial sequence is highlighted in the buffer. If | |
322 @code{input-method-verbose-flag} is non-@code{nil}, the list of possible | |
323 characters to type next is displayed in the echo area (but not when you | |
324 are in the minibuffer). | |
325 | |
326 @node Select Input Method | |
327 @section Selecting an Input Method | |
328 | |
329 @table @kbd | |
330 @item C-\ | |
331 Enable or disable use of the selected input method. | |
332 | |
333 @item C-x @key{RET} C-\ @var{method} @key{RET} | |
334 Select a new input method for the current buffer. | |
335 | |
336 @item C-h I @var{method} @key{RET} | |
337 @itemx C-h C-\ @var{method} @key{RET} | |
338 @findex describe-input-method | |
339 @kindex C-h I | |
340 @kindex C-h C-\ | |
341 Describe the input method @var{method} (@code{describe-input-method}). | |
342 By default, it describes the current input method (if any). | |
343 This description should give you the full details of how to | |
344 use any particular input method. | |
345 | |
346 @item M-x list-input-methods | |
347 Display a list of all the supported input methods. | |
348 @end table | |
349 | |
350 @findex set-input-method | |
351 @vindex current-input-method | |
352 @kindex C-x RET C-\ | |
353 To choose an input method for the current buffer, use @kbd{C-x | |
354 @key{RET} C-\} (@code{set-input-method}). This command reads the | |
355 input method name with the minibuffer; the name normally starts with the | |
356 language environment that it is meant to be used with. The variable | |
357 @code{current-input-method} records which input method is selected. | |
358 | |
359 @findex toggle-input-method | |
360 @kindex C-\ | |
361 Input methods use various sequences of ASCII characters to stand for | |
362 non-ASCII characters. Sometimes it is useful to turn off the input | |
363 method temporarily. To do this, type @kbd{C-\} | |
364 (@code{toggle-input-method}). To reenable the input method, type | |
365 @kbd{C-\} again. | |
366 | |
367 If you type @kbd{C-\} and you have not yet selected an input method, | |
368 it prompts for you to specify one. This has the same effect as using | |
369 @kbd{C-x @key{RET} C-\} to specify an input method. | |
370 | |
371 @vindex default-input-method | |
372 Selecting a language environment specifies a default input method for | |
373 use in various buffers. When you have a default input method, you can | |
374 select it in the current buffer by typing @kbd{C-\}. The variable | |
375 @code{default-input-method} specifies the default input method | |
376 (@code{nil} means there is none). | |
377 | |
378 @findex quail-set-keyboard-layout | |
379 Some input methods for alphabetic scripts work by (in effect) | |
380 remapping the keyboard to emulate various keyboard layouts commonly used | |
381 for those scripts. How to do this remapping properly depends on your | |
382 actual keyboard layout. To specify which layout your keyboard has, use | |
383 the command @kbd{M-x quail-set-keyboard-layout}. | |
384 | |
385 @findex list-input-methods | |
386 To display a list of all the supported input methods, type @kbd{M-x | |
387 list-input-methods}. The list gives information about each input | |
388 method, including the string that stands for it in the mode line. | |
389 | |
390 @node Multibyte Conversion | |
391 @section Unibyte and Multibyte Non-ASCII characters | |
392 | |
393 When multibyte characters are enabled, character codes 0240 (octal) | |
394 through 0377 (octal) are not really legitimate in the buffer. The valid | |
395 non-ASCII printing characters have codes that start from 0400. | |
396 | |
397 If you type a self-inserting character in the invalid range 0240 | |
398 through 0377, Emacs assumes you intended to use one of the ISO | |
399 Latin-@var{n} character sets, and converts it to the Emacs code | |
400 representing that Latin-@var{n} character. You select @emph{which} ISO | |
401 Latin character set to use through your choice of language environment | |
402 @iftex | |
403 (see above). | |
404 @end iftex | |
405 @ifinfo | |
406 (@pxref{Language Environments}). | |
407 @end ifinfo | |
408 If you do not specify a choice, the default is Latin-1. | |
409 | |
410 The same thing happens when you use @kbd{C-q} to enter an octal code | |
411 in this range. | |
412 | |
413 @node Coding Systems | |
414 @section Coding Systems | |
415 @cindex coding systems | |
416 | |
417 Users of various languages have established many more-or-less standard | |
418 coding systems for representing them. Emacs does not use these coding | |
419 systems internally; instead, it converts from various coding systems to | |
420 its own system when reading data, and converts the internal coding | |
421 system to other coding systems when writing data. Conversion is | |
422 possible in reading or writing files, in sending or receiving from the | |
423 terminal, and in exchanging data with subprocesses. | |
424 | |
425 Emacs assigns a name to each coding system. Most coding systems are | |
426 used for one language, and the name of the coding system starts with the | |
427 language name. Some coding systems are used for several languages; | |
428 their names usually start with @samp{iso}. There are also special | |
429 coding systems @code{no-conversion}, @code{raw-text} and | |
430 @code{emacs-mule} which do not convert printing characters at all. | |
431 | |
432 @cindex end-of-line conversion | |
433 In addition to converting various representations of non-ASCII | |
434 characters, a coding system can perform end-of-line conversion. Emacs | |
435 handles three different conventions for how to separate lines in a file: | |
436 newline, carriage-return linefeed, and just carriage-return. | |
437 | |
438 @table @kbd | |
439 @item C-h C @var{coding} @key{RET} | |
440 Describe coding system @var{coding}. | |
441 | |
442 @item C-h C @key{RET} | |
443 Describe the coding systems currently in use. | |
444 | |
445 @item M-x list-coding-systems | |
446 Display a list of all the supported coding systems. | |
447 @end table | |
448 | |
449 @kindex C-h C | |
450 @findex describe-coding-system | |
451 The command @kbd{C-h C} (@code{describe-coding-system}) displays | |
452 information about particular coding systems. You can specify a coding | |
453 system name as argument; alternatively, with an empty argument, it | |
454 describes the coding systems currently selected for various purposes, | |
455 both in the current buffer and as the defaults, and the priority list | |
456 for recognizing coding systems (@pxref{Recognize Coding}). | |
457 | |
458 @findex list-coding-systems | |
459 To display a list of all the supported coding systems, type @kbd{M-x | |
460 list-coding-systems}. The list gives information about each coding | |
461 system, including the letter that stands for it in the mode line | |
462 (@pxref{Mode Line}). | |
463 | |
464 @cindex end-of-line conversion | |
465 @cindex MS-DOS end-of-line conversion | |
466 @cindex Macintosh end-of-line conversion | |
467 Each of the coding systems that appear in this list---except for | |
468 @code{no-conversion}, which means no conversion of any kind---specifies | |
469 how and whether to convert printing characters, but leaves the choice of | |
470 end-of-line conversion to be decided based on the contents of each file. | |
471 For example, if the file appears to use the sequence carriage-return | |
472 linefeed to separate lines, DOS end-of-line conversion will be used. | |
473 | |
474 Each of the listed coding systems has three variants which specify | |
475 exactly what to do for end-of-line conversion: | |
476 | |
477 @table @code | |
478 @item @dots{}-unix | |
479 Don't do any end-of-line conversion; assume the file uses | |
480 newline to separate lines. (This is the convention normally used | |
481 on Unix and GNU systems.) | |
482 | |
483 @item @dots{}-dos | |
484 Assume the file uses carriage-return linefeed to separate lines, and do | |
485 the appropriate conversion. (This is the convention normally used on | |
486 Microsoft systems.@footnote{It is also specified for MIME `text/*' | |
487 bodies and in other network transport contexts. It is different | |
488 from the SGML reference syntax record-start/record-end format which | |
489 Emacs doesn't support directly.}) | |
490 | |
491 @item @dots{}-mac | |
492 Assume the file uses carriage-return to separate lines, and do the | |
493 appropriate conversion. (This is the convention normally used on the | |
494 Macintosh system.) | |
495 @end table | |
496 | |
497 These variant coding systems are omitted from the | |
498 @code{list-coding-systems} display for brevity, since they are entirely | |
499 predictable. For example, the coding system @code{iso-latin-1} has | |
500 variants @code{iso-latin-1-unix}, @code{iso-latin-1-dos} and | |
501 @code{iso-latin-1-mac}. | |
502 | |
503 The coding system @code{raw-text} is good for a file which is mainly | |
504 ASCII text, but may contain byte values above 127 which are not meant to | |
505 encode non-ASCII characters. With @code{raw-text}, Emacs copies those | |
506 byte values unchanged, and sets @code{enable-multibyte-characters} to | |
507 @code{nil} in the current buffer so that they will be interpreted | |
508 properly. @code{raw-text} handles end-of-line conversion in the usual | |
509 way, based on the data encountered, and has the usual three variants to | |
510 specify the kind of end-of-line conversion to use. | |
511 | |
512 In contrast, the coding system @code{no-conversion} specifies no | |
513 character code conversion at all---none for non-ASCII byte values and | |
514 none for end of line. This is useful for reading or writing binary | |
515 files, tar files, and other files that must be examined verbatim. It, | |
516 too, sets @code{enable-multibyte-characters} to @code{nil}. | |
517 | |
518 The easiest way to edit a file with no conversion of any kind is with | |
519 the @kbd{M-x find-file-literally} command. This uses | |
520 @code{no-conversion}, and also suppresses other Emacs features that | |
521 might convert the file contents before you see them. @xref{Visiting}. | |
522 | |
523 The coding system @code{emacs-mule} means that the file contains | |
524 non-ASCII characters stored with the internal Emacs encoding. It | |
525 handles end-of-line conversion based on the data encountered, and has | |
526 the usual three variants to specify the kind of end-of-line conversion. | |
527 | |
528 @node Recognize Coding | |
529 @section Recognizing Coding Systems | |
530 | |
531 Most of the time, Emacs can recognize which coding system to use for | |
532 any given file---once you have specified your preferences. | |
533 | |
534 Some coding systems can be recognized or distinguished by which byte | |
535 sequences appear in the data. However, there are coding systems that | |
536 cannot be distinguished, not even potentially. For example, there is no | |
537 way to distinguish between Latin-1 and Latin-2; they use the same byte | |
538 values with different meanings. | |
539 | |
540 Emacs handles this situation by means of a priority list of coding | |
541 systems. Whenever Emacs reads a file, if you do not specify the coding | |
542 system to use, Emacs checks the data against each coding system, | |
543 starting with the first in priority and working down the list, until it | |
544 finds a coding system that fits the data. Then it converts the file | |
545 contents assuming that they are represented in this coding system. | |
546 | |
547 The priority list of coding systems depends on the selected language | |
548 environment (@pxref{Language Environments}). For example, if you use | |
549 French, you probably want Emacs to prefer Latin-1 to Latin-2; if you use | |
550 Czech, you probably want Latin-2 to be preferred. This is one of the | |
551 reasons to specify a language environment. | |
552 | |
553 @findex prefer-coding-system | |
554 However, you can alter the priority list in detail with the command | |
555 @kbd{M-x prefer-coding-system}. This command reads the name of a coding | |
556 system from the minibuffer, and adds it to the front of the priority | |
557 list, so that it is preferred to all others. If you use this command | |
558 several times, each use adds one element to the front of the priority | |
559 list. | |
560 | |
561 If you use a coding system that specifies the end-of-line conversion | |
562 type, such as @code{iso-8859-1-dos}, what that means is that Emacs | |
563 should attempt to recognize @code{iso-8859-1} with priority, and should | |
564 use DOS end-of-line conversion in case it recognizes @code{iso-8859-1}. | |
565 | |
566 @vindex file-coding-system-alist | |
567 Sometimes a file name indicates which coding system to use for the | |
568 file. The variable @code{file-coding-system-alist} specifies this | |
569 correspondence. There is a special function | |
570 @code{modify-coding-system-alist} for adding elements to this list. For | |
571 example, to read and write all @samp{.txt} files using the coding system | |
572 @code{china-iso-8bit}, you can execute this Lisp expression: | |
573 | |
574 @smallexample | |
575 (modify-coding-system-alist 'file "\\.txt\\'" 'china-iso-8bit) | |
576 @end smallexample | |
577 | |
578 @noindent | |
579 The first argument should be @code{file}, the second argument should be | |
580 a regular expression that determines which files this applies to, and | |
581 the third argument says which coding system to use for these files. | |
582 | |
583 @vindex inhibit-eol-conversion | |
30375
5c4951d58989
(Recognize Coding): Document the variable inhibit-iso-escape-detection.
Eli Zaretskii <eliz@gnu.org>
parents:
29826
diff
changeset
|
584 @cindex DOS-style end-of-line display |
25829 | 585 Emacs recognizes which kind of end-of-line conversion to use based on |
586 the contents of the file: if it sees only carriage-returns, or only | |
587 carriage-return linefeed sequences, then it chooses the end-of-line | |
588 conversion accordingly. You can inhibit the automatic use of | |
589 end-of-line conversion by setting the variable @code{inhibit-eol-conversion} | |
590 to non-@code{nil}. | |
591 | |
30375
5c4951d58989
(Recognize Coding): Document the variable inhibit-iso-escape-detection.
Eli Zaretskii <eliz@gnu.org>
parents:
29826
diff
changeset
|
592 @vindex inhibit-iso-escape-detection |
5c4951d58989
(Recognize Coding): Document the variable inhibit-iso-escape-detection.
Eli Zaretskii <eliz@gnu.org>
parents:
29826
diff
changeset
|
593 @cindex escape sequences in files |
5c4951d58989
(Recognize Coding): Document the variable inhibit-iso-escape-detection.
Eli Zaretskii <eliz@gnu.org>
parents:
29826
diff
changeset
|
594 By default, the automatic detection of coding system is sensitive to |
5c4951d58989
(Recognize Coding): Document the variable inhibit-iso-escape-detection.
Eli Zaretskii <eliz@gnu.org>
parents:
29826
diff
changeset
|
595 escape sequences. If Emacs sees a sequence of characters that begin |
5c4951d58989
(Recognize Coding): Document the variable inhibit-iso-escape-detection.
Eli Zaretskii <eliz@gnu.org>
parents:
29826
diff
changeset
|
596 with an @key{ESC} character, and the sequence is valid as an ISO-2022 |
5c4951d58989
(Recognize Coding): Document the variable inhibit-iso-escape-detection.
Eli Zaretskii <eliz@gnu.org>
parents:
29826
diff
changeset
|
597 code, the code is determined as one of ISO-2022 encoding, and the file |
5c4951d58989
(Recognize Coding): Document the variable inhibit-iso-escape-detection.
Eli Zaretskii <eliz@gnu.org>
parents:
29826
diff
changeset
|
598 is decoded by the corresponding coding system |
5c4951d58989
(Recognize Coding): Document the variable inhibit-iso-escape-detection.
Eli Zaretskii <eliz@gnu.org>
parents:
29826
diff
changeset
|
599 (e.g. @code{iso-2022-7bit}). |
5c4951d58989
(Recognize Coding): Document the variable inhibit-iso-escape-detection.
Eli Zaretskii <eliz@gnu.org>
parents:
29826
diff
changeset
|
600 |
5c4951d58989
(Recognize Coding): Document the variable inhibit-iso-escape-detection.
Eli Zaretskii <eliz@gnu.org>
parents:
29826
diff
changeset
|
601 However, there may be cases that you want to read escape sequences in |
5c4951d58989
(Recognize Coding): Document the variable inhibit-iso-escape-detection.
Eli Zaretskii <eliz@gnu.org>
parents:
29826
diff
changeset
|
602 a file as is. In such a case, you can set th variable |
5c4951d58989
(Recognize Coding): Document the variable inhibit-iso-escape-detection.
Eli Zaretskii <eliz@gnu.org>
parents:
29826
diff
changeset
|
603 @code{inhibit-iso-escape-detection} to non-@code{nil}. Then the code |
5c4951d58989
(Recognize Coding): Document the variable inhibit-iso-escape-detection.
Eli Zaretskii <eliz@gnu.org>
parents:
29826
diff
changeset
|
604 detection will ignore any escape sequences, and so no file is detected |
5c4951d58989
(Recognize Coding): Document the variable inhibit-iso-escape-detection.
Eli Zaretskii <eliz@gnu.org>
parents:
29826
diff
changeset
|
605 as being encoded in some of ISO-2022 encoding. The result is that all |
5c4951d58989
(Recognize Coding): Document the variable inhibit-iso-escape-detection.
Eli Zaretskii <eliz@gnu.org>
parents:
29826
diff
changeset
|
606 escape sequences become visible in a buffer. |
5c4951d58989
(Recognize Coding): Document the variable inhibit-iso-escape-detection.
Eli Zaretskii <eliz@gnu.org>
parents:
29826
diff
changeset
|
607 |
5c4951d58989
(Recognize Coding): Document the variable inhibit-iso-escape-detection.
Eli Zaretskii <eliz@gnu.org>
parents:
29826
diff
changeset
|
608 The default value of @code{inhibit-iso-escape-detection} is |
5c4951d58989
(Recognize Coding): Document the variable inhibit-iso-escape-detection.
Eli Zaretskii <eliz@gnu.org>
parents:
29826
diff
changeset
|
609 @code{nil}, and it is strongly recommended not to change it. That's |
5c4951d58989
(Recognize Coding): Document the variable inhibit-iso-escape-detection.
Eli Zaretskii <eliz@gnu.org>
parents:
29826
diff
changeset
|
610 because many Emacs Lisp source files that contain non-ASCII characters |
5c4951d58989
(Recognize Coding): Document the variable inhibit-iso-escape-detection.
Eli Zaretskii <eliz@gnu.org>
parents:
29826
diff
changeset
|
611 are encoded in the coding system @code{iso-2022-7bit} in the Emacs |
5c4951d58989
(Recognize Coding): Document the variable inhibit-iso-escape-detection.
Eli Zaretskii <eliz@gnu.org>
parents:
29826
diff
changeset
|
612 distribution, and they won't be decoded correctly when you visit those |
5c4951d58989
(Recognize Coding): Document the variable inhibit-iso-escape-detection.
Eli Zaretskii <eliz@gnu.org>
parents:
29826
diff
changeset
|
613 files if you suppress the escape sequence detection. |
5c4951d58989
(Recognize Coding): Document the variable inhibit-iso-escape-detection.
Eli Zaretskii <eliz@gnu.org>
parents:
29826
diff
changeset
|
614 |
25829 | 615 @vindex coding |
616 You can specify the coding system for a particular file using the | |
617 @samp{-*-@dots{}-*-} construct at the beginning of a file, or a local | |
618 variables list at the end (@pxref{File Variables}). You do this by | |
619 defining a value for the ``variable'' named @code{coding}. Emacs does | |
620 not really have a variable @code{coding}; instead of setting a variable, | |
621 it uses the specified coding system for the file. For example, | |
622 @samp{-*-mode: C; coding: latin-1;-*-} specifies use of the Latin-1 | |
623 coding system, as well as C mode. If you specify the coding explicitly | |
624 in the file, that overrides @code{file-coding-system-alist}. | |
625 | |
626 @vindex auto-coding-alist | |
627 The variable @code{auto-coding-alist} is the strongest way to specify | |
628 the coding system for certain patterns of file names; this variable even | |
629 overrides @samp{-*-coding:-*-} tags in the file itself. Emacs uses this | |
630 feature for tar and archive files, to prevent Emacs from being confused | |
631 by a @samp{-*-coding:-*-} tag in a member of the archive and thinking it | |
632 applies to the archive file as a whole. | |
633 | |
634 @vindex buffer-file-coding-system | |
635 Once Emacs has chosen a coding system for a buffer, it stores that | |
636 coding system in @code{buffer-file-coding-system} and uses that coding | |
637 system, by default, for operations that write from this buffer into a | |
638 file. This includes the commands @code{save-buffer} and | |
639 @code{write-region}. If you want to write files from this buffer using | |
640 a different coding system, you can specify a different coding system for | |
641 the buffer using @code{set-buffer-file-coding-system} (@pxref{Specify | |
642 Coding}). | |
643 | |
31021
5380bd6b450e
Document the way Emacs prompts for a safe coding system when the
Eli Zaretskii <eliz@gnu.org>
parents:
30375
diff
changeset
|
644 While editing a file, you will sometimes insert characters which |
5380bd6b450e
Document the way Emacs prompts for a safe coding system when the
Eli Zaretskii <eliz@gnu.org>
parents:
30375
diff
changeset
|
645 cannot be encoded with the coding system stored in |
5380bd6b450e
Document the way Emacs prompts for a safe coding system when the
Eli Zaretskii <eliz@gnu.org>
parents:
30375
diff
changeset
|
646 @code{buffer-file-coding-system}. For example, suppose you start with |
5380bd6b450e
Document the way Emacs prompts for a safe coding system when the
Eli Zaretskii <eliz@gnu.org>
parents:
30375
diff
changeset
|
647 an ASCII file and insert a few Latin-1 characters into it. Or you could |
5380bd6b450e
Document the way Emacs prompts for a safe coding system when the
Eli Zaretskii <eliz@gnu.org>
parents:
30375
diff
changeset
|
648 edit a text file in Polish encoded in @code{iso-8859-2} and add to it |
5380bd6b450e
Document the way Emacs prompts for a safe coding system when the
Eli Zaretskii <eliz@gnu.org>
parents:
30375
diff
changeset
|
649 translations of several Polish words into Russian. When you save the |
5380bd6b450e
Document the way Emacs prompts for a safe coding system when the
Eli Zaretskii <eliz@gnu.org>
parents:
30375
diff
changeset
|
650 buffer, Emacs can no longer use the previous value of the buffer's |
5380bd6b450e
Document the way Emacs prompts for a safe coding system when the
Eli Zaretskii <eliz@gnu.org>
parents:
30375
diff
changeset
|
651 coding system, because the characters you added cannot be encoded by |
5380bd6b450e
Document the way Emacs prompts for a safe coding system when the
Eli Zaretskii <eliz@gnu.org>
parents:
30375
diff
changeset
|
652 that coding system. |
5380bd6b450e
Document the way Emacs prompts for a safe coding system when the
Eli Zaretskii <eliz@gnu.org>
parents:
30375
diff
changeset
|
653 |
5380bd6b450e
Document the way Emacs prompts for a safe coding system when the
Eli Zaretskii <eliz@gnu.org>
parents:
30375
diff
changeset
|
654 When that happens, Emacs tries the most-preferred coding system (set |
5380bd6b450e
Document the way Emacs prompts for a safe coding system when the
Eli Zaretskii <eliz@gnu.org>
parents:
30375
diff
changeset
|
655 by @kbd{M-x prefer-coding-system} or @kbd{M-x |
5380bd6b450e
Document the way Emacs prompts for a safe coding system when the
Eli Zaretskii <eliz@gnu.org>
parents:
30375
diff
changeset
|
656 set-language-environment}), and if that coding system can safely encode |
5380bd6b450e
Document the way Emacs prompts for a safe coding system when the
Eli Zaretskii <eliz@gnu.org>
parents:
30375
diff
changeset
|
657 all of the characters in the buffer, Emacs uses it, and stores its value |
5380bd6b450e
Document the way Emacs prompts for a safe coding system when the
Eli Zaretskii <eliz@gnu.org>
parents:
30375
diff
changeset
|
658 in @code{buffer-file-coding-system}. Otherwise, Emacs pops up a window |
5380bd6b450e
Document the way Emacs prompts for a safe coding system when the
Eli Zaretskii <eliz@gnu.org>
parents:
30375
diff
changeset
|
659 with a list of coding systems suitable for encoding the buffer, and |
5380bd6b450e
Document the way Emacs prompts for a safe coding system when the
Eli Zaretskii <eliz@gnu.org>
parents:
30375
diff
changeset
|
660 prompts you to choose one of those coding systems. |
5380bd6b450e
Document the way Emacs prompts for a safe coding system when the
Eli Zaretskii <eliz@gnu.org>
parents:
30375
diff
changeset
|
661 |
5380bd6b450e
Document the way Emacs prompts for a safe coding system when the
Eli Zaretskii <eliz@gnu.org>
parents:
30375
diff
changeset
|
662 If you insert characters which cannot be encoded by the buffer's |
5380bd6b450e
Document the way Emacs prompts for a safe coding system when the
Eli Zaretskii <eliz@gnu.org>
parents:
30375
diff
changeset
|
663 coding system while editing a mail message, Emacs behaves a bit |
5380bd6b450e
Document the way Emacs prompts for a safe coding system when the
Eli Zaretskii <eliz@gnu.org>
parents:
30375
diff
changeset
|
664 differently. It additionally checks whether the most-preferred coding |
5380bd6b450e
Document the way Emacs prompts for a safe coding system when the
Eli Zaretskii <eliz@gnu.org>
parents:
30375
diff
changeset
|
665 system is recommended for use in MIME messages; if it isn't, Emacs tells |
5380bd6b450e
Document the way Emacs prompts for a safe coding system when the
Eli Zaretskii <eliz@gnu.org>
parents:
30375
diff
changeset
|
666 you that the most-preferred coding system is not recommended and prompts |
5380bd6b450e
Document the way Emacs prompts for a safe coding system when the
Eli Zaretskii <eliz@gnu.org>
parents:
30375
diff
changeset
|
667 you for another coding system. This is so you won't inadvertently send |
5380bd6b450e
Document the way Emacs prompts for a safe coding system when the
Eli Zaretskii <eliz@gnu.org>
parents:
30375
diff
changeset
|
668 a message encoded in a way that your recipient's mail software will have |
5380bd6b450e
Document the way Emacs prompts for a safe coding system when the
Eli Zaretskii <eliz@gnu.org>
parents:
30375
diff
changeset
|
669 difficulty decoding. (If you do want to use the most-preferred coding |
5380bd6b450e
Document the way Emacs prompts for a safe coding system when the
Eli Zaretskii <eliz@gnu.org>
parents:
30375
diff
changeset
|
670 system, you can type its name to Emacs prompt anyway.) |
5380bd6b450e
Document the way Emacs prompts for a safe coding system when the
Eli Zaretskii <eliz@gnu.org>
parents:
30375
diff
changeset
|
671 |
25829 | 672 @vindex sendmail-coding-system |
673 When you send a message with Mail mode (@pxref{Sending Mail}), Emacs has | |
674 four different ways to determine the coding system to use for encoding | |
675 the message text. It tries the buffer's own value of | |
676 @code{buffer-file-coding-system}, if that is non-@code{nil}. Otherwise, | |
677 it uses the value of @code{sendmail-coding-system}, if that is | |
678 non-@code{nil}. The third way is to use the default coding system for | |
679 new files, which is controlled by your choice of language environment, | |
680 if that is non-@code{nil}. If all of these three values are @code{nil}, | |
681 Emacs encodes outgoing mail using the Latin-1 coding system. | |
682 | |
683 @vindex rmail-decode-mime-charset | |
684 When you get new mail in Rmail, each message is translated | |
685 automatically from the coding system it is written in---as if it were a | |
686 separate file. This uses the priority list of coding systems that you | |
687 have specified. If a MIME message specifies a character set, Rmail | |
688 obeys that specification, unless @code{rmail-decode-mime-charset} is | |
689 @code{nil}. | |
690 | |
691 @vindex rmail-file-coding-system | |
692 For reading and saving Rmail files themselves, Emacs uses the coding | |
693 system specified by the variable @code{rmail-file-coding-system}. The | |
694 default value is @code{nil}, which means that Rmail files are not | |
695 translated (they are read and written in the Emacs internal character | |
696 code). | |
697 | |
698 @node Specify Coding | |
699 @section Specifying a Coding System | |
700 | |
701 In cases where Emacs does not automatically choose the right coding | |
702 system, you can use these commands to specify one: | |
703 | |
704 @table @kbd | |
705 @item C-x @key{RET} f @var{coding} @key{RET} | |
706 Use coding system @var{coding} for the visited file | |
707 in the current buffer. | |
708 | |
709 @item C-x @key{RET} c @var{coding} @key{RET} | |
710 Specify coding system @var{coding} for the immediately following | |
711 command. | |
712 | |
713 @item C-x @key{RET} k @var{coding} @key{RET} | |
714 Use coding system @var{coding} for keyboard input. | |
715 | |
716 @item C-x @key{RET} t @var{coding} @key{RET} | |
717 Use coding system @var{coding} for terminal output. | |
718 | |
719 @item C-x @key{RET} p @var{input-coding} @key{RET} @var{output-coding} @key{RET} | |
720 Use coding systems @var{input-coding} and @var{output-coding} for | |
721 subprocess input and output in the current buffer. | |
722 | |
723 @item C-x @key{RET} x @var{coding} @key{RET} | |
724 Use coding system @var{coding} for transferring selections to and from | |
725 other programs through the window system. | |
726 | |
727 @item C-x @key{RET} X @var{coding} @key{RET} | |
728 Use coding system @var{coding} for transferring @emph{one} | |
729 selection---the next one---to or from the window system. | |
730 @end table | |
731 | |
732 @kindex C-x RET f | |
733 @findex set-buffer-file-coding-system | |
734 The command @kbd{C-x @key{RET} f} (@code{set-buffer-file-coding-system}) | |
735 specifies the file coding system for the current buffer---in other | |
736 words, which coding system to use when saving or rereading the visited | |
737 file. You specify which coding system using the minibuffer. Since this | |
738 command applies to a file you have already visited, it affects only the | |
739 way the file is saved. | |
740 | |
741 @kindex C-x RET c | |
742 @findex universal-coding-system-argument | |
743 Another way to specify the coding system for a file is when you visit | |
744 the file. First use the command @kbd{C-x @key{RET} c} | |
745 (@code{universal-coding-system-argument}); this command uses the | |
746 minibuffer to read a coding system name. After you exit the minibuffer, | |
747 the specified coding system is used for @emph{the immediately following | |
748 command}. | |
749 | |
750 So if the immediately following command is @kbd{C-x C-f}, for example, | |
751 it reads the file using that coding system (and records the coding | |
752 system for when the file is saved). Or if the immediately following | |
753 command is @kbd{C-x C-w}, it writes the file using that coding system. | |
754 Other file commands affected by a specified coding system include | |
755 @kbd{C-x C-i} and @kbd{C-x C-v}, as well as the other-window variants of | |
756 @kbd{C-x C-f}. | |
757 | |
758 @kbd{C-x @key{RET} c} also affects commands that start subprocesses, | |
759 including @kbd{M-x shell} (@pxref{Shell}). | |
760 | |
761 However, if the immediately following command does not use the coding | |
762 system, then @kbd{C-x @key{RET} c} ultimately has no effect. | |
763 | |
764 An easy way to visit a file with no conversion is with the @kbd{M-x | |
765 find-file-literally} command. @xref{Visiting}. | |
766 | |
767 @vindex default-buffer-file-coding-system | |
768 The variable @code{default-buffer-file-coding-system} specifies the | |
769 choice of coding system to use when you create a new file. It applies | |
770 when you find a new file, and when you create a buffer and then save it | |
771 in a file. Selecting a language environment typically sets this | |
772 variable to a good choice of default coding system for that language | |
773 environment. | |
774 | |
775 @kindex C-x RET t | |
776 @findex set-terminal-coding-system | |
777 The command @kbd{C-x @key{RET} t} (@code{set-terminal-coding-system}) | |
778 specifies the coding system for terminal output. If you specify a | |
779 character code for terminal output, all characters output to the | |
780 terminal are translated into that coding system. | |
781 | |
782 This feature is useful for certain character-only terminals built to | |
783 support specific languages or character sets---for example, European | |
784 terminals that support one of the ISO Latin character sets. You need to | |
785 specify the terminal coding system when using multibyte text, so that | |
786 Emacs knows which characters the terminal can actually handle. | |
787 | |
788 By default, output to the terminal is not translated at all, unless | |
789 Emacs can deduce the proper coding system from your terminal type. | |
790 | |
791 @kindex C-x RET k | |
792 @findex set-keyboard-coding-system | |
793 The command @kbd{C-x @key{RET} k} (@code{set-keyboard-coding-system}) | |
794 specifies the coding system for keyboard input. Character-code | |
795 translation of keyboard input is useful for terminals with keys that | |
796 send non-ASCII graphic characters---for example, some terminals designed | |
797 for ISO Latin-1 or subsets of it. | |
798 | |
799 By default, keyboard input is not translated at all. | |
800 | |
801 There is a similarity between using a coding system translation for | |
802 keyboard input, and using an input method: both define sequences of | |
803 keyboard input that translate into single characters. However, input | |
804 methods are designed to be convenient for interactive use by humans, and | |
805 the sequences that are translated are typically sequences of ASCII | |
806 printing characters. Coding systems typically translate sequences of | |
807 non-graphic characters. | |
808 | |
809 @kindex C-x RET x | |
810 @kindex C-x RET X | |
811 @findex set-selection-coding-system | |
812 @findex set-next-selection-coding-system | |
813 The command @kbd{C-x @key{RET} x} (@code{set-selection-coding-system}) | |
814 specifies the coding system for sending selected text to the window | |
815 system, and for receiving the text of selections made in other | |
816 applications. This command applies to all subsequent selections, until | |
817 you override it by using the command again. The command @kbd{C-x | |
818 @key{RET} X} (@code{set-next-selection-coding-system}) specifies the | |
819 coding system for the next selection made in Emacs or read by Emacs. | |
820 | |
821 @kindex C-x RET p | |
822 @findex set-buffer-process-coding-system | |
823 The command @kbd{C-x @key{RET} p} (@code{set-buffer-process-coding-system}) | |
824 specifies the coding system for input and output to a subprocess. This | |
825 command applies to the current buffer; normally, each subprocess has its | |
826 own buffer, and thus you can use this command to specify translation to | |
827 and from a particular subprocess by giving the command in the | |
828 corresponding buffer. | |
829 | |
29826
05c0499d035a
(set-buffer-process-coding-system): Documentation fixed.
Kenichi Handa <handa@m17n.org>
parents:
29107
diff
changeset
|
830 The default for translation of process input and output depends on the |
05c0499d035a
(set-buffer-process-coding-system): Documentation fixed.
Kenichi Handa <handa@m17n.org>
parents:
29107
diff
changeset
|
831 current language environment. |
25829 | 832 |
833 @vindex file-name-coding-system | |
834 The variable @code{file-name-coding-system} specifies a coding system | |
835 to use for encoding file names. If you set the variable to a coding | |
836 system name (as a Lisp symbol or a string), Emacs encodes file names | |
837 using that coding system for all file operations. This makes it | |
838 possible to use non-ASCII characters in file names---or, at least, those | |
839 non-ASCII characters which the specified coding system can encode. | |
840 | |
841 If @code{file-name-coding-system} is @code{nil}, Emacs uses a default | |
842 coding system determined by the selected language environment. In the | |
843 default language environment, any non-ASCII characters in file names are | |
844 not encoded specially; they appear in the file system using the internal | |
845 Emacs representation. | |
846 | |
847 @strong{Warning:} if you change @code{file-name-coding-system} (or the | |
848 language environment) in the middle of an Emacs session, problems can | |
849 result if you have already visited files whose names were encoded using | |
850 the earlier coding system and cannot be encoded (or are encoded | |
851 differently) under the new coding system. If you try to save one of | |
852 these buffers under the visited file name, saving may use the wrong file | |
853 name, or it may get an error. If such a problem happens, use @kbd{C-x | |
854 C-w} to specify a new file name for that buffer. | |
855 | |
26140
068f7ad41d40
Describe new functions and variables for locales.
Paul Eggert <eggert@twinsun.com>
parents:
25829
diff
changeset
|
856 @vindex locale-coding-system |
068f7ad41d40
Describe new functions and variables for locales.
Paul Eggert <eggert@twinsun.com>
parents:
25829
diff
changeset
|
857 The variable @code{locale-coding-system} specifies a coding system to |
068f7ad41d40
Describe new functions and variables for locales.
Paul Eggert <eggert@twinsun.com>
parents:
25829
diff
changeset
|
858 use when encoding and decoding system strings such as system error |
068f7ad41d40
Describe new functions and variables for locales.
Paul Eggert <eggert@twinsun.com>
parents:
25829
diff
changeset
|
859 messages and @code{format-time-string} formats and time stamps. This |
068f7ad41d40
Describe new functions and variables for locales.
Paul Eggert <eggert@twinsun.com>
parents:
25829
diff
changeset
|
860 coding system should be compatible with the underlying system's coding |
068f7ad41d40
Describe new functions and variables for locales.
Paul Eggert <eggert@twinsun.com>
parents:
25829
diff
changeset
|
861 system, which is normally specified by the first environment variable in |
068f7ad41d40
Describe new functions and variables for locales.
Paul Eggert <eggert@twinsun.com>
parents:
25829
diff
changeset
|
862 the list @env{LC_ALL}, @env{LC_CTYPE}, @env{LANG} whose value is |
068f7ad41d40
Describe new functions and variables for locales.
Paul Eggert <eggert@twinsun.com>
parents:
25829
diff
changeset
|
863 nonempty. |
068f7ad41d40
Describe new functions and variables for locales.
Paul Eggert <eggert@twinsun.com>
parents:
25829
diff
changeset
|
864 |
25829 | 865 @node Fontsets |
866 @section Fontsets | |
867 @cindex fontsets | |
868 | |
869 A font for X Windows typically defines shapes for one alphabet or | |
870 script. Therefore, displaying the entire range of scripts that Emacs | |
871 supports requires a collection of many fonts. In Emacs, such a | |
872 collection is called a @dfn{fontset}. A fontset is defined by a list of | |
873 fonts, each assigned to handle a range of character codes. | |
874 | |
875 Each fontset has a name, like a font. The available X fonts are | |
876 defined by the X server; fontsets, however, are defined within Emacs | |
877 itself. Once you have defined a fontset, you can use it within Emacs by | |
878 specifying its name, anywhere that you could use a single font. Of | |
879 course, Emacs fontsets can use only the fonts that the X server | |
880 supports; if certain characters appear on the screen as hollow boxes, | |
881 this means that the fontset in use for them has no font for those | |
882 characters. | |
883 | |
884 Emacs creates two fontsets automatically: the @dfn{standard fontset} | |
885 and the @dfn{startup fontset}. The standard fontset is most likely to | |
886 have fonts for a wide variety of non-ASCII characters; however, this is | |
887 not the default for Emacs to use. (By default, Emacs tries to find a | |
888 font which has bold and italic variants.) You can specify use of the | |
889 standard fontset with the @samp{-fn} option, or with the @samp{Font} X | |
890 resource (@pxref{Font X}). For example, | |
891 | |
892 @example | |
893 emacs -fn fontset-standard | |
894 @end example | |
895 | |
896 A fontset does not necessarily specify a font for every character | |
897 code. If a fontset specifies no font for a certain character, or if it | |
898 specifies a font that does not exist on your system, then it cannot | |
899 display that character properly. It will display that character as an | |
900 empty box instead. | |
901 | |
902 @vindex highlight-wrong-size-font | |
903 The fontset height and width are determined by the ASCII characters | |
904 (that is, by the font used for ASCII characters in that fontset). If | |
905 another font in the fontset has a different height, or a different | |
906 width, then characters assigned to that font are clipped to the | |
907 fontset's size. If @code{highlight-wrong-size-font} is non-@code{nil}, | |
908 a box is displayed around these wrong-size characters as well. | |
909 | |
910 @node Defining Fontsets | |
911 @section Defining fontsets | |
912 | |
913 @vindex standard-fontset-spec | |
914 @cindex standard fontset | |
915 Emacs creates a standard fontset automatically according to the value | |
916 of @code{standard-fontset-spec}. This fontset's name is | |
917 | |
918 @example | |
919 -*-fixed-medium-r-normal-*-16-*-*-*-*-*-fontset-standard | |
920 @end example | |
921 | |
922 @noindent | |
923 or just @samp{fontset-standard} for short. | |
924 | |
925 Bold, italic, and bold-italic variants of the standard fontset are | |
926 created automatically. Their names have @samp{bold} instead of | |
927 @samp{medium}, or @samp{i} instead of @samp{r}, or both. | |
928 | |
929 @cindex startup fontset | |
930 If you specify a default ASCII font with the @samp{Font} resource or | |
931 the @samp{-fn} argument, Emacs generates a fontset from it | |
932 automatically. This is the @dfn{startup fontset} and its name is | |
933 @code{fontset-startup}. It does this by replacing the @var{foundry}, | |
934 @var{family}, @var{add_style}, and @var{average_width} fields of the | |
935 font name with @samp{*}, replacing @var{charset_registry} field with | |
936 @samp{fontset}, and replacing @var{charset_encoding} field with | |
937 @samp{startup}, then using the resulting string to specify a fontset. | |
938 | |
939 For instance, if you start Emacs this way, | |
940 | |
941 @example | |
942 emacs -fn "*courier-medium-r-normal--14-140-*-iso8859-1" | |
943 @end example | |
944 | |
945 @noindent | |
946 Emacs generates the following fontset and uses it for the initial X | |
947 window frame: | |
948 | |
949 @example | |
950 -*-*-medium-r-normal-*-14-140-*-*-*-*-fontset-startup | |
951 @end example | |
952 | |
953 With the X resource @samp{Emacs.Font}, you can specify a fontset name | |
954 just like an actual font name. But be careful not to specify a fontset | |
955 name in a wildcard resource like @samp{Emacs*Font}---that wildcard | |
956 specification applies to various other purposes, such as menus, and | |
957 menus cannot handle fontsets. | |
958 | |
959 You can specify additional fontsets using X resources named | |
960 @samp{Fontset-@var{n}}, where @var{n} is an integer starting from 0. | |
961 The resource value should have this form: | |
962 | |
963 @smallexample | |
964 @var{fontpattern}, @r{[}@var{charsetname}:@var{fontname}@r{]@dots{}} | |
965 @end smallexample | |
966 | |
967 @noindent | |
968 @var{fontpattern} should have the form of a standard X font name, except | |
969 for the last two fields. They should have the form | |
970 @samp{fontset-@var{alias}}. | |
971 | |
972 The fontset has two names, one long and one short. The long name is | |
973 @var{fontpattern}. The short name is @samp{fontset-@var{alias}}. You | |
974 can refer to the fontset by either name. | |
975 | |
976 The construct @samp{@var{charset}:@var{font}} specifies which font to | |
977 use (in this fontset) for one particular character set. Here, | |
978 @var{charset} is the name of a character set, and @var{font} is the | |
979 font to use for that character set. You can use this construct any | |
980 number of times in defining one fontset. | |
981 | |
982 For the other character sets, Emacs chooses a font based on | |
983 @var{fontpattern}. It replaces @samp{fontset-@var{alias}} with values | |
984 that describe the character set. For the ASCII character font, | |
985 @samp{fontset-@var{alias}} is replaced with @samp{ISO8859-1}. | |
986 | |
987 In addition, when several consecutive fields are wildcards, Emacs | |
988 collapses them into a single wildcard. This is to prevent use of | |
989 auto-scaled fonts. Fonts made by scaling larger fonts are not usable | |
990 for editing, and scaling a smaller font is not useful because it is | |
991 better to use the smaller font in its own size, which Emacs does. | |
992 | |
993 Thus if @var{fontpattern} is this, | |
994 | |
995 @example | |
996 -*-fixed-medium-r-normal-*-24-*-*-*-*-*-fontset-24 | |
997 @end example | |
998 | |
999 @noindent | |
1000 the font specification for ASCII characters would be this: | |
1001 | |
1002 @example | |
1003 -*-fixed-medium-r-normal-*-24-*-ISO8859-1 | |
1004 @end example | |
1005 | |
1006 @noindent | |
1007 and the font specification for Chinese GB2312 characters would be this: | |
1008 | |
1009 @example | |
1010 -*-fixed-medium-r-normal-*-24-*-gb2312*-* | |
1011 @end example | |
1012 | |
1013 You may not have any Chinese font matching the above font | |
1014 specification. Most X distributions include only Chinese fonts that | |
1015 have @samp{song ti} or @samp{fangsong ti} in @var{family} field. In | |
1016 such a case, @samp{Fontset-@var{n}} can be specified as below: | |
1017 | |
1018 @smallexample | |
1019 Emacs.Fontset-0: -*-fixed-medium-r-normal-*-24-*-*-*-*-*-fontset-24,\ | |
1020 chinese-gb2312:-*-*-medium-r-normal-*-24-*-gb2312*-* | |
1021 @end smallexample | |
1022 | |
1023 @noindent | |
1024 Then, the font specifications for all but Chinese GB2312 characters have | |
1025 @samp{fixed} in the @var{family} field, and the font specification for | |
1026 Chinese GB2312 characters has a wild card @samp{*} in the @var{family} | |
1027 field. | |
1028 | |
1029 @findex create-fontset-from-fontset-spec | |
1030 The function that processes the fontset resource value to create the | |
1031 fontset is called @code{create-fontset-from-fontset-spec}. You can also | |
1032 call this function explicitly to create a fontset. | |
1033 | |
1034 @xref{Font X}, for more information about font naming in X. | |
1035 | |
27211
0699f691fac1
Don't conflate single-byte with European.
Dave Love <fx@gnu.org>
parents:
27156
diff
changeset
|
1036 @node Single-Byte Character Support |
0699f691fac1
Don't conflate single-byte with European.
Dave Love <fx@gnu.org>
parents:
27156
diff
changeset
|
1037 @section Single-byte Character Set Support |
25829 | 1038 |
1039 @cindex European character sets | |
1040 @cindex accented characters | |
1041 @cindex ISO Latin character sets | |
1042 @cindex Unibyte operation | |
1043 @vindex enable-multibyte-characters | |
1044 The ISO 8859 Latin-@var{n} character sets define character codes in | |
1045 the range 160 to 255 to handle the accented letters and punctuation | |
27211
0699f691fac1
Don't conflate single-byte with European.
Dave Love <fx@gnu.org>
parents:
27156
diff
changeset
|
1046 needed by various European languages (and some non-European ones). |
0699f691fac1
Don't conflate single-byte with European.
Dave Love <fx@gnu.org>
parents:
27156
diff
changeset
|
1047 If you disable multibyte |
25829 | 1048 characters, Emacs can still handle @emph{one} of these character codes |
1049 at a time. To specify @emph{which} of these codes to use, invoke | |
1050 @kbd{M-x set-language-environment} and specify a suitable language | |
1051 environment such as @samp{Latin-@var{n}}. | |
1052 | |
1053 For more information about unibyte operation, see @ref{Enabling | |
1054 Multibyte}. Note particularly that you probably want to ensure that | |
1055 your initialization files are read as unibyte if they contain non-ASCII | |
1056 characters. | |
1057 | |
1058 @vindex unibyte-display-via-language-environment | |
1059 Emacs can also display those characters, provided the terminal or font | |
1060 in use supports them. This works automatically. Alternatively, if you | |
1061 are using a window system, Emacs can also display single-byte characters | |
1062 through fontsets, in effect by displaying the equivalent multibyte | |
1063 characters according to the current language environment. To request | |
1064 this, set the variable @code{unibyte-display-via-language-environment} | |
1065 to a non-@code{nil} value. | |
1066 | |
1067 @cindex @code{iso-ascii} library | |
1068 If your terminal does not support display of the Latin-1 character | |
1069 set, Emacs can display these characters as ASCII sequences which at | |
1070 least give you a clear idea of what the characters are. To do this, | |
1071 load the library @code{iso-ascii}. Similar libraries for other | |
1072 Latin-@var{n} character sets could be implemented, but we don't have | |
1073 them yet. | |
1074 | |
1075 @findex standard-display-8bit | |
1076 @cindex 8-bit display | |
1077 Normally non-ISO-8859 characters (between characters 128 and 159 | |
1078 inclusive) are displayed as octal escapes. You can change this for | |
1079 non-standard `extended' versions of ISO-8859 character sets by using the | |
1080 function @code{standard-display-8bit} in the @code{disp-table} library. | |
1081 | |
28552 | 1082 There are several ways you can input single-byte non-ASCII |
25829 | 1083 characters: |
1084 | |
1085 @itemize @bullet | |
27211
0699f691fac1
Don't conflate single-byte with European.
Dave Love <fx@gnu.org>
parents:
27156
diff
changeset
|
1086 @cindex 8-bit input |
25829 | 1087 @item |
1088 If your keyboard can generate character codes 128 and up, representing | |
1089 non-ASCII characters, execute the following expression to enable Emacs to | |
1090 understand them: | |
1091 | |
1092 @example | |
1093 (set-input-mode (car (current-input-mode)) | |
1094 (nth 1 (current-input-mode)) | |
1095 0) | |
1096 @end example | |
1097 | |
27211
0699f691fac1
Don't conflate single-byte with European.
Dave Love <fx@gnu.org>
parents:
27156
diff
changeset
|
1098 It is not necessary to do this under a window system which can |
0699f691fac1
Don't conflate single-byte with European.
Dave Love <fx@gnu.org>
parents:
27156
diff
changeset
|
1099 distinguish 8-bit characters and Meta keys. If you do this on a normal |
0699f691fac1
Don't conflate single-byte with European.
Dave Love <fx@gnu.org>
parents:
27156
diff
changeset
|
1100 terminal, you will probably need to use @kbd{ESC} to type Meta |
0699f691fac1
Don't conflate single-byte with European.
Dave Love <fx@gnu.org>
parents:
27156
diff
changeset
|
1101 characters.@footnote{In some cases, such as the Linux console and |
0699f691fac1
Don't conflate single-byte with European.
Dave Love <fx@gnu.org>
parents:
27156
diff
changeset
|
1102 @code{xterm}, you can arrange for Meta to be converted to @kbd{ESC} and |
0699f691fac1
Don't conflate single-byte with European.
Dave Love <fx@gnu.org>
parents:
27156
diff
changeset
|
1103 still be able type 8-bit characters present directly on the keyboard or |
0699f691fac1
Don't conflate single-byte with European.
Dave Love <fx@gnu.org>
parents:
27156
diff
changeset
|
1104 using @kbd{Compose} or @kbd{AltGr} keys.} @xref{User Input}. |
0699f691fac1
Don't conflate single-byte with European.
Dave Love <fx@gnu.org>
parents:
27156
diff
changeset
|
1105 |
25829 | 1106 @item |
1107 You can use an input method for the selected language environment. | |
1108 @xref{Input Methods}. When you use an input method in a unibyte buffer, | |
1109 the non-ASCII character you specify with it is converted to unibyte. | |
1110 | |
1111 @kindex C-x 8 | |
1112 @cindex @code{iso-transl} library | |
1113 @item | |
1114 For Latin-1 only, you can use the | |
1115 key @kbd{C-x 8} as a ``compose character'' prefix for entry of | |
1116 non-ASCII Latin-1 printing characters. @kbd{C-x 8} is good for | |
1117 insertion (in the minibuffer as well as other buffers), for searching, | |
1118 and in any other context where a key sequence is allowed. | |
1119 | |
1120 @kbd{C-x 8} works by loading the @code{iso-transl} library. Once that | |
1121 library is loaded, the @key{ALT} modifier key, if you have one, serves | |
1122 the same purpose as @kbd{C-x 8}; use @key{ALT} together with an accent | |
1123 character to modify the following letter. In addition, if you have keys | |
1124 for the Latin-1 ``dead accent characters'', they too are defined to | |
1125 compose with the following character, once @code{iso-transl} is loaded. | |
28552 | 1126 Use @kbd{C-x 8 C-h} to list the available translations as mnemonic |
1127 command names. | |
1128 | |
1129 @cindex @code{iso-acc} library | |
1130 @item | |
1131 Also for Latin-1 only, @kbd{M-x iso-aacents-mode} installs a minor mode | |
1132 which provides a facility like the @code{latin-1-prefix} input method | |
1133 but independent of the Leim package. | |
25829 | 1134 @end itemize |