* lisp/progmodes/compile.el (compilation-parse-errors): Fix typo.
[emacs.git] / lisp / term / internal.el
blob43973604afc562de1cfe936fd71bf198184544c2
1 ;;; internal.el --- support for PC internal terminal
3 ;; Copyright (C) 1993-1994, 1998-1999, 2001-2013 Free Software
4 ;; Foundation, Inc.
6 ;; Author: Morten Welinder <terra@diku.dk>
8 ;; This file is part of GNU Emacs.
10 ;; GNU Emacs is free software: you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation, either version 3 of the License, or
13 ;; (at your option) any later version.
15 ;; GNU Emacs is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
23 ;;; Commentary:
25 ;;; Code:
27 ;; ---------------------------------------------------------------------------
28 (defvar msdos-key-remapping-map
29 (let ((map (make-sparse-keymap)))
30 ;; keyboard setup -- that's simple!
31 (define-key map [M-backspace] [?\M-\d])
32 (define-key map [M-delete] [?\M-d])
33 (define-key map [M-tab] [?\M-\t])
34 (define-key map [M-linefeed] [?\M-\n])
35 (define-key map [M-clear] [?\M-\013])
36 (define-key map [M-return] [?\M-\015])
37 (define-key map [M-escape] [?\M-\e])
38 map)
39 "Keymap for remapping special keys on MS-DOS keyboard.")
41 (defun msdos-setup-keyboard (frame)
42 "Setup `local-function-key-map' for MS-DOS keyboard."
43 ;; Don't do this twice on the same display, or it would break
44 ;; normal-erase-is-backspace-mode.
45 (unless (terminal-parameter frame 'msdos-setup-keyboard)
46 ;; Map certain keypad keys into ASCII characters that people usually expect.
47 (with-selected-frame frame
48 (let ((map (copy-keymap msdos-key-remapping-map)))
49 (set-keymap-parent map (keymap-parent local-function-key-map))
50 (set-keymap-parent local-function-key-map map)))
51 (set-terminal-parameter frame 'msdos-setup-keyboard t))
52 (set-input-mode nil nil 0))
54 ;; ----------------------------------------------------------------------
55 ;; DOS display setup
56 ;; =================
58 ;; DOS can only support a single font. On most systems (with the
59 ;; possible exception of Far Eastern DOS versions), this means that
60 ;; two character sets are available at any given time: the ASCII
61 ;; charset, and a single national charset, usually mapped to codes
62 ;; above 128 (i.e., with 8th bit set). Which national charset is
63 ;; supported depends on the codepage loaded by the system when it
64 ;; boots; usually, this codepage cannot be changed without
65 ;; rebooting.
67 ;; Since each codepage can usually display character of a single
68 ;; MULE charset, Emacs can display a single MULE charset with the
69 ;; glyphs of the current codepage. When Emacs starts on DOS, it
70 ;; automatically sets its default coding systems for file I/O and
71 ;; terminal output according to the current DOS codepage, given by
72 ;; the `dos-codepage' variable.
74 ;; This leaves us with the problem of displaying character sets
75 ;; other than the one which maps directly into the current codepage.
76 ;; The following functions and variables handle this nuisance by
77 ;; defining a display table where each character that doesn't have a
78 ;; glyph in some codepage is mapped to a string which represents it.
79 ;; For example, a small c with cedilla is mapped to the string
80 ;; ",c". A nice feature of the display tables is that Emacs
81 ;; knows that the string represents a single character, and thus
82 ;; cursor motion works as you'd expect: a single `C-f' moves past
83 ;; the entire string which represents a single character.
84 ;; ----------------------------------------------------------------------
86 (defvar IT-unicode-translations
88 (160 563 ; first, last
89 [ 255 "!I" "|c" "Pd" "$$" "Ye" "|" "SE" "\"" "(c)" ; Latin-1
90 "_a" "<<" "~" "--" "(R)" "'-" "^o" "+-" "^2" "^3"
91 "'" "u" ".P" "^." "'," "^1" "_o" ">>" "1/4" "1/2"
92 "3/4" "?I" "`A" "A'" "A^" "~A" "\"A" "Ao" "AE" ",C"
93 "`E" "E'" "E^" "\"E" "`I" "I'" "I^" "\"I" "-D" "~N"
94 "`O" "O'" "O^" "~O" "\"O" "*x" "/O" "`U" "U'" "U^"
95 "\"U" "Y'" "-P" "ss" "`a" "a'" "a^" "~a" "\"a" "ao"
96 "ae" ",c" "`e" "e'" "e^" "\"e" "`i" "i'" "i^" "\"i"
97 "-d" "~n" "`o" "o'" "o^" "~o" "\"o" "-:" "/o" "`u"
98 "u'" "u^" "\"u" "y'" "-p" "\"y" ; 255
99 "A-" "a-" "A(" "a(" "A;" "a;" "C'" "c'" "C>" "c>" ; Latin Extended-A
100 "C." "c." "C<" "c<" "D<" "d<" "D/" "d/" "E-" "e-"
101 "E(" "e(" "E." "e." "E;" "e;" "E<" "e<" "G>" "g>"
102 "G(" "g(" "G." "g." "G," "g," "H>" "h>" "H/" "h/"
103 "I~" "i~" "I-" "i-" "I(" "i(" "I;" "i;" "I." "i."
104 "IJ" "ij" "J>" "j>" "K," "k," "kk" "L'" "l'" "L,"
105 "l," "L<" "l<" "L." "l." "L/" "l/" "N'" "n'" "N,"
106 "n," "N<" "n<" "'n" "NG" "ng" "O-" "o-" "O(" "o("
107 "O\"" "o\"" "OE" "oe" "R'" "r'" "R," "r," "R<" "r<"
108 "S'" "s'" "S>" "s>" "S," "s," "S<" "s<" "T," "t,"
109 "T<" "t<" "T/" "t/" "U~" "u~" "U-" "u-" "U(" "u("
110 "U0" "u0" "U\"" "u\"" "U;" "u;" "W>" "w>" "Y>" "y>"
111 "Y:" "Z'" "z'" "Z." "z." "Z<" "z<" "s1" ; 017f
112 "b/" "B2" "=B" "=b" "B6" "b6" "!C" "C2" "c2" "-D" ;Lat. Extended-B
113 "D2" "=D" "=d" "!d" "!E" "-E" "Eps" "F2" "f2" "G2"
114 "V0" "hv" "io" "-I" "K2" "k2" "-l" "la-" "!M" "2N"
115 "n_" "-O" "O9" "o9" "OI" "oi" "P2" "p2" "'R" "!S"
116 "!s" "Esh" "!esh" "t~" "T2" "t2" "T~" "U9" "u9" "Ups"
117 "V2" "Y2" "y2" "Z/" "z/" "ED" "!ED" "!ed" "ed;" "2/"
118 "5-" "_5-" "ts" "wn" "|_" "||" "|=" "!_" "DZ<" "Dz<"
119 "dz<" "LJ3" "Lj3" "lj3" "NJ3" "Nj3" "nj3" "A<" "a<" "I<"
120 "i<" "O<" "o<" "U<" "u<" "U:-" "u:-" "U:'" "u:'" "U:<"
121 "u:<" "U:!" "u:!" "e1" "A:-" "a:-" "A.-" "a.-" "AE-" "ae-"
122 "G/" "g/" "G<" "g<" "K<" "k<" "O;" "o;" "O1" "o1"
123 "EZ" "ez" "j<" "DZ3" "Dz3" "dz3" "G'" "g'" "Hv" "Wn"
124 "N`" "n`" "AA'" "aa'" "AE'" "ae'" "O/'" "o/'" "A!!" "a!!"
125 "A)" "a)" "E!!" "e!!" "E)" "e)" "I!!" "i!!" "I)" "i)"
126 "O!!" "o!!" "O)" "o)" "R!!" "r!!" "R)" "r)" "U!!" "u!!"
127 "U)" "u)" ",S" ",s" ",T" ",t" "'3" "'3_" "H<" "h<"
128 nil nil "8" "8_" "Z2" "z2" "A." "a." "E," "e,"
129 "O:-" "o:-" "O~-" "o~-" "O." "o." "O.-" "o.-" "Y-" "y-"] ; 0x233
133 (884 1123 ; first, last
134 [ "'" "," nil nil nil nil "j3" nil nil nil ; Greek
135 "?;" nil nil nil nil nil "'*" "'%" "A%" ".*"
136 "E%" "Y%" "I%" nil "O%" nil "U%" "W%" "i3" "A*"
137 "B*" "G*" "D*" "E*" "Z*" "H*" "Th*" "I*" "K*" "L*"
138 "M*" "N*" "C*" "O*" "P*" "R*" nil "S*" "T*" "U*"
139 "F*" "X*" "Q*" "W*" "J*" "V*" "a%" "e%" "y%" "i%"
140 "u3" "a*" "b*" "g*" "d*" "e*" "z*" "h*" "th*" "i*"
141 "k*" "l*" "m*" "n*" "c*" "o*" "p*" "r*" "*s" "s*"
142 "t*" "u*" "f*" "x*" "q*" "w*" "j*" "v*" "o%" "u%"
143 "w%" nil "b3" "th%" "U2*" "'U2*" "U:2*" "ph*" "pi*" "ka*"
144 nil nil "Sti" "sti" "Dig" "dig" "Kop" "kop" "Sam" "sam"
145 "She" "she" "Fei" "fei" "Khe" "khe" "Hor" "hor" "Gan" "gan"
146 "Shi" "shi" "Dei" "dei" "ka*" "rh*" "ls*" "yo*" nil nil
147 nil nil nil nil nil nil nil nil nil nil
148 "IE'" "E:" "D%" "G%" "IE" "DS" "II" "YI" "J%" "LJ" ; Cyrillic
149 "NJ" "Ts" "KJ" "`I=" "V%" "DZ" 65 "B=" 66 "G="
150 68 69 "Z%" 51 85 "J=" 75 "L=" 77 72
151 79 "P=" 80 67 84 89 "F=" 88 "C=" "C%"
152 "S%" "Sc" "=\"" "Y=" "%\"" "Ee" "JU" "JA" 97 "b="
153 98 "g=" 103 101 "z%" "z=" 117 "j=" 107 "l="
154 109 "n=" 111 "p=" 112 99 "t=" 121 "f=" 120
155 "c=" "c%" "s%" "sc" "='" "y=" "%'" "ee" "ju" "ja"
156 "ie'" "e:" "d%" "g%" "ie" "ds" "ii" "yi" "j%" "lj"
157 "nj" "ts" "kj" "v%" "`i=" "dz" "OM=" "om=" "Y3" "y3"] ; 0x463
160 (1454 1645 ; first, last
161 [ nil nil ":'" "v:" "-:" "-':" ".'" ".." "v'" "-'"
162 "-," "`." nil "\\." "(.)" "|'" "`-" nil "||" nil
163 nil "::" nil nil nil nil nil nil nil nil
164 nil nil nil nil
165 "A+" "B+" "G+" "D+" "H+" "W+" "Z+" "X+" "Tj" "J+" ; Hebrew
166 "K%" "K+" "L+" "M%" "M+" "N%" "N+" "S+" "E+" "P%"
167 "P+" "Zj" "ZJ" "Q+" "R+" "Sh" "T+" nil nil nil
168 nil nil "WW+" "WJ+" "JJ+" "'+" "\"+" nil nil nil
169 nil nil nil nil nil nil nil nil nil nil
170 nil nil nil nil nil nil nil nil nil nil
171 ",+" nil nil nil nil nil nil nil nil nil ; Arabic
172 nil nil nil nil nil ";+" nil nil nil "?+"
173 nil "H'" "aM" "aH" "wH" "ah" "yH" "a+" "b+" "tm"
174 "t+" "tk" "g+" "hk" "x+" "d+" "dk" "r+" "z+" "s+"
175 "sn" "c+" "dd" "tj" "zH" "e+" "i+" nil nil nil
176 nil nil "++" "f+" "q+" "k+" "l+" "m+" "n+" "h+"
177 "w+" "j+" "y+" ":+" "\"+" "=+" "/+" "'+" "1+" "3+"
178 "0+" nil nil nil nil nil nil nil nil nil
179 nil nil nil nil "0a" "1a" "2a" "3a" "4a" "5a"
180 "6a" "7a" "8a" "9a" "a%" "a." "a," "a*" ]
183 (7680 9450 ; first, last
184 [ "A-0" "a-0" "B." "b." "B-." "b-." "B_" "b_" "C,'" "c,'" ; Lat Ext Add
185 "D." "d." "D-." "d-." "D_" "d_" "D," "d," "D->" "d->"
186 "E-!" "e-!" "E-'" "e-'" "E->" "e->" "E-?" "e-?" "E,(" "e,("
187 "F." "f." "G-" "g-" "H." "h." "H-." "h-." "H:" "h:"
188 "H," "h," "H-(" "h-(" "I-?" "i-?" "I:'" "i:'" "K'" "k'"
189 "K-." "k-." "K_" "k_" "L-." "l-." "_L-." "_l-." "L_" "l_"
190 "L->" "l->" "M'" "m'" "M." "m." "M-." "m-." "N." "n."
191 "N-." "n-." "N_" "n_" "N->" "n->" "O?'" "o?'" "O?:" "o?:"
192 "O-!" "o-!" "O-'" "o-'" "P'" "p'" "P." "p." "R." "r."
193 "R-." "r-." "_R-." "_r-." "R_" "r_" "S." "s." "S-." "s-."
194 "S'." "s'." "S<." "s<." ".S-." ".s-." "T." "t." "T-." "t-."
195 "T_" "t_" "T->" "t->" "U_:" "u_:" "U-?" "u-?" "U->" "u->"
196 "U?'" "u?'" "U-:" "u-:" "V?" "v?" "V-." "v-." "W!" "w!"
197 "W'" "w'" "W:" "w:" "W." "w." "W-." "w-." "X." "x."
198 "X:" "x:" "Y." "y." "Z>" "z>" "Z-." "z-." "Z_" "z_"
199 "h_" "t:" "w0" "y0" "a))" "s1." nil nil nil nil
200 "A-." "a-." "A2" "a2" "A>'" "a>'" "A>!" "a>!" "A>2" "a>2"
201 "A>~" "a>~" ".A>" ".a>" "A('" "a('" "A(!" "a(!" "A(2" "a(2"
202 "A(~" "a(~" ".A(" ".a(" "E-." "e-." "E2" "e2" "E~" "e~"
203 "E>'" "e>'" "E>!" "e>!" "E>2" "e>2" "E>~" "e>~" ".E>" ".e>"
204 "I2" "i2" "I-." "i-." "O-." "o-." "O2" "o2" "O>'" "o>'"
205 "O>!" "o>!" "O>2" "o>2" "O>~" "o>~" ".O>" ".o>" "O9'" "o9'"
206 "O9!" "o9!" "O92" "o92" "O9~" "o9~" ".O9" ".o9" "U-." "u-."
207 "U2" "u2" "U9'" "u9'" "U9!" "u9!" "U92" "u92" "U9~" "u9~"
208 ".U9" ".u9" "Y!" "y!" "Y-." "y-." "Y2" "y2" "Y~" "y~"
209 nil nil nil nil nil nil "a*," "a*;" nil nil ; Greek Ext (0x1f00)
210 nil nil nil nil "A*," "A*;" nil nil nil nil
211 nil nil "e*," "e*;" nil nil nil nil nil nil
212 "E*," "E*;" nil nil nil nil nil nil "y*," "y*;"
213 nil nil nil nil nil nil "Y*," "Y*;" nil nil
214 nil nil nil nil "i*," "i*;" nil nil nil nil
215 nil nil "I*," "I*;" nil nil nil nil nil nil
216 "o*," "o*;" nil nil nil nil nil nil "O*," "O*;"
217 nil nil nil nil nil nil "u*," "u*;" nil nil
218 nil nil nil nil nil "U*;" nil nil nil nil
219 nil nil "w*," "w*;" nil nil nil nil nil nil
220 "W*," "W*;" nil nil nil nil nil nil "a*!" "a*'"
221 "e*!" "e*'" "y*!" "y*'" "i*!" "i*'" "o*!" "o*'" "u*!" "u*'"
222 "w*!" "w*'" nil nil nil nil nil nil nil nil
223 nil nil nil nil nil nil nil nil nil nil
224 nil nil nil nil nil nil nil nil nil nil
225 nil nil nil nil nil nil nil nil nil nil
226 nil nil nil nil nil nil nil nil nil nil
227 nil nil "a*(" "a*-" nil "a*j" nil nil "a*~" nil
228 "A*(" "A*-" "A*!" "A*'" "A*J" ")*" "J3" ",," "?*" "?:"
229 nil "y*j" nil nil "y*?" nil "E*!" "E*'" "Y*!" "Y*'"
230 "Y*J" ",!" ",'" "?," "i*(" "i*-" nil nil nil nil
231 "i*?" nil "I*(" "I*-" "I*!" "I*'" nil ";!" ";'" "?;"
232 "u*(" "u*-" nil nil "r*," "r*;" "u*?" nil "U*(" "U*-"
233 "U*!" "U*'" "R*;" "!:" ":'" "!*" nil nil nil "w*j"
234 nil nil "w*?" nil "O*!" "O*'" "W*!" "W*'" "W*J" "/*"
235 ";;" nil nil nil "1N" "1M" "3M" "4M" "6M" nil ; Gen Punct
236 nil "1T" "1H" nil nil nil "LRM" "RLM" "-1" nil
237 nil "--" "---" "===" "!2" "=2" "6`" "'9" ".9" "9'"
238 "``" "''" ":9" "9``" "/-" "/=" "sb" "3b" nil ".."
239 "..." ".-" "LSep" "PSep" "LR[" "RL[" "PDF" "LRO" "RLO" 255
240 "%o" "%oo" "'" "''" "\"'" "`" "``" "```" ".^" "<,"
241 ",>" ":X" "!!" "?!" "'-" nil nil nil nil "-b"
242 "/f" nil nil nil nil nil nil nil nil nil
243 nil nil nil nil nil nil nil nil nil nil
244 nil nil nil nil nil nil nil nil nil nil
245 nil nil nil nil nil nil nil nil nil nil
246 nil nil nil nil "^0" nil nil nil "^4" "^5"
247 "^6" "^7" "^8" "^9" "^+" "^-" "^=" "^(" "^)" "^n"
248 "_0" "_1" "_2" "_3" "_4" "_5" "_6" "_7" "_8" "_9"
249 "_+" "_-" "_=" "_(" "_)" nil nil nil nil nil
250 nil nil nil nil nil nil nil nil nil nil
251 nil nil nil nil nil "Ff" "Li" nil nil "Pt"
252 nil "W=" "NIS" nil "E=" nil nil nil nil nil
253 nil nil nil nil nil nil nil nil nil nil
254 nil nil nil nil nil nil nil nil nil nil
255 nil nil nil nil nil nil nil nil nil nil
256 nil nil nil nil nil nil nil nil nil nil
257 nil nil nil nil nil nil nil nil nil nil
258 nil nil nil nil nil nil nil nil nil nil
259 nil nil nil nil nil nil nil nil nil nil
260 nil nil nil nil nil nil nil nil "a/c" "a/s"
261 nil "oC" nil "c/o" "c/u" "=e" nil "oF" nil nil
262 nil nil "-h" "=h" nil nil nil nil nil nil
263 "N0" "PO" nil nil nil nil "Re" nil "Rx" nil
264 "SM" "TEL" "TM" nil nil nil "Om" nil nil nil
265 "oK" "AO" nil nil "Est" nil nil nil nil nil
266 nil "Aleph" "Bet" "Gimel" "Dalet" "=i=" nil nil nil nil
267 nil nil nil nil nil nil nil nil nil nil
268 nil nil nil nil nil nil nil nil nil nil
269 nil "1/3" "2/3" "1/5" "2/5" "3/5" "4/5" "1/6" "5/6" "1/8"
270 "3/8" "5/8" "7/8" "1/" ".I" "II" "III" "IV" ".V" "VI"
271 "VII" "VIII" "IX" "X" "XI" "XII" ".L" ".C" ".D" ".M"
272 ".i" "ii" "iii" "iv" ".v" "vi" "vii" "viii" "ix" ".x"
273 "xi" ".l" ".c" ".d" ".m" "CD" "DD" "CoD" "CI" nil
274 nil nil nil nil nil nil nil nil nil nil
275 nil "<-" "|^" "->" "|v" "<->" "v|^" "^\\" "/^" "\\v"
276 "v/" "<-/" "/->" "<~" "~>" "<<-" "|^^" "->>" "|vv" "<-<"
277 ">->" "<-|" "_|^" "|->" "-|v" "_v|^" "<-?" "?->" "<-o" "o->"
278 "<~>" "<-/>" nil nil nil nil nil nil nil nil
279 nil nil nil nil nil nil nil nil nil nil
280 nil nil nil nil nil nil nil nil nil nil
281 nil nil nil "<=/" "<=/>" "/=>" "<=" "||^" "=>" "||v"
282 "<=>" "v||^" "^\\\\" "//^" "\\\\v" "v//" "<-=" "=->" nil nil
283 nil nil "<.." ":^" "..>" ":v" nil nil "<::" "::^"
284 "::>" "::v" nil nil nil nil nil nil nil nil
285 nil nil nil nil nil nil nil nil nil nil
286 nil nil nil nil "FA" "C." "dP" "TE" "~TE" "/0"
287 "DE" "NB" "(-" "~(-" "e-" "-)" "~-)" "-e" "QED" "*P"
288 nil "+Z" "--" "-+" ".+" "./" ".\\" "*-" "Ob" "Sb"
289 "SQR" "CBR" nil "0(" "00" "-L" "-V" nil nil ".|"
290 "~.|" "||" "/||" "AND" "OR" "(U" ")U" "In" "DI" nil
291 "Io" nil nil nil nil nil ".:" ":." ":R" "::"
292 ".-." "-:" ":-:" ":~:" "?~" "~?" "??" nil nil "/~"
293 "-~" "~-" "/~-" "~=" "~/=" "/~=" "~~" "/~~" nil nil
294 "=?" ")(" "v^" "^_" ".=" "=;" ".=." nil ":=" "=:"
295 nil "=o" "=)" "=^" "=v" "*=" "=<>" "=df" nil "?="
296 "!=" "-=" "!-=" "==" "=<" ">=" nil nil nil nil
297 "<<" ">>" "()" "/)(" "!<" "!>" nil nil nil nil
298 nil nil nil nil nil nil "<'" "`>" "=<'" "`>="
299 "~<'" "`>~" "/<'" "/`>" "(C" ")C" "/(C" "/)C" "(_" ")_"
300 "/(_" "/)_" nil nil nil nil nil nil nil nil
301 nil nil nil "0+" "0-" "0x" "0/" "0." "0o" "0*"
302 "0=" "0_" nil nil nil nil "|T" "T|" "-T" "_T"
303 nil nil nil nil nil nil nil nil nil nil
304 nil nil nil nil nil nil nil nil nil "-,-"
305 nil "XOR" "NAND" "NOR" nil nil nil nil nil nil
306 nil nil nil nil nil nil nil nil nil nil
307 nil nil nil nil nil nil nil nil "<." ".>"
308 "<<<" ">>>" nil nil nil nil nil nil nil nil
309 nil nil nil nil nil nil nil nil nil nil
310 nil nil ":3" "..." nil nil nil nil nil nil
311 nil nil nil nil nil nil nil nil nil nil
312 nil nil "Eh" nil nil nil nil nil "<7" ">7"
313 "7<" "7>" nil nil nil nil "~I" nil "(A" nil
314 nil "TR" nil "=||" "88" nil nil nil nil nil
315 nil nil "Iu" "Il" nil nil "-^-" "-`-" "D->" nil
316 nil "</" "/>" "<-D" nil nil nil nil nil nil
317 nil nil nil nil nil nil nil nil nil nil
318 nil nil nil nil nil nil nil nil nil nil
319 nil nil nil nil nil nil nil nil nil nil
320 nil nil nil nil nil nil nil nil nil nil
321 nil nil nil nil nil nil nil nil nil nil
322 nil nil nil nil nil nil nil nil nil nil
323 nil nil nil nil nil nil nil nil nil nil
324 nil nil nil nil nil nil nil nil nil nil
325 nil nil nil nil nil nil nil nil nil nil
326 nil nil nil nil nil nil nil nil nil nil
327 nil nil nil nil nil nil nil nil nil nil
328 nil nil nil nil nil nil nil nil nil nil
329 nil nil nil nil nil nil nil nil nil nil
330 nil nil nil nil nil nil nil nil nil nil
331 nil nil nil nil nil nil nil nil nil nil
332 nil nil nil nil nil nil nil nil nil nil
333 nil nil nil nil nil nil nil nil nil nil
334 nil nil nil nil nil nil nil nil nil nil
335 nil nil nil nil nil nil nil nil nil nil
336 nil nil nil nil nil nil nil nil nil nil
337 nil nil nil nil nil nil "NUL" "SOH" "STX" "ETX"
338 "EOT" "ENQ" "ACK" "BEL" "BS" "HT" "LF" "VT" "FF" "CR"
339 "SS" "SI" "DLE" "DC1" "DC2" "DC3" "DC4" "NAK" "SYN" "ETB"
340 "CAN" "EM" "SUB" "ESC" "FS" "GS" "RS" "US" "SP" "DEL"
341 "b/" ",_," "NL" nil "?^" nil nil nil nil nil
342 nil nil nil nil nil nil nil nil nil nil
343 nil nil nil nil nil nil nil nil nil nil
344 nil nil nil nil nil nil nil nil nil nil
345 nil nil nil nil nil nil nil nil nil nil
346 nil nil nil nil nil nil nil nil nil nil
347 nil nil "1-o" "2-o" "3-o" "4-o" "5-o" "6-o" "7-o" "8-o"
348 "9-o" "10-o" "11-o" "12-o" "13-o" "14-o" "15-o" "16-o" "17-o" "18-o"
349 "19-o" "20-o" "(1)" "(2)" "(3)" "(4)" "(5)" "(6)" "(7)" "(8)"
350 "(9)" "(10)" "(11)" "(12)" "(13)" "(14)" "(15)" "(16)" "(17)" "(18)"
351 "(19)" "(20)" "1." "2." "3." "4." "5." "6." "7." "8."
352 "9." "10." "11." "12." "13." "14." "15." "16." "17." "18."
353 "19." "20." "(a)" "(b)" "(c)" "(d)" "(e)" "(f)" "(g)" "(h)"
354 "(i)" "(j)" "(k)" "(l)" "(m)" "(n)" "(o)" "(p)" "(q)" "(r)"
355 "(s)" "(t)" "(u)" "(v)" "(w)" "(x)" "(y)" "(z)" "A-o" "B-o"
356 "C-o" "D-o" "E-o" "F-o" "G-o" "H-o" "I-o" "J-o" "K-o" "L-o"
357 "M-o" "N-o" "O-o" "P-o" "Q-o" "R-o" "S-o" "T-o" "U-o" "V-o"
358 "W-o" "X-o" "Y-o" "Z-o" "a-o" "b-o" "c-o" "d-o" "e-o" "f-o"
359 "g-o" "h-o" "i-o" "j-o" "k-o" "l-o" "m-o" "n-o" "o-o" "p-o"
360 "q-o" "r-o" "s-o" "t-o" "u-o" "v-o" "w-o" "x-o" "y-o" "z-o"
361 "0-o" ]
365 "A list of strings that should be used to represent Unicode
366 characters on a DOS terminal which does not have corresponding
367 glyphs built into the installed codepage.")
369 (defun IT-setup-unicode-display (coding &optional table)
370 "Set up display table TABLE for displaying mule-unicode-* characters
371 on a DOS terminal whose codepage provides the coding-system CODING.
372 If TABLE is nil or omitted, `standard-display-table' is used."
373 (interactive "zCode page: ")
374 (let ((disp-tab (or table standard-display-table))
375 (tail IT-unicode-translations)
376 translation)
377 (while tail
378 (setq translation (car tail) tail (cdr tail))
379 (let* ((first (car translation))
380 (last (nth 1 translation))
381 (table (nth 2 translation))
382 (i 0)
383 (this first)
384 glyph)
385 (while (<= i (- last first))
386 (setq glyph (aref table i))
387 (when (and glyph
388 (unencodable-char-position 0 1 coding nil (string this)))
389 (aset disp-tab this
390 (vconcat (if (numberp glyph)
391 (string glyph)
392 glyph))))
393 (setq i (1+ i) this (1+ this)))))))
395 (defvar dos-codepage)
396 (defvar dos-country-code)
398 ;; The following alist was compiled from:
400 ;; Ralf Brown's Interrupt List. file INTERRUP.F, D-2138, Table 01400
401 ;; http://www.ethnologue.com/country_index.asp (official languages)
402 ;; http://unicode.org/onlinedat/languages.html
403 ;; http://unicode.org/onlinedat/countries.html
405 ;; Only the official languages listed for each country.
407 (defvar dos-locale-alist
408 '(( 1 . "en_US")
409 ( 2 . "fr_CA")
410 ( 3 . "es_MX") ; what the heck is "Latin America"?
411 ( 4 . "en_CA")
412 ( 7 . "ru_RU")
413 ( 20 . "ar_EG")
414 ( 27 . "af_ZA")
415 ( 30 . "el_GR")
416 ( 31 . "nl_NL")
417 ( 32 . "nl_BE")
418 ( 33 . "fr_FR")
419 ( 34 . "es_ES")
420 ( 35 . "bg_BG")
421 ( 36 . "hu_HU")
422 ( 38 . "sh_YU")
423 ( 39 . "it_IT")
424 ( 40 . "ro_RO")
425 ( 41 . "de_CH")
426 ( 42 . "cs_CZ")
427 ( 43 . "de_AT")
428 ( 44 . "en_UK")
429 ( 45 . "da_DK")
430 ( 46 . "sv_SE")
431 ( 47 . "no_NO")
432 ( 48 . "pl_PL")
433 ( 49 . "de_DE")
434 ( 51 . "es_PE")
435 ( 52 . "es_MX")
436 ( 53 . "es_CU")
437 ( 54 . "es_AR")
438 ( 55 . "pt_BR")
439 ( 56 . "es_CL")
440 ( 57 . "es_CO")
441 ( 58 . "es_VE")
442 ( 60 . "ms_MY")
443 ( 61 . "en_AU")
444 ( 62 . "id_ID")
445 ( 63 . "fil_PH")
446 ( 64 . "en_NZ")
447 ( 65 . "zh_SG")
448 ( 66 . "th_TH")
449 ( 81 . "ja_JP")
450 ( 82 . "ko_KR")
451 ( 84 . "vi_VN")
452 ( 86 . "zh_CN")
453 ( 88 . "zh_TW")
454 ( 90 . "tr_TR")
455 ( 91 . "hi_IN")
456 ( 92 . "ur_PK")
457 ( 93 . "ps_AF")
458 ( 94 . "si_LK")
459 ( 98 . "fa_IR")
460 ( 99 . "en" )
461 (102 . "he_IL")
462 (112 . "be_BY")
463 (212 . "ar_MA")
464 (213 . "ar_DZ")
465 (216 . "ar_TN")
466 (218 . "ar_LY")
467 (220 . "en_GM")
468 (221 . "fr_SN")
469 (222 . "mey_MR")
470 (223 . "fr_ML")
471 (224 . "fr_GN")
472 (227 . "fr_NE")
473 (228 . "fr_TG")
474 (230 . "fr_MU")
475 (231 . "en_LR")
476 (232 . "en_SL")
477 (233 . "en_GH")
478 (234 . "en_NG")
479 (235 . "ar_TD")
480 (236 . "fr_CF")
481 (237 . "fr_CM")
482 (241 . "fr_GA")
483 (242 . "fr_CG")
484 (243 . "sw_ZR")
485 (244 . "pt_AO")
486 (245 . "pt_GW")
487 (249 . "ar_SD")
488 (250 . "fr_RW")
489 (251 . "am_ET")
490 (252 . "so_SO")
491 (253 . "fr_DJ")
492 (254 . "sw_KE")
493 (255 . "sw_TZ")
494 (256 . "en_UG")
495 (257 . "fr_BI")
496 (259 . "pt_MZ")
497 (260 . "en_ZM")
498 (261 . "mg_MG")
499 (263 . "en_ZW")
500 (264 . "en_NA")
501 (265 . "en_MW")
502 (266 . "st_LS")
503 (267 . "en_BW")
504 (268 . "en_SZ")
505 (299 . "kl_GL")
506 (350 . "en_GI")
507 (351 . "pt_PT")
508 (352 . "fr_LU")
509 (353 . "ga_IE")
510 (354 . "is_IS")
511 (355 . "sq_AL")
512 (356 . "mt_MT")
513 (357 . "gr_CY")
514 (358 . "fi_FI")
515 (359 . "bg_BG")
516 (370 . "lt_LT")
517 (371 . "lv_LV")
518 (372 . "et_EE")
519 (373 . "mo_MD")
520 (380 . "uk_UA")
521 (381 . "sr_RS")
522 (384 . "hr_HR")
523 (385 . "hr_HR")
524 (386 . "sl_SI")
525 (387 . "bs_BA")
526 (388 . "sr_BA")
527 (389 . "mk_MK")
528 (421 . "cs_CZ")
529 (422 . "sk_SK")
530 (502 . "es_GT")
531 (503 . "es_SV")
532 (504 . "es_HN")
533 (505 . "es_NI")
534 (506 . "es_CR")
535 (507 . "es_PA")
536 (509 . "ht_HT")
537 (590 . "fr_GP")
538 (591 . "es_BO")
539 (592 . "en_GY")
540 (593 . "es_EC")
541 (594 . "fr_GF")
542 (595 . "gn_PY")
543 (596 . "fr_MQ")
544 (597 . "nl_SR")
545 (598 . "es_UY")
546 (785 . "ar" )
547 (804 . "uk_UA")
548 (850 . "ko_KP")
549 (855 . "km_KH")
550 (856 . "lo_LA")
551 (880 . "bn_BD")
552 (886 . "zh_TW")
553 (960 . "dv_MV")
554 (961 . "ar_LB")
555 (962 . "ar_JO")
556 (963 . "ar_SY")
557 (964 . "ar_IQ")
558 (965 . "ar_KW")
559 (966 . "ar_SA")
560 (967 . "ar_YE")
561 (968 . "ar_OM")
562 (969 . "ar_YE")
563 (971 . "ar_AE")
564 (972 . "he_IL")
565 (973 . "ar_BH")
566 (974 . "ar_QA")
567 (975 . "dz_BT")
568 (976 . "mn_MN")
569 (977 . "ne_NP")
570 (995 . "my_MM")
572 "Alist of MS-DOS country codes and the corresponding locale names.")
574 (defun dos-codepage-setup ()
575 "Set up multilingual environment for the installed DOS codepage.
577 This function sets coding systems, display tables, and the language
578 environment options as appropriate for the current value of `dos-codepage'.
580 This function is automatically run at startup via the `after-init-hook'
581 list. You can (and should) also run it if and when the value of
582 `dos-codepage' changes."
583 (interactive)
584 (let ((locale (cdr (assq dos-country-code dos-locale-alist)))
585 (coding (format "cp%s" dos-codepage))
586 coding-dos coding-unix)
587 (setq coding-dos (intern (format "%s-dos" coding))
588 coding-unix (intern (format "%s-unix" coding)))
589 (setq locale (if locale
590 (format "%s.cp%s" locale dos-codepage)
591 "en_US.cp437"))
592 (set-locale-environment locale)
593 (set-selection-coding-system coding-dos)
594 (IT-setup-unicode-display coding-unix)
595 (prefer-coding-system coding-dos)
596 (and (default-value 'enable-multibyte-characters)
597 (setq unibyte-display-via-language-environment t))
598 ;; Some codepages have sporadic support for Latin-1, Greek, and
599 ;; symbol glyphs, which don't belong to their native character
600 ;; set. It's a nuisance to have all those glyphs here, for all
601 ;; the codepages (for starters, I don't even have references for
602 ;; all the codepages). So provide a hook for those who want to
603 ;; squeeze every bit of support out of their terminal/font.
604 (run-hooks 'dos-codepage-setup-hook)
607 ;;; internal.el ends here