internal.el 24 KB

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