annotate man/xemacs/mule.texi @ 310:851ff35f137f r21-0b53

Import from CVS: tag r21-0b53
author cvs
date Mon, 13 Aug 2007 10:43:28 +0200
parents 41ff10fd062f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
207
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
1 @c This is part of the Emacs manual.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
2 @c Copyright (C) 1997 Free Software Foundation, Inc.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
3 @c See file emacs.texi for copying conditions.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
4 @node Mule, Major Modes, Windows, Top
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
5 @chapter World Scripts Support
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
6 @cindex MULE
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
7 @cindex international scripts
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
8 @cindex multibyte characters
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
9 @cindex encoding of characters
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
10
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
11 @cindex Chinese
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
12 @cindex Greek
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
13 @cindex IPA
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
14 @cindex Japanese
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
15 @cindex Korean
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
16 @cindex Russian
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
17 If you compile XEmacs with mule option, it supports a wide variety of
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents: 207
diff changeset
18 world scripts, including Latin script, as well as Arabic script,
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents: 207
diff changeset
19 Simplified Chinese script (for mainland of China), Traditional Chinese
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents: 207
diff changeset
20 script (for Taiwan and Hong-Kong), Greek script, Hebrew script, IPA
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents: 207
diff changeset
21 symbols, Japanese scripts (Hiragana, Katakana and Kanji), Korean scripts
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents: 207
diff changeset
22 (Hangul and Hanja) and Cyrillic script (for Beylorussian, Bulgarian,
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents: 207
diff changeset
23 Russian, Serbian and Ukrainian). These features have been merged from
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents: 207
diff changeset
24 the modified version of Emacs known as MULE (for ``MULti-lingual
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents: 207
diff changeset
25 Enhancement to GNU Emacs'').
207
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
26
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
27 @menu
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
28 * Mule Intro:: Basic concepts of Mule.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
29 * Language Environments:: Setting things up for the language you use.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
30 * Input Methods:: Entering text characters not on your keyboard.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
31 * Select Input Method:: Specifying your choice of input methods.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
32 * Coding Systems:: Character set conversion when you read and
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
33 write files, and so on.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
34 * Recognize Coding:: How XEmacs figures out which conversion to use.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
35 * Specify Coding:: Various ways to choose which conversion to use.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
36 @end menu
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
37
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
38 @node Mule Intro, Language Environments, Mule, Mule
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
39 @section Introduction to world scripts
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
40
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
41 The users of these scripts have established many more-or-less standard
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
42 coding systems for storing files.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
43 @c XEmacs internally uses a single multibyte character encoding, so that it
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
44 @c can intermix characters from all these scripts in a single buffer or
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
45 @c string. This encoding represents each non-ASCII character as a sequence
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
46 @c of bytes in the range 0200 through 0377.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
47 XEmacs translates between the internal character encoding and various
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
48 other coding systems when reading and writing files, when exchanging
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
49 data with subprocesses, and (in some cases) in the @kbd{C-q} command
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
50 (see below).
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
51
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
52 @kindex C-h h
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
53 @findex view-hello-file
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
54 The command @kbd{C-h h} (@code{view-hello-file}) displays the file
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
55 @file{etc/HELLO}, which shows how to say ``hello'' in many languages.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
56 This illustrates various scripts.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
57
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
58 Keyboards, even in the countries where these character sets are used,
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
59 generally don't have keys for all the characters in them. So XEmacs
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
60 supports various @dfn{input methods}, typically one for each script or
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
61 language, to make it convenient to type them.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
62
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
63 @kindex C-x RET
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
64 The prefix key @kbd{C-x @key{RET}} is used for commands that pertain
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
65 to world scripts, coding systems, and input methods.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
66
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
67
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
68 @node Language Environments, Input Methods, Mule Intro, Mule
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
69 @section Language Environments
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
70 @cindex language environments
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
71
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
72 All supported character sets are supported in XEmacs buffers if it is
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
73 compile with mule; there is no need to select a particular language in
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
74 order to display its characters in an XEmacs buffer. However, it is
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
75 important to select a @dfn{language environment} in order to set various
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
76 defaults. The language environment really represents a choice of
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
77 preferred script (more or less) rather that a choice of language.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
78
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
79 The language environment controls which coding systems to recognize
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
80 when reading text (@pxref{Recognize Coding}). This applies to files,
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
81 incoming mail, netnews, and any other text you read into XEmacs. It may
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
82 also specify the default coding system to use when you create a file.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
83 Each language environment also specifies a default input method.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
84
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
85 @findex set-language-environment
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
86 The command to select a language environment is @kbd{M-x
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
87 set-language-environment}. It makes no difference which buffer is
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
88 current when you use this command, because the effects apply globally to
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
89 the XEmacs session. The supported language environments include:
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
90
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
91 @quotation
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
92 Chinese-BIG5, Chinese-CNS, Chinese-GB, Cyrillic-ISO, English, Ethiopic,
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
93 Greek, Japanese, Korean, Latin-1, Latin-2, Latin-3, Latin-4, Latin-5.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
94 @end quotation
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
95
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
96 Some operating systems let you specify the language you are using by
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
97 setting locale environment variables. XEmacs handles one common special
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
98 case of this: if your locale name for character types contains the
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
99 string @samp{8859-@var{n}}, XEmacs automatically selects the
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
100 corresponding language environment.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
101
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
102 @kindex C-h L
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
103 @findex describe-language-environment
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
104 To display information about the effects of a certain language
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
105 environment @var{lang-env}, use the command @kbd{C-h L @var{lang-env}
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
106 @key{RET}} (@code{describe-language-environment}). This tells you which
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
107 languages this language environment is useful for, and lists the
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
108 character sets, coding systems, and input methods that go with it. It
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
109 also shows some sample text to illustrate scripts used in this language
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
110 environment. By default, this command describes the chosen language
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
111 environment.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
112
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
113 @node Input Methods, Select Input Method, Language Environments, Mule
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
114 @section Input Methods
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
115
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
116 @cindex input methods
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
117 An @dfn{input method} is a kind of character conversion designed
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
118 specifically for interactive input. In XEmacs, typically each language
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
119 has its own input method; sometimes several languages which use the same
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
120 characters can share one input method. A few languages support several
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
121 input methods.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
122
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
123 The simplest kind of input method works by mapping ASCII letters into
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
124 another alphabet. This is how the Greek and Russian input methods work.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
125
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
126 A more powerful technique is composition: converting sequences of
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
127 characters into one letter. Many European input methods use composition
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
128 to produce a single non-ASCII letter from a sequence that consists of a
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
129 letter followed by accent characters. For example, some methods convert
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
130 the sequence @kbd{'a} into a single accented letter.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
131
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
132 The input methods for syllabic scripts typically use mapping followed
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
133 by composition. The input methods for Thai and Korean work this way.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
134 First, letters are mapped into symbols for particular sounds or tone
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
135 marks; then, sequences of these which make up a whole syllable are
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
136 mapped into one syllable sign.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
137
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
138 Chinese and Japanese require more complex methods. In Chinese input
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
139 methods, first you enter the phonetic spelling of a Chinese word (in
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
140 input method @code{chinese-py}, among others), or a sequence of portions
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
141 of the character (input methods @code{chinese-4corner} and
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
142 @code{chinese-sw}, and others). Since one phonetic spelling typically
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
143 corresponds to many different Chinese characters, you must select one of
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
144 the alternatives using special XEmacs commands. Keys such as @kbd{C-f},
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
145 @kbd{C-b}, @kbd{C-n}, @kbd{C-p}, and digits have special definitions in
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
146 this situation, used for selecting among the alternatives. @key{TAB}
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
147 displays a buffer showing all the possibilities.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
148
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
149 In Japanese input methods, first you input a whole word using
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
150 phonetic spelling; then, after the word is in the buffer, XEmacs
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
151 converts it into one or more characters using a large dictionary. One
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
152 phonetic spelling corresponds to many differently written Japanese
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
153 words, so you must select one of them; use @kbd{C-n} and @kbd{C-p} to
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
154 cycle through the alternatives.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
155
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
156 Sometimes it is useful to cut off input method processing so that the
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
157 characters you have just entered will not combine with subsequent
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
158 characters. For example, in input method @code{latin-1-postfix}, the
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
159 sequence @kbd{e '} combines to form an @samp{e} with an accent. What if
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
160 you want to enter them as separate characters?
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
161
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
162 One way is to type the accent twice; that is a special feature for
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
163 entering the separate letter and accent. For example, @kbd{e ' '} gives
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
164 you the two characters @samp{e'}. Another way is to type another letter
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
165 after the @kbd{e}---something that won't combine with that---and
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
166 immediately delete it. For example, you could type @kbd{e e @key{DEL}
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
167 '} to get separate @samp{e} and @samp{'}.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
168
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
169 Another method, more general but not quite as easy to type, is to use
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
170 @kbd{C-\ C-\} between two characters to stop them from combining. This
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
171 is the command @kbd{C-\} (@code{toggle-input-method}) used twice.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
172 @ifinfo
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
173 @xref{Select Input Method}.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
174 @end ifinfo
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
175
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
176 @kbd{C-\ C-\} is especially useful inside an incremental search,
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
177 because stops waiting for more characters to combine, and starts
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
178 searching for what you have already entered.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
179
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
180 @vindex input-method-verbose-flag
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
181 @vindex input-method-highlight-flag
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
182 The variables @code{input-method-highlight-flag} and
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
183 @code{input-method-verbose-flag} control how input methods explain what
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
184 is happening. If @code{input-method-highlight-flag} is non-@code{nil},
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
185 the partial sequence is highlighted in the buffer. If
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
186 @code{input-method-verbose-flag} is non-@code{nil}, the list of possible
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
187 characters to type next is displayed in the echo area (but not when you
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
188 are in the minibuffer).
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
189
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
190 @node Select Input Method, Coding Systems, Input Methods, Mule
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
191 @section Selecting an Input Method
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
192
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
193 @table @kbd
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
194 @item C-\
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
195 Enable or disable use of the selected input method.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
196
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
197 @item C-x @key{RET} C-\ @var{method} @key{RET}
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
198 Select a new input method for the current buffer.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
199
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
200 @item C-h I @var{method} @key{RET}
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
201 @itemx C-h C-\ @var{method} @key{RET}
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
202 @findex describe-input-method
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
203 @kindex C-h I
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
204 @kindex C-h C-\
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
205 Describe the input method @var{method} (@code{describe-input-method}).
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
206 By default, it describes the current input method (if any).
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
207
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
208 @item M-x list-input-methods
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
209 Display a list of all the supported input methods.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
210 @end table
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
211
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
212 @findex select-input-method
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
213 @vindex current-input-method
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
214 @kindex C-x RET C-\
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
215 To choose an input method for the current buffer, use @kbd{C-x
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
216 @key{RET} C-\} (@code{select-input-method}). This command reads the
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
217 input method name with the minibuffer; the name normally starts with the
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
218 language environment that it is meant to be used with. The variable
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
219 @code{current-input-method} records which input method is selected.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
220
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
221 @findex toggle-input-method
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
222 @kindex C-\
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
223 Input methods use various sequences of ASCII characters to stand for
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
224 non-ASCII characters. Sometimes it is useful to turn off the input
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
225 method temporarily. To do this, type @kbd{C-\}
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
226 (@code{toggle-input-method}). To reenable the input method, type
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
227 @kbd{C-\} again.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
228
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
229 If you type @kbd{C-\} and you have not yet selected an input method,
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
230 it prompts for you to specify one. This has the same effect as using
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
231 @kbd{C-x @key{RET} C-\} to specify an input method.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
232
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
233 @vindex default-input-method
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
234 Selecting a language environment specifies a default input method for
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
235 use in various buffers. When you have a default input method, you can
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
236 select it in the current buffer by typing @kbd{C-\}. The variable
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
237 @code{default-input-method} specifies the default input method
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
238 (@code{nil} means there is none).
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
239
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
240 @findex quail-set-keyboard-layout
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
241 Some input methods for alphabetic scripts work by (in effect)
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
242 remapping the keyboard to emulate various keyboard layouts commonly used
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
243 for those scripts. How to do this remapping properly depends on your
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
244 actual keyboard layout. To specify which layout your keyboard has, use
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
245 the command @kbd{M-x quail-set-keyboard-layout}.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
246
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
247 @findex list-input-methods
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
248 To display a list of all the supported input methods, type @kbd{M-x
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
249 list-input-methods}. The list gives information about each input
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
250 method, including the string that stands for it in the mode line.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
251
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
252 @node Coding Systems, Recognize Coding, Select Input Method, Mule
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
253 @section Coding Systems
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
254 @cindex coding systems
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
255
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
256 Users of various languages have established many more-or-less standard
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
257 coding systems for representing them. XEmacs does not use these coding
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
258 systems internally; instead, it converts from various coding systems to
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
259 its own system when reading data, and converts the internal coding
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
260 system to other coding systems when writing data. Conversion is
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
261 possible in reading or writing files, in sending or receiving from the
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
262 terminal, and in exchanging data with subprocesses.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
263
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
264 XEmacs assigns a name to each coding system. Most coding systems are
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
265 used for one language, and the name of the coding system starts with the
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
266 language name. Some coding systems are used for several languages;
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
267 their names usually start with @samp{iso}. There are also special
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
268 coding systems @code{binary} and @code{no-conversion} which do not
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
269 convert printing characters at all.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
270
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
271 In addition to converting various representations of non-ASCII
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
272 characters, a coding system can perform end-of-line conversion. XEmacs
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
273 handles three different conventions for how to separate lines in a file:
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
274 newline, carriage-return linefeed, and just carriage-return.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
275
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
276 @table @kbd
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
277 @item C-h C @var{coding} @key{RET}
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
278 Describe coding system @var{coding}.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
279
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
280 @item C-h C @key{RET}
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
281 Describe the coding systems currently in use.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
282
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
283 @item M-x list-coding-systems
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
284 Display a list of all the supported coding systems.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
285 @end table
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
286
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
287 @kindex C-h C
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
288 @findex describe-coding-system
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
289 The command @kbd{C-h C} (@code{describe-coding-system}) displays
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
290 information about particular coding systems. You can specify a coding
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
291 system name as argument; alternatively, with an empty argument, it
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
292 describes the coding systems currently selected for various purposes,
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
293 both in the current buffer and as the defaults, and the priority list
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
294 for recognizing coding systems (@pxref{Recognize Coding}).
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
295
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
296 @findex list-coding-systems
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
297 To display a list of all the supported coding systems, type @kbd{M-x
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
298 list-coding-systems}. The list gives information about each coding
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
299 system, including the letter that stands for it in the mode line
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
300 (@pxref{Mode Line}).
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
301
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
302 Each of the coding systems that appear in this list---except for
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
303 @code{binary}, which means no conversion of any kind---specifies how and
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
304 whether to convert printing characters, but leaves the choice of
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
305 end-of-line conversion to be decided based on the contents of each file.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
306 For example, if the file appears to use carriage-return linefeed between
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
307 lines, that end-of-line conversion will be used.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
308
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
309 Each of the listed coding systems has three variants which specify
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
310 exactly what to do for end-of-line conversion:
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
311
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
312 @table @code
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
313 @item @dots{}-unix
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
314 Don't do any end-of-line conversion; assume the file uses
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
315 newline to separate lines. (This is the convention normally used
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
316 on Unix and GNU systems.)
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
317
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
318 @item @dots{}-dos
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
319 Assume the file uses carriage-return linefeed to separate lines,
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
320 and do the appropriate conversion. (This is the convention normally used
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
321 on Microsoft systems.)
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
322
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
323 @item @dots{}-mac
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
324 Assume the file uses carriage-return to separate lines, and do the
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
325 appropriate conversion. (This is the convention normally used on the
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
326 Macintosh system.)
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
327 @end table
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
328
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
329 These variant coding systems are omitted from the
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
330 @code{list-coding-systems} display for brevity, since they are entirely
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
331 predictable. For example, the coding system @code{iso-8859-1} has
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
332 variants @code{iso-8859-1-unix}, @code{iso-8859-1-dos} and
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
333 @code{iso-8859-1-mac}.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
334
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
335 In contrast, the coding system @code{binary} specifies no character
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
336 code conversion at all---none for non-Latin-1 byte values and none for
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
337 end of line. This is useful for reading or writing binary files, tar
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
338 files, and other files that must be examined verbatim.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
339
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
340 The easiest way to edit a file with no conversion of any kind is with
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
341 the @kbd{M-x find-file-literally} command. This uses @code{binary}, and
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
342 also suppresses other XEmacs features that might convert the file
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
343 contents before you see them. @xref{Visiting}.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
344
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
345 The coding system @code{no-conversion} means that the file contains
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
346 non-Latin-1 characters stored with the internal XEmacs encoding. It
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
347 handles end-of-line conversion based on the data encountered, and has
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
348 the usual three variants to specify the kind of end-of-line conversion.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
349
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
350
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
351 @node Recognize Coding, Specify Coding, Coding Systems, Mule
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
352 @section Recognizing Coding Systems
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
353
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
354 Most of the time, XEmacs can recognize which coding system to use for
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
355 any given file--once you have specified your preferences.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
356
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
357 Some coding systems can be recognized or distinguished by which byte
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
358 sequences appear in the data. However, there are coding systems that
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
359 cannot be distinguished, not even potentially. For example, there is no
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
360 way to distinguish between Latin-1 and Latin-2; they use the same byte
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
361 values with different meanings.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
362
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
363 XEmacs handles this situation by means of a priority list of coding
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
364 systems. Whenever XEmacs reads a file, if you do not specify the coding
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
365 system to use, XEmacs checks the data against each coding system,
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
366 starting with the first in priority and working down the list, until it
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
367 finds a coding system that fits the data. Then it converts the file
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
368 contents assuming that they are represented in this coding system.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
369
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
370 The priority list of coding systems depends on the selected language
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
371 environment (@pxref{Language Environments}). For example, if you use
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
372 French, you probably want XEmacs to prefer Latin-1 to Latin-2; if you
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
373 use Czech, you probably want Latin-2 to be preferred. This is one of
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
374 the reasons to specify a language environment.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
375
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
376 @findex prefer-coding-system
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
377 However, you can alter the priority list in detail with the command
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
378 @kbd{M-x prefer-coding-system}. This command reads the name of a coding
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
379 system from the minibuffer, and adds it to the front of the priority
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
380 list, so that it is preferred to all others. If you use this command
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
381 several times, each use adds one element to the front of the priority
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
382 list.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
383
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
384 @vindex file-coding-system-alist
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
385 Sometimes a file name indicates which coding system to use for the
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
386 file. The variable @code{file-coding-system-alist} specifies this
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
387 correspondence. There is a special function
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
388 @code{modify-coding-system-alist} for adding elements to this list. For
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
389 example, to read and write all @samp{.txt} using the coding system
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
390 @code{china-iso-8bit}, you can execute this Lisp expression:
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
391
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
392 @smallexample
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
393 (modify-coding-system-alist 'file "\\.txt\\'" 'china-iso-8bit)
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
394 @end smallexample
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
395
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
396 @noindent
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
397 The first argument should be @code{file}, the second argument should be
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
398 a regular expression that determines which files this applies to, and
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
399 the third argument says which coding system to use for these files.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
400
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
401 @vindex coding
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
402 You can specify the coding system for a particular file using the
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
403 @samp{-*-@dots{}-*-} construct at the beginning of a file, or a local
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
404 variables list at the end (@pxref{File Variables}). You do this by
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
405 defining a value for the ``variable'' named @code{coding}. XEmacs does
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
406 not really have a variable @code{coding}; instead of setting a variable,
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
407 it uses the specified coding system for the file. For example,
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
408 @samp{-*-mode: C; coding: iso-8859-1;-*-} specifies use of the
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
409 iso-8859-1 coding system, as well as C mode.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
410
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
411 @vindex buffer-file-coding-system
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
412 Once XEmacs has chosen a coding system for a buffer, it stores that
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
413 coding system in @code{buffer-file-coding-system} and uses that coding
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
414 system, by default, for operations that write from this buffer into a
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
415 file. This includes the commands @code{save-buffer} and
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
416 @code{write-region}. If you want to write files from this buffer using
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
417 a different coding system, you can specify a different coding system for
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
418 the buffer using @code{set-buffer-file-coding-system} (@pxref{Specify
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
419 Coding}).
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
420
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
421
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
422 @node Specify Coding, , Recognize Coding, Mule
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
423 @section Specifying a Coding System
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
424
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
425 In cases where XEmacs does not automatically choose the right coding
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
426 system, you can use these commands to specify one:
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
427
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
428 @table @kbd
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
429 @item C-x @key{RET} f @var{coding} @key{RET}
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
430 Use coding system @var{coding} for the visited file
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
431 in the current buffer.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
432
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents: 207
diff changeset
433 @item C-x @key{RET} c @var{coding} @key{RET}
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents: 207
diff changeset
434 Specify coding system @var{coding} for the immediately following
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents: 207
diff changeset
435 command.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents: 207
diff changeset
436
207
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
437 @item C-x @key{RET} k @var{coding} @key{RET}
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
438 Use coding system @var{coding} for keyboard input.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
439
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
440 @item C-x @key{RET} t @var{coding} @key{RET}
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
441 Use coding system @var{coding} for terminal output.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
442
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
443 @item C-x @key{RET} p @var{coding} @key{RET}
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
444 Use coding system @var{coding} for subprocess input and output
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
445 in the current buffer.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
446 @end table
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
447
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
448 @kindex C-x RET f
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
449 @findex set-buffer-file-coding-system
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
450 The command @kbd{C-x RET f} (@code{set-buffer-file-coding-system})
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
451 specifies the file coding system for the current buffer---in other
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
452 words, which coding system to use when saving or rereading the visited
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
453 file. You specify which coding system using the minibuffer. Since this
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
454 command applies to a file you have already visited, it affects only the
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
455 way the file is saved.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
456
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents: 207
diff changeset
457 @kindex C-x RET c
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents: 207
diff changeset
458 @findex universal-coding-system-argument
207
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
459 Another way to specify the coding system for a file is when you visit
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents: 207
diff changeset
460 the file. First use the command @kbd{C-x @key{RET} c}
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents: 207
diff changeset
461 (@code{universal-coding-system-argument}); this command uses the
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents: 207
diff changeset
462 minibuffer to read a coding system name. After you exit the minibuffer,
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents: 207
diff changeset
463 the specified coding system is used for @emph{the immediately following
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents: 207
diff changeset
464 command}.
207
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
465
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
466 So if the immediately following command is @kbd{C-x C-f}, for example,
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
467 it reads the file using that coding system (and records the coding
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents: 207
diff changeset
468 system for when the file is saved). Or if the immediately following
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents: 207
diff changeset
469 command is @kbd{C-x C-w}, it writes the file using that coding system.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents: 207
diff changeset
470 Other file commands affected by a specified coding system include
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents: 207
diff changeset
471 @kbd{C-x C-i} and @kbd{C-x C-v}, as well as the other-window variants of
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents: 207
diff changeset
472 @kbd{C-x C-f}.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents: 207
diff changeset
473
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents: 207
diff changeset
474 In addition, if you run some file input commands with the precedent
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents: 207
diff changeset
475 @kbd{C-u}, you can specify coding system to read from minibuffer. So if
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents: 207
diff changeset
476 the immediately following command is @kbd{C-x C-f}, for example, it
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents: 207
diff changeset
477 reads the file using that coding system (and records the coding system
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents: 207
diff changeset
478 for when the file is saved). Other file commands affected by a
207
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
479 specified coding system include @kbd{C-x C-i} and @kbd{C-x C-v}, as well
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
480 as the other-window variants of @kbd{C-x C-f}.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
481
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
482 @vindex default-buffer-file-coding-system
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
483 The variable @code{default-buffer-file-coding-system} specifies the
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
484 choice of coding system to use when you create a new file. It applies
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
485 when you find a new file, and when you create a buffer and then save it
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
486 in a file. Selecting a language environment typically sets this
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
487 variable to a good choice of default coding system for that language
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
488 environment.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
489
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
490 @kindex C-x RET t
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
491 @findex set-terminal-coding-system
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
492 The command @kbd{C-x @key{RET} t} (@code{set-terminal-coding-system})
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
493 specifies the coding system for terminal output. If you specify a
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
494 character code for terminal output, all characters output to the
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
495 terminal are translated into that coding system.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
496
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
497 This feature is useful for certain character-only terminals built to
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
498 support specific languages or character sets---for example, European
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
499 terminals that support one of the ISO Latin character sets.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
500
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
501 By default, output to the terminal is not translated at all.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
502
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
503 @kindex C-x RET k
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
504 @findex set-keyboard-coding-system
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
505 The command @kbd{C-x @key{RET} k} (@code{set-keyboard-coding-system})
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
506 specifies the coding system for keyboard input. Character-code
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
507 translation of keyboard input is useful for terminals with keys that
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
508 send non-ASCII graphic characters---for example, some terminals designed
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
509 for ISO Latin-1 or subsets of it.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
510
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
511 By default, keyboard input is not translated at all.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
512
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
513 There is a similarity between using a coding system translation for
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
514 keyboard input, and using an input method: both define sequences of
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
515 keyboard input that translate into single characters. However, input
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
516 methods are designed to be convenient for interactive use by humans, and
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
517 the sequences that are translated are typically sequences of ASCII
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
518 printing characters. Coding systems typically translate sequences of
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
519 non-graphic characters.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
520
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
521 @kindex C-x RET p
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
522 @findex set-buffer-process-coding-system
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
523 The command @kbd{C-x @key{RET} p} (@code{set-buffer-process-coding-system})
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
524 specifies the coding system for input and output to a subprocess. This
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
525 command applies to the current buffer; normally, each subprocess has its
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
526 own buffer, and thus you can use this command to specify translation to
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
527 and from a particular subprocess by giving the command in the
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
528 corresponding buffer.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
529
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
530 By default, process input and output are not translated at all.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
531
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
532 @vindex file-name-coding-system
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
533 The variable @code{file-name-coding-system} specifies a coding system
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
534 to use for encoding file names. If you set the variable to a coding
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
535 system name (as a Lisp symbol or a string), XEmacs encodes file names
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
536 using that coding system for all file operations. This makes it
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
537 possible to use non-Latin-1 characters in file names---or, at least,
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
538 those non-Latin-1 characters which the specified coding system can
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
539 encode. By default, this variable is @code{nil}, which implies that you
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents:
diff changeset
540 cannot use non-Latin-1 characters in file names.