diff options
| author | Eli Zaretskii | 2008-09-30 16:18:09 +0000 |
|---|---|---|
| committer | Eli Zaretskii | 2008-09-30 16:18:09 +0000 |
| commit | ff58641318d2a5e915819c32927d03313b13f67d (patch) | |
| tree | 1ee37fcb271178658996f146b2245c5fefadb123 | |
| parent | db7a4b661b49c8749f55818d1c6bfaa8dc46d4e1 (diff) | |
| download | emacs-ff58641318d2a5e915819c32927d03313b13f67d.tar.gz emacs-ff58641318d2a5e915819c32927d03313b13f67d.zip | |
Remove coding: cookie and no-byte-compile flag.
(IT-character-translations, cjk-codepages-alist): Remove variables.
(IT-display-table-setup, dos-cpNNN-setup): Remove functions.
(IT-unicode-translations): Remove charset and base elements. Add translations
for Latin-1 characters.
(IT-setup-unicode-display): Accept a CODING argument. Don't use base and
chset elements of IT-unicode-translations. Don't wrap translation in "{...}".
Set up translations only for characters for which unencodable-char-position
returns non-nil.
(dos-codepage-setup): Don't use special-case codepages in cjk-codepages-alist.
| -rw-r--r-- | lisp/ChangeLog | 12 | ||||
| -rw-r--r-- | lisp/term/internal.el | 414 |
2 files changed, 74 insertions, 352 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 844fff225ab..9be3f696c6b 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,17 @@ | |||
| 1 | 2008-09-30 Eli Zaretskii <eliz@gnu.org> | 1 | 2008-09-30 Eli Zaretskii <eliz@gnu.org> |
| 2 | 2 | ||
| 3 | * term/internal.el: Remove coding: cookie and no-byte-compile flag. | ||
| 4 | (IT-character-translations, cjk-codepages-alist): Remove variables. | ||
| 5 | (IT-display-table-setup, dos-cpNNN-setup): Remove functions. | ||
| 6 | (IT-unicode-translations): Remove charset and base elements. Add | ||
| 7 | translations for Latin-1 characters. | ||
| 8 | (IT-setup-unicode-display): Accept a CODING argument. Don't use | ||
| 9 | base and chset elements of IT-unicode-translations. Don't wrap | ||
| 10 | translation in "{...}". Set up translations only for characters | ||
| 11 | for which unencodable-char-position returns non-nil. | ||
| 12 | (dos-codepage-setup): Don't use special-case codepages in | ||
| 13 | cjk-codepages-alist. | ||
| 14 | |||
| 3 | * files.el (locate-dominating-file): Wrap directory-files with | 15 | * files.el (locate-dominating-file): Wrap directory-files with |
| 4 | condition-case, instead of calling file-directory-p, which stats | 16 | condition-case, instead of calling file-directory-p, which stats |
| 5 | the directory one more time. | 17 | the directory one more time. |
diff --git a/lisp/term/internal.el b/lisp/term/internal.el index 7e7fc918602..3e053189d15 100644 --- a/lisp/term/internal.el +++ b/lisp/term/internal.el | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | ;;; internal.el --- support for PC internal terminal -*- coding: raw-text; no-byte-compile: t -*- | 1 | ;;; internal.el --- support for PC internal terminal |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1993, 1994, 1998, 1999, 2001, 2002, 2003, 2004, | 3 | ;; Copyright (C) 1993, 1994, 1998, 1999, 2001, 2002, 2003, 2004, |
| 4 | ;; 2005, 2006, 2007, 2008 Free Software Foundation, Inc. | 4 | ;; 2005, 2006, 2007, 2008 Free Software Foundation, Inc. |
| @@ -82,16 +82,10 @@ | |||
| 82 | ;; | 82 | ;; |
| 83 | ;; Since each codepage can usually display character of a single | 83 | ;; Since each codepage can usually display character of a single |
| 84 | ;; MULE charset, Emacs can display a single MULE charset with the | 84 | ;; MULE charset, Emacs can display a single MULE charset with the |
| 85 | ;; glyphs of the current codepage. The mapping from DOS codepages | 85 | ;; glyphs of the current codepage. When Emacs starts on DOS, it |
| 86 | ;; to MULE charsets is established by the charset property of the | 86 | ;; automatically sets its default coding systems for file I/O and |
| 87 | ;; cpNNN-decode-table variables in codepage.el, which also | 87 | ;; terminal output according to the currend DOS codepage, given by |
| 88 | ;; defines translation tables for each such pair, and a bunch of | 88 | ;; the `dos-codepage' variable. |
| 89 | ;; functions to generate coding systems that use those translation | ||
| 90 | ;; tables to convert codepage-encoded text to the appropriate MULE | ||
| 91 | ;; charset and back. When Emacs starts on DOS, it automatically | ||
| 92 | ;; sets its default coding systems for file I/O and terminal output | ||
| 93 | ;; according to the currend DOS codepage, given by the | ||
| 94 | ;; `dos-codepage' variable. | ||
| 95 | ;; | 89 | ;; |
| 96 | ;; This leaves us with the problem of displaying character sets | 90 | ;; This leaves us with the problem of displaying character sets |
| 97 | ;; other than the one which maps directly into the current codepage. | 91 | ;; other than the one which maps directly into the current codepage. |
| @@ -99,204 +93,26 @@ | |||
| 99 | ;; defining a display table where each character that doesn't have a | 93 | ;; defining a display table where each character that doesn't have a |
| 100 | ;; glyph in some codepage is mapped to a string which represents it. | 94 | ;; glyph in some codepage is mapped to a string which represents it. |
| 101 | ;; For example, a small c with cedilla is mapped to the string | 95 | ;; For example, a small c with cedilla is mapped to the string |
| 102 | ;; "{,c}" (the braces serve as a sign that this is a single | 96 | ;; ",c". A nice feature of the display tables is that Emacs |
| 103 | ;; character). A nice feature of the display tables is that Emacs | ||
| 104 | ;; knows that the string represents a single character, and thus | 97 | ;; knows that the string represents a single character, and thus |
| 105 | ;; cursor motion works as you'd expect: a single `C-f' moves past | 98 | ;; cursor motion works as you'd expect: a single `C-f' moves past |
| 106 | ;; the entire string which represents a single character. | 99 | ;; the entire string which represents a single character. |
| 107 | ;; ---------------------------------------------------------------------- | 100 | ;; ---------------------------------------------------------------------- |
| 108 | 101 | ||
| 109 | (defvar IT-character-translations | ||
| 110 | '( | ||
| 111 | (latin-iso8859-1 | ||
| 112 | . [255 "!I" "|c" "Pd" "$$" "Ye" "|" "SE" "\"" "(c)" | ||
| 113 | "_a" "<<" "~" "--" "(R)" "'-" "^o" "+-" "^2" "^3" | ||
| 114 | "'" "u" ".P" "^." "'," "^1" "_o" ">>" "1/4" "1/2" | ||
| 115 | "3/4" "?I" "`A" "A'" "A^" "~A" "\"A" "Ao" "AE" ",C" | ||
| 116 | "`E" "E'" "E^" "\"E" "`I" "I'" "I^" "\"I" "-D" "~N" | ||
| 117 | "`O" "O'" "O^" "~O" "\"O" "*x" "/O" "`U" "U'" "U^" | ||
| 118 | "\"U" "Y'" "-P" "ss" "`a" "a'" "a^" "~a" "\"a" "ao" | ||
| 119 | "ae" ",c" "`e" "e'" "e^" "\"e" "`i" "i'" "i^" "\"i" | ||
| 120 | "-d" "~n" "`o" "o'" "o^" "~o" "\"o" "-:" "/o" "`u" | ||
| 121 | "u'" "u^" "\"u" "y'" "-p" "\"y"] | ||
| 122 | ) | ||
| 123 | (latin-iso8859-2 | ||
| 124 | . [255 "A;" "'(" "/L" "$$" "L<" "S'" "SE" "\"" "S<" | ||
| 125 | ",S" "T<" "Z'" "--" "Z<" "Z^." "^o" "a;" "';" "/l" | ||
| 126 | "'" "l<" "s'" "'<" "'," "s<" ",s" "t<" "z'" "'" | ||
| 127 | "z<" "z^." "R'" "A'" "A^" "A(" "\"A" "L'" "C'" ",C" | ||
| 128 | "C<" "E'" "E;" "E:" "E<" "I'" "I^" "D<" "/D" "N'" | ||
| 129 | "N<" "O'" "O^" "O''" "\"O" "*x" "R<" "U^0" "U'" "U''" | ||
| 130 | "\"U" "Y'" ",T" "ss" "r'" "a'" "a^" "a(" "\"a" "l'" | ||
| 131 | "c'" ",c" "c<" "e'" "e;" "\"e" "e<" "i'" "i^" "d<" | ||
| 132 | "/d" "n'" "n<" "o'" "o^" "o''" "\"o" "-:" "r<" "u^0" | ||
| 133 | "u'" "u''" "\"u" "y'" ",t" "'."] | ||
| 134 | ) | ||
| 135 | (latin-iso8859-3 | ||
| 136 | . [255 "/H" "'(" "Pd" "$$" " " "H^" "SE" "\"" "I^." | ||
| 137 | ",S" "G(" "J^" "--" " " "Z^." "^o" "/h" "^2" "^3" | ||
| 138 | "'" "u" "h^" "." "'," "i^." ",s" "g(" "j^" "1/2" | ||
| 139 | " " "z^." "`A" "A'" "A^" " " "\"A" "C^." "C^" ",C" | ||
| 140 | "`E" "E'" "E^" "\"E" "`I" "I'" "I^" "\"I" " " "~N" | ||
| 141 | "`O" "O'" "O^" "G^." "\"O" "*x" "G^" "`U" "U'" "U^" | ||
| 142 | "\"U" "U(" "S^" "ss" "`a" "a'" "a^" " " "\"a" "c^." | ||
| 143 | "c^" ",c" "`e" "e'" "e^" "\"e" "`i" "i'" "i^" "\"i" | ||
| 144 | " " "~n" "`o" "o'" "o^" "g^." "\"o" "-:" "g^" "`u" | ||
| 145 | "u'" "u^" "\"u" "u(" "s^" "^."] | ||
| 146 | ) | ||
| 147 | (latin-iso8859-4 | ||
| 148 | . [255 "A;" "kk" ",R" "$$" "?I" ",L" "SE" "\"" "S<" | ||
| 149 | "E-" ",G" "/T" "--" "Z<" "'-" "^o" "a;" "';" ",r" | ||
| 150 | "'" "~i" ",l" "'<" "'," "s<" "e-" ",g" "/t" "NG" | ||
| 151 | "z<" "ng" "A-" "A'" "A^" "~A" "\"A" "Ao" "AE" "I;" | ||
| 152 | "C<" "E'" "E;" "\"E" "E^." "I'" "I^" "I-" "/D" ",N" | ||
| 153 | "O-" ",K" "O^" "~O" "\"O" "*x" "/O" "U;" "U'" "U^" | ||
| 154 | "\"U" "~U" "U-" "ss" "a-" "a'" "a^" "~a" "\"a" "ao" | ||
| 155 | "ae" "i;" "c<" "e'" "e;" "\"e" "e^." "i'" "i^" "i-" | ||
| 156 | "/d" ",n" "o-" ",k" "o^" "~o" "\"o" "-:" "/o" "u;" | ||
| 157 | "u'" "u^" "\"u" "~u" "u-" "^."] | ||
| 158 | ) | ||
| 159 | (cyrillic-iso8859-5 | ||
| 160 | . [255 "\"E" "Dj" "Gj" "IE" "Dz" "Ii" "Ji" "JE" "Lj" | ||
| 161 | "Nj" "Ts" "Kj" 240 "V%" "Dzh" 65 "B=" 66 226 | ||
| 162 | 68 69 "Z%" 51 85 "J=" 75 "L=" 77 72 | ||
| 163 | 79 "P=" 80 67 84 89 232 88 "C=" "C%" | ||
| 164 | "S%" "Sc" "=\"" "Y=" "%\"" "Ee" "Yu" "Ya" 97 98 | ||
| 165 | "v=" "g=" 103 101 "z%" "z=" 117 "j=" 107 "l=" | ||
| 166 | "m=" "n=" 111 110 112 99 "t=" 121 "f=" 120 | ||
| 167 | "c=" "c%" "s%" "sc" "='" "y=" "%'" "ee" "yu" "ya" | ||
| 168 | "N0" "\"e" "dj" "gj" "ie" "dz" "ii" "ji" "je" "lj" | ||
| 169 | "nj" "ts" "kj" 21 "v%" "dzh"] | ||
| 170 | ) | ||
| 171 | (arabic-iso8859-6 | ||
| 172 | . [255 nil nil nil "$$" nil nil nil nil nil | ||
| 173 | nil nil ",+" "--" nil nil nil nil nil nil | ||
| 174 | nil nil nil nil nil nil nil ";+" nil nil | ||
| 175 | nil "?+" nil "H'" "aM" "aH" "wH" "ah" "yH" | ||
| 176 | "a+" "b+" "tm" "t+" "tk" "g+" "hk" "x+" "d+" "dk" | ||
| 177 | "r+" "z+" "s+" "sn" "c+" "dd" "tj" "zH" "e+" "i+" | ||
| 178 | nil nil nil nil nil "++" "f+" "q+" "k+" "l+" | ||
| 179 | "m+" "n+" "h+" "w+" "j+" "y+" ":+" "\"+" "=+" "/+" | ||
| 180 | "'+" "1+" "3+" "0+" nil nil nil nil nil nil | ||
| 181 | nil nil nil nil nil nil nil] | ||
| 182 | ) | ||
| 183 | (greek-iso8859-7 | ||
| 184 | . [255 "9'" "'9" "Pd" nil nil "|" "SE" "\"" "(c)" | ||
| 185 | nil "<<" "~" "--" nil "-M" "^o" "+-" "^2" "^3" | ||
| 186 | "'" "'%" "'A" "^." "'E" "'H" "'I" ">>" "'O" "1/2" | ||
| 187 | "'Y" "W%" "i3" 65 66 "G*" "D*" 69 90 72 | ||
| 188 | "TH" 73 74 "L*" 77 78 "C*" 79 "P*" 80 | ||
| 189 | nil "S*" 84 89 "F*" 88 "Q*" "W*" "\"I" "\"Y" | ||
| 190 | "a%" "e%" "y%" "i%" "u3" "a*" "b*" "g*" "d*" "e*" | ||
| 191 | "z*" "y*" "h*" "i*" 107 "l*" "m*" "n*" "c*" 111 | ||
| 192 | "p*" "r*" "*s" "s*" "t*" 117 "f*" "x*" "q*" "w*" | ||
| 193 | "\"i" "\"u" "'o" "'u" "'w" nil] | ||
| 194 | ) | ||
| 195 | ;; Note: some of the characters undefined according to ISO 8859-8 | ||
| 196 | ;; in the ranges 190..220 and 250..255 are replaced with SI 1311-1 | ||
| 197 | ;; points (Niqud) and bidi formatting characters | ||
| 198 | (hebrew-iso8859-8 | ||
| 199 | . [255 nil "|c" "Pd" "$$" "Ye" "|" "SE" "\"" "(c)" | ||
| 200 | "*x" "<<" "~" "--" "(R)" "'-" "^o" "+-" "^2" "^3" | ||
| 201 | "'" "u" ".P" "^." "'," "^1" "-:" ">>" "1/4" "1/2" | ||
| 202 | "3/4" nil ":'" "v:" "-:" "-':" ".'" ".." "v'" "-'" | ||
| 203 | "-," "`." nil "\\." "(.)" "|'" "`-" "`=" "||" nil | ||
| 204 | nil "::" nil nil nil nil nil nil nil "LRO" | ||
| 205 | "RLO" "PDF" nil "=2" "A+" "B+" "G+" "D+" "H+" "W+" | ||
| 206 | "Z+" "X+" "Tj" "J+" "K%" "K+" "L+" "M%" "M+" "N%" | ||
| 207 | "N+" "S+" "E+" "P%" "P+" "Zj" "ZJ" "Q+" "R+" "Sh" | ||
| 208 | "T+" "LRE" "RLE" "LRM" "RLM" nil] | ||
| 209 | ) | ||
| 210 | (latin-iso8859-9 | ||
| 211 | . [255 "!I" "|c" "Pd" "$$" "Ye" "|" "SE" "\"" "(c)" | ||
| 212 | "_a" "<<" "~" "--" "(R)" "'-" "^o" "+-" "^2" "^3" | ||
| 213 | "'" "u" ".P" "^." "'," "^1" "_o" ">>" "1/4" "1/2" | ||
| 214 | "3/4" "?I" "`A" "A'" "A^" "~A" "\"A" "Ao" "AE" ",C" | ||
| 215 | "`E" "E'" "E^" "\"E" "`I" "I'" "I^" "\"I" "G(" "~N" | ||
| 216 | "`O" "O'" "O^" "~O" "\"O" "*x" "/O" "`U" "U'" "U^" | ||
| 217 | "\"U" "I^." ",S" "ss" "`a" "a'" "a^" "~a" "\"a" "ao" | ||
| 218 | "ae" ",c" "`e" "e'" "e<" "\"e" "e^." "i'" "i^" "i-" | ||
| 219 | "g(" "~n" "`o" "o'" "o^" "~o" "\"o" "-:" "/o" "`u" | ||
| 220 | "u'" "u^" "\"u" "i." ",s" "\"y"] | ||
| 221 | ) | ||
| 222 | (latin-iso8859-14 | ||
| 223 | . [255 "B`" "b`" "Pd" "C`" "c`" "D`" "SE" "`W" "(c)" | ||
| 224 | "W'" "d`" "`Y" "--" "(R)" "\"Y" "F`" "f`" "G`" "g`" | ||
| 225 | "M`" "m`" ".P" "P`" "`w" "p`" "w'" "S`" "`y" "\"W" | ||
| 226 | "\"w" "s`" "`A" "A'" "A^" "~A" "\"A" "Ao" "AE" ",C" | ||
| 227 | "`E" "E'" "E^" "\"E" "`I" "I'" "I^" "\"I" "W^" "~N" | ||
| 228 | "`O" "O'" "O^" "~O" "\"O" "T`" "/O" "`U" "U'" "U^" | ||
| 229 | "\"U" "Y'" "Y^" "ss" "`a" "a'" "a^" "~a" "\"a" "ao" | ||
| 230 | "ae" ",c" "`e" "e'" "e^" "\"e" "`i" "i'" "i^" "\"i" | ||
| 231 | "w^" "~n" "`o" "o'" "o^" "~o" "\"o" "t`" "/o" "`u" | ||
| 232 | "u'" "u^" "\"u" "y'" "y^" "\"y"] | ||
| 233 | ) | ||
| 234 | (latin-iso8859-15 | ||
| 235 | . [255 "!I" "|c" "Pd" "E=" "Ye" "S<" "SE" "s<" "(c)" | ||
| 236 | "_a" "<<" "~" "--" "(R)" "'-" "^o" "+-" "^2" "^3" | ||
| 237 | "Z<" "u" ".P" "^." "z<" "^1" "_o" ">>" "OE" "oe" | ||
| 238 | "\"Y" "?I" "`A" "A'" "A^" "~A" "\"A" "Ao" "AE" ",C" | ||
| 239 | "`E" "E'" "E^" "\"E" "`I" "I'" "I^" "\"I" "-D" "~N" | ||
| 240 | "`O" "O'" "O^" "~O" "\"O" "*x" "/O" "`U" "U'" "U^" | ||
| 241 | "\"U" "Y'" "|P" "ss" "`a" "a'" "a^" "~a" "\"a" "ao" | ||
| 242 | "ae" ",c" "`e" "e'" "e^" "\"e" "`i" "i'" "i^" "\"i" | ||
| 243 | "-d" "~n" "`o" "o'" "o^" "~o" "\"o" "-:" "/o" "`u" | ||
| 244 | "u'" "u^" "\"u" "y'" "|p" "\"y"] | ||
| 245 | ) | ||
| 246 | ) | ||
| 247 | "An alist of MULE ISO-8859 character sets and the strings that | ||
| 248 | should be used to represent the characters from each set on a DOS | ||
| 249 | terminal which does not have corresponding glyphs built into the | ||
| 250 | installed codepage.") | ||
| 251 | |||
| 252 | (defun IT-display-table-setup (codepage &optional table) | ||
| 253 | "Set up display table TABLE for a DOS terminal which supports | ||
| 254 | glyphs built into the codepage CODEPAGE. | ||
| 255 | |||
| 256 | If TABLE is nil or omitted, `standard-display-table' is used." | ||
| 257 | (let* ((surrogates IT-character-translations) | ||
| 258 | (disp-tab (or table standard-display-table)) | ||
| 259 | (built-in-set (cp-charset-for-codepage codepage)) | ||
| 260 | (offset (cp-offset-for-codepage codepage)) | ||
| 261 | (cp-decoder | ||
| 262 | (symbol-value (intern-soft (format "%s-decode-table" codepage)))) | ||
| 263 | (cp-decoder-len (length cp-decoder)) | ||
| 264 | (c offset) | ||
| 265 | association chset) | ||
| 266 | ;; Undo the effects of previous call (where they may have used | ||
| 267 | ;; a different codepage) by reverting the display table for the | ||
| 268 | ;; built-in charset to its pristine shape. | ||
| 269 | (while (< c 256) | ||
| 270 | (aset disp-tab (make-char built-in-set c) nil) | ||
| 271 | (setq c (1+ c))) | ||
| 272 | (while surrogates | ||
| 273 | (setq association (car surrogates)) | ||
| 274 | (setq chset (car association)) | ||
| 275 | (let* ((vector (cdr association)) | ||
| 276 | (veclen (length vector)) | ||
| 277 | (i 0) | ||
| 278 | glyph) | ||
| 279 | (while (< i veclen) | ||
| 280 | (setq glyph (aref vector i)) | ||
| 281 | (or glyph (setq glyph dos-unsupported-char-glyph)) | ||
| 282 | (if (or (not (equal chset built-in-set)) | ||
| 283 | (>= i cp-decoder-len) | ||
| 284 | (null (aref cp-decoder i))) | ||
| 285 | (aset disp-tab (make-char chset (+ i (logand offset 127))) | ||
| 286 | (vconcat | ||
| 287 | (if (numberp glyph) | ||
| 288 | (char-to-string glyph) | ||
| 289 | (if (> (length glyph) 1) (concat "{" glyph "}") | ||
| 290 | glyph))))) | ||
| 291 | (setq i (1+ i)))) | ||
| 292 | (setq surrogates (cdr surrogates))))) | ||
| 293 | |||
| 294 | (defvar IT-unicode-translations | 102 | (defvar IT-unicode-translations |
| 295 | '( | 103 | '( |
| 296 | (mule-unicode-0100-24ff ; charset | 104 | (160 563 ; first, last |
| 297 | 256 ; base | 105 | [ 255 "!I" "|c" "Pd" "$$" "Ye" "|" "SE" "\"" "(c)" ; Latin-1 |
| 298 | 256 563 ; first, last | 106 | "_a" "<<" "~" "--" "(R)" "'-" "^o" "+-" "^2" "^3" |
| 299 | [ "A-" "a-" "A(" "a(" "A;" "a;" "C'" "c'" "C>" "c>" ; Latin Extended-A | 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 | ||
| 300 | "C." "c." "C<" "c<" "D<" "d<" "D/" "d/" "E-" "e-" | 116 | "C." "c." "C<" "c<" "D<" "d<" "D/" "d/" "E-" "e-" |
| 301 | "E(" "e(" "E." "e." "E;" "e;" "E<" "e<" "G>" "g>" | 117 | "E(" "e(" "E." "e." "E;" "e;" "E<" "e<" "G>" "g>" |
| 302 | "G(" "g(" "G." "g." "G," "g," "H>" "h>" "H/" "h/" | 118 | "G(" "g(" "G." "g." "G," "g," "H>" "h>" "H/" "h/" |
| @@ -330,9 +146,7 @@ If TABLE is nil or omitted, `standard-display-table' is used." | |||
| 330 | 146 | ||
| 331 | ) | 147 | ) |
| 332 | 148 | ||
| 333 | (mule-unicode-0100-24ff ; charset | 149 | (884 1123 ; first, last |
| 334 | 256 ; base | ||
| 335 | 884 1123 ; first, last | ||
| 336 | [ "'" "," nil nil nil nil "j3" nil nil nil ; Greek | 150 | [ "'" "," nil nil nil nil "j3" nil nil nil ; Greek |
| 337 | "?;" nil nil nil nil nil "'*" "'%" "A%" ".*" | 151 | "?;" nil nil nil nil nil "'*" "'%" "A%" ".*" |
| 338 | "E%" "Y%" "I%" nil "O%" nil "U%" "W%" "i3" "A*" | 152 | "E%" "Y%" "I%" nil "O%" nil "U%" "W%" "i3" "A*" |
| @@ -359,9 +173,7 @@ If TABLE is nil or omitted, `standard-display-table' is used." | |||
| 359 | "nj" "ts" "kj" "v%" "`i=" "dz" "OM=" "om=" "Y3" "y3"] ; 0x463 | 173 | "nj" "ts" "kj" "v%" "`i=" "dz" "OM=" "om=" "Y3" "y3"] ; 0x463 |
| 360 | ) | 174 | ) |
| 361 | 175 | ||
| 362 | (mule-unicode-0100-24ff ; charset | 176 | (1454 1645 ; first, last |
| 363 | 256 ; base | ||
| 364 | 1454 1645 ; first, last | ||
| 365 | [ nil nil ":'" "v:" "-:" "-':" ".'" ".." "v'" "-'" | 177 | [ nil nil ":'" "v:" "-:" "-':" ".'" ".." "v'" "-'" |
| 366 | "-," "`." nil "\\." "(.)" "|'" "`-" nil "||" nil | 178 | "-," "`." nil "\\." "(.)" "|'" "`-" nil "||" nil |
| 367 | nil "::" nil nil nil nil nil nil nil nil | 179 | nil "::" nil nil nil nil nil nil nil nil |
| @@ -384,9 +196,7 @@ If TABLE is nil or omitted, `standard-display-table' is used." | |||
| 384 | "6a" "7a" "8a" "9a" "a%" "a." "a," "a*" ] | 196 | "6a" "7a" "8a" "9a" "a%" "a." "a," "a*" ] |
| 385 | ) | 197 | ) |
| 386 | 198 | ||
| 387 | (mule-unicode-0100-24ff ; charset | 199 | (7680 9450 ; first, last |
| 388 | 256 ; base | ||
| 389 | 7680 9450 ; first, last | ||
| 390 | [ "A-0" "a-0" "B." "b." "B-." "b-." "B_" "b_" "C,'" "c,'" ; Lat Ext Add | 200 | [ "A-0" "a-0" "B." "b." "B-." "b-." "B_" "b_" "C,'" "c,'" ; Lat Ext Add |
| 391 | "D." "d." "D-." "d-." "D_" "d_" "D," "d," "D->" "d->" | 201 | "D." "d." "D-." "d-." "D_" "d_" "D," "d," "D->" "d->" |
| 392 | "E-!" "e-!" "E-'" "e-'" "E->" "e->" "E-?" "e-?" "E,(" "e,(" | 202 | "E-!" "e-!" "E-'" "e-'" "E->" "e->" "E-?" "e-?" "E,(" "e,(" |
| @@ -568,170 +378,70 @@ If TABLE is nil or omitted, `standard-display-table' is used." | |||
| 568 | ) | 378 | ) |
| 569 | ) | 379 | ) |
| 570 | 380 | ||
| 571 | "A list of mule-unicode-* character sets and the strings that | 381 | "A list of strings that should be used to represent Unicode |
| 572 | should be used to represent the characters from each set on a DOS | 382 | characters on a DOS terminal which does not have corresponding |
| 573 | terminal which does not have corresponding glyphs built into the | 383 | glyphs built into the installed codepage.") |
| 574 | installed codepage.") | ||
| 575 | 384 | ||
| 576 | (defun IT-setup-unicode-display (&optional table) | 385 | (defun IT-setup-unicode-display (coding &optional table) |
| 577 | "Set up display table TABLE for displaying mule-unicode-* characters | 386 | "Set up display table TABLE for displaying mule-unicode-* characters |
| 578 | on a DOS terminal. If TABLE is nil or omitted, `standard-display-table' | 387 | on a DOS terminal whose codepage provides the coding-system CODING. |
| 579 | is used." | 388 | If TABLE is nil or omitted, `standard-display-table' is used." |
| 580 | (interactive) | 389 | (interactive "zCode page: ") |
| 581 | (let ((disp-tab (or table standard-display-table)) | 390 | (let ((disp-tab (or table standard-display-table)) |
| 582 | (tail IT-unicode-translations) | 391 | (tail IT-unicode-translations) |
| 583 | translation) | 392 | translation) |
| 584 | (while tail | 393 | (while tail |
| 585 | (setq translation (car tail) tail (cdr tail)) | 394 | (setq translation (car tail) tail (cdr tail)) |
| 586 | (let* ((chset (car translation)) | 395 | (let* ((first (car translation)) |
| 587 | (base (nth 1 translation)) | 396 | (last (nth 1 translation)) |
| 588 | (first (nth 2 translation)) | 397 | (table (nth 2 translation)) |
| 589 | (last (nth 3 translation)) | ||
| 590 | (table (nth 4 translation)) | ||
| 591 | (i 0) | 398 | (i 0) |
| 592 | (this (- first base)) | 399 | (this first) |
| 593 | glyph) | 400 | glyph) |
| 594 | (while (<= i (- last first)) | 401 | (while (<= i (- last first)) |
| 595 | (setq glyph (aref table i)) | 402 | (setq glyph (aref table i)) |
| 596 | (or glyph (setq glyph dos-unsupported-char-glyph)) | 403 | (when (and glyph |
| 597 | (aset disp-tab (make-char chset | 404 | (unencodable-char-position 0 1 coding nil (string this))) |
| 598 | (+ (/ this 96) 32) | 405 | (aset disp-tab this |
| 599 | (+ (% this 96) 32)) | 406 | (vconcat (if (numberp glyph) |
| 600 | (vconcat | 407 | (string glyph) |
| 601 | (if (numberp glyph) | 408 | glyph)))) |
| 602 | (char-to-string glyph) | ||
| 603 | (if (> (length glyph) 1) (concat "{" glyph "}") | ||
| 604 | glyph)))) | ||
| 605 | (setq i (1+ i) this (1+ this))))))) | 409 | (setq i (1+ i) this (1+ this))))))) |
| 606 | 410 | ||
| 607 | (defun dos-cpNNN-setup (codepage) | 411 | (defvar dos-codepage) |
| 608 | "Set up the MULE environment using the DOS codepage CODEPAGE. | ||
| 609 | |||
| 610 | This function creates the coding system cpNNN (where NNN is the value | ||
| 611 | of the argument CODEPAGE), and then uses this coding system to set up | ||
| 612 | display tables, and the language environment options as appropriate." | ||
| 613 | (let* ((cp (format "cp%s" codepage)) | ||
| 614 | (charset (cp-charset-for-codepage cp)) | ||
| 615 | (offset (cp-offset-for-codepage cp))) | ||
| 616 | (cp-make-coding-systems-for-codepage cp charset offset) | ||
| 617 | ;; This is done by set-language-environment. | ||
| 618 | ;;(setq nonascii-translation-table | ||
| 619 | ;; (symbol-value (intern (concat cp "-nonascii-translation-table")))) | ||
| 620 | (set-language-environment (cp-language-for-codepage cp)) | ||
| 621 | (set-default-coding-systems (intern (concat cp "-dos"))) | ||
| 622 | (set-selection-coding-system (intern (concat cp "-dos"))) | ||
| 623 | (set-terminal-coding-system | ||
| 624 | (setq default-terminal-coding-system (intern (concat cp | ||
| 625 | "-unix")))) | ||
| 626 | (IT-display-table-setup cp) | ||
| 627 | ;; It's time: too many input methods in leim/quail produce | ||
| 628 | ;; Unicode characters. Let the user see them. | ||
| 629 | (IT-setup-unicode-display) | ||
| 630 | (prefer-coding-system (intern (concat cp "-dos"))) | ||
| 631 | (if default-enable-multibyte-characters | ||
| 632 | ;; We want this in multibyte version only, since unibyte version | ||
| 633 | ;; should not convert non-ASCII characters at all. | ||
| 634 | (setq unibyte-display-via-language-environment t) | ||
| 635 | ;; Let the unibyte version behave as Emacs 19 did. In particular, | ||
| 636 | ;; let it use and display native codepage-specific glyphs for | ||
| 637 | ;; non-ASCII characters. For this to work correctly, we need to | ||
| 638 | ;; establish the correspondence between lower-case letters and their | ||
| 639 | ;; upper-case brethren, as appropriate for the codepage in use. The | ||
| 640 | ;; code below makes this happen. | ||
| 641 | ;; (In the multibyte mode, the appropriate tables are prepared | ||
| 642 | ;; elsewhere, since multibyte Emacs uses normal MULE character sets, | ||
| 643 | ;; which are supported on all platforms.) | ||
| 644 | (let* ((i 128) | ||
| 645 | (modify (function | ||
| 646 | (lambda (ch sy) | ||
| 647 | (modify-syntax-entry ch sy text-mode-syntax-table) | ||
| 648 | (if (boundp 'tex-mode-syntax-table) | ||
| 649 | (modify-syntax-entry ch sy tex-mode-syntax-table)) | ||
| 650 | (modify-syntax-entry ch sy (standard-syntax-table)) | ||
| 651 | ))) | ||
| 652 | (table (standard-case-table)) | ||
| 653 | ;; The following are strings of letters, first lower then | ||
| 654 | ;; upper case. This will look funny on terminals which | ||
| 655 | ;; display other code pages. In particular, what is | ||
| 656 | ;; displayed as blanks or triangles are not what they | ||
| 657 | ;; look like at all! (Use `C-x =' to see what they | ||
| 658 | ;; really are.) | ||
| 659 | (chars | ||
| 660 | (cond | ||
| 661 | ((= codepage 850) | ||
| 662 | "ķ ·ÆĮ ĩŌÓÔØŨÞĄÖâãĒāęĢéëYėíĄIĢéĪĨÐŅįč") | ||
| 663 | ((= codepage 865) | ||
| 664 | "A AEEEIIIOOUĢUY AĄIĒOĢUĪĨ") | ||
| 665 | ;; default is 437 | ||
| 666 | (t "A AEEEIIIOOUĢUY AĄIĒOĢUĪĨ")))) | ||
| 667 | |||
| 668 | (while (< i 256) | ||
| 669 | (funcall modify i "_") | ||
| 670 | (setq i (1+ i))) | ||
| 671 | |||
| 672 | (setq i 0) | ||
| 673 | (while (< i (length chars)) | ||
| 674 | (let ((ch1 (aref chars i)) | ||
| 675 | (ch2 (aref chars (1+ i)))) | ||
| 676 | (if (> ch2 127) | ||
| 677 | (set-case-syntax-pair ch2 ch1 table)) | ||
| 678 | (setq i (+ i 2)))) | ||
| 679 | (save-excursion | ||
| 680 | (mapcar (lambda (b) (set-buffer b) (set-case-table table)) | ||
| 681 | (buffer-list))) | ||
| 682 | (set-standard-case-table table))) | ||
| 683 | ;; Some codepages have sporadic support for Latin-1, Greek, and | ||
| 684 | ;; symbol glyphs, which don't belong to their native character | ||
| 685 | ;; set. It's a nuisance to have all those glyphs here, for all | ||
| 686 | ;; the codepages (for starters, I don't even have references for | ||
| 687 | ;; all the codepages). So I provide a hook for those who want to | ||
| 688 | ;; squeeze every bit of support out of their terminal/font. | ||
| 689 | (run-hooks 'dos-codepage-setup-hook) | ||
| 690 | )) | ||
| 691 | |||
| 692 | (defvar cjk-codepages-alist | ||
| 693 | '((932 "Japanese" japanese-shift-jis) | ||
| 694 | (950 "Chinese-BIG5" cn-big5) | ||
| 695 | (936 "Chinese-GB" cn-gb-2312) | ||
| 696 | (949 "Korean" euc-kr)) | ||
| 697 | "An alist of Far-Eastern codepages and the names of the associated | ||
| 698 | language and supported coding system.") | ||
| 699 | 412 | ||
| 700 | (defun dos-codepage-setup () | 413 | (defun dos-codepage-setup () |
| 701 | "Set up the MULE environment as appropriate for the installed DOS codepage. | 414 | "Set up multilingual environment for the installed DOS codepage. |
| 702 | 415 | ||
| 703 | This function sets coding systems, display tables, and the language | 416 | This function sets coding systems, display tables, and the language |
| 704 | environment options as appropriate for the current value of `dos-codepage'. | 417 | environment options as appropriate for the current value of `dos-codepage'. |
| 705 | 418 | ||
| 706 | This function is automatically run at startup via the `term-setup-hook' | 419 | This function is automatically run at startup via the `after-init-hook' |
| 707 | list. You can (and should) also run it whenever the value of | 420 | list. You can (and should) also run it whenever the value of |
| 708 | `dos-codepage' changes." | 421 | `dos-codepage' changes." |
| 709 | (interactive) | 422 | (interactive) |
| 710 | (let* ((desc (cdr (assq dos-codepage cjk-codepages-alist))) | 423 | (let* ((coding (format "cp%s" dos-codepage)) |
| 711 | (lang (car desc)) | ||
| 712 | (coding (car (cdr desc))) | ||
| 713 | coding-dos coding-unix) | 424 | coding-dos coding-unix) |
| 714 | (if (null desc) | 425 | (setq coding-dos (intern (format "%s-dos" coding)) |
| 715 | (ignore) ; (dos-cpNNN-setup dos-codepage)) FIXME | 426 | coding-unix (intern (format "%s-unix" coding))) |
| 716 | ;; We've got one of the Far-Eastern codepages which support | 427 | ;(set-language-environment lang) FIXME |
| 717 | ;; MULE native coding systems directly. | 428 | (set-default-coding-systems coding-dos) |
| 718 | (setq coding-dos (intern (format "%s-dos" coding)) | 429 | (set-selection-coding-system coding-dos) |
| 719 | coding-unix (intern (format "%s-unix" coding))) | 430 | (setq file-name-coding-system coding-unix) |
| 720 | (set-language-environment lang) | 431 | (set-terminal-coding-system |
| 721 | (set-selection-coding-system coding-dos) | 432 | (setq default-terminal-coding-system coding-unix)) |
| 722 | (setq file-name-coding-system coding-unix) | 433 | (IT-setup-unicode-display coding-unix) |
| 723 | (set-terminal-coding-system | 434 | (prefer-coding-system coding-dos) |
| 724 | (setq default-terminal-coding-system coding-unix)) | 435 | (and default-enable-multibyte-characters |
| 725 | ;; Assume they support non-ASCII Latin characters like the IBM | 436 | (setq unibyte-display-via-language-environment t)) |
| 726 | ;; codepage 437 does. | 437 | ;; Some codepages have sporadic support for Latin-1, Greek, and |
| 727 | ;(IT-display-table-setup "cp437") | 438 | ;; symbol glyphs, which don't belong to their native character |
| 728 | ;; It's time: too many input methods in leim/quail produce | 439 | ;; set. It's a nuisance to have all those glyphs here, for all |
| 729 | ;; Unicode characters. Let the user see them. | 440 | ;; the codepages (for starters, I don't even have references for |
| 730 | ;(IT-setup-unicode-display) | 441 | ;; all the codepages). So provide a hook for those who want to |
| 731 | (prefer-coding-system coding-dos) | 442 | ;; squeeze every bit of support out of their terminal/font. |
| 732 | (if default-enable-multibyte-characters | 443 | (run-hooks 'dos-codepage-setup-hook) |
| 733 | (setq unibyte-display-via-language-environment t)) | 444 | )) |
| 734 | ))) | ||
| 735 | 445 | ||
| 736 | ;; arch-tag: eea04c06-7311-4b5a-b531-3c1be1b070af | 446 | ;; arch-tag: eea04c06-7311-4b5a-b531-3c1be1b070af |
| 737 | ;;; internal.el ends here | 447 | ;;; internal.el ends here |