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