diff options
| author | Eli Zaretskii | 1999-04-05 14:59:21 +0000 |
|---|---|---|
| committer | Eli Zaretskii | 1999-04-05 14:59:21 +0000 |
| commit | 08baac3d70ea5f60ff7c39c526a42b147cf67c9f (patch) | |
| tree | ec9814fa6e43c10921a5049dd2e10e619abdb4f5 | |
| parent | 7c4117803346b6d3eb9512196d0dabd01c4caab6 (diff) | |
| download | emacs-08baac3d70ea5f60ff7c39c526a42b147cf67c9f.tar.gz emacs-08baac3d70ea5f60ff7c39c526a42b147cf67c9f.zip | |
(dos-cpNNN-setup): New function, with the guts
of dos-codepage-setup.
(cjk-codepages-alist): New variable, an alist of Far-Eastern
codepages for which there's no need to set up cpNNN coding
systems.
(dos-codepage-setup): Support Far-Eastern DOS terminals.
| -rw-r--r-- | lisp/term/internal.el | 61 |
1 files changed, 49 insertions, 12 deletions
diff --git a/lisp/term/internal.el b/lisp/term/internal.el index 30b0d3d0b7f..c0ec236db4e 100644 --- a/lisp/term/internal.el +++ b/lisp/term/internal.el | |||
| @@ -249,17 +249,13 @@ If TABLE is nil or omitted, `standard-display-table' is used." | |||
| 249 | ;; to the ASCII apostrophe. | 249 | ;; to the ASCII apostrophe. |
| 250 | (aset standard-display-table 146 [39]))) | 250 | (aset standard-display-table 146 [39]))) |
| 251 | 251 | ||
| 252 | (defun dos-codepage-setup () | 252 | (defun dos-cpNNN-setup (codepage) |
| 253 | "Set up the MULE environment as appropriate for the installed DOS codepage. | 253 | "Set up the MULE environment using the DOS codepage CODEPAGE. |
| 254 | |||
| 255 | This function sets coding systems, display tables, and the language | ||
| 256 | environment options as appropriate for the current value of `dos-codepage'. | ||
| 257 | 254 | ||
| 258 | This function is automatically run at startup via the `term-setup-hook' | 255 | This function creates the coding system cpNNN (where NNN is the value |
| 259 | list. You can (and should) also run it whenever the value of | 256 | of the argument CODEPAGE), and then uses this coding system to set up |
| 260 | `dos-codepage' changes." | 257 | display tables, and the language environment options as appropriate." |
| 261 | (interactive) | 258 | (let* ((cp (format "cp%s" codepage)) |
| 262 | (let* ((cp (format "cp%s" dos-codepage)) | ||
| 263 | (charset (cp-charset-for-codepage cp)) | 259 | (charset (cp-charset-for-codepage cp)) |
| 264 | (offset (cp-offset-for-codepage cp))) | 260 | (offset (cp-offset-for-codepage cp))) |
| 265 | (cp-make-coding-systems-for-codepage cp charset offset) | 261 | (cp-make-coding-systems-for-codepage cp charset offset) |
| @@ -304,9 +300,9 @@ list. You can (and should) also run it whenever the value of | |||
| 304 | ;; really are.) | 300 | ;; really are.) |
| 305 | (chars | 301 | (chars |
| 306 | (cond | 302 | (cond |
| 307 | ((= dos-codepage 850) | 303 | ((= codepage 850) |
| 308 | "ķ ·ÆĮ ĩŌÓÔØŨÞĄÖâãĒāęĢéëYėíĄIĢéĪĨÐŅįč") | 304 | "ķ ·ÆĮ ĩŌÓÔØŨÞĄÖâãĒāęĢéëYėíĄIĢéĪĨÐŅįč") |
| 309 | ((= dos-codepage 865) | 305 | ((= codepage 865) |
| 310 | "A AEEEIIIOOUĢUY AĄIĒOĢUĪĨ") | 306 | "A AEEEIIIOOUĢUY AĄIĒOĢUĪĨ") |
| 311 | ;; default is 437 | 307 | ;; default is 437 |
| 312 | (t "A AEEEIIIOOUĢUY AĄIĒOĢUĪĨ")))) | 308 | (t "A AEEEIIIOOUĢUY AĄIĒOĢUĪĨ")))) |
| @@ -335,6 +331,47 @@ list. You can (and should) also run it whenever the value of | |||
| 335 | (run-hooks 'dos-codepage-setup-hook) | 331 | (run-hooks 'dos-codepage-setup-hook) |
| 336 | )) | 332 | )) |
| 337 | 333 | ||
| 334 | ;; FIXME: Korean and Chinese codepages should be added here, but I | ||
| 335 | ;; don't know what coding systems do they support. The codepages in | ||
| 336 | ;; point are 934, 936, 938, 944, and 948. | ||
| 337 | (defvar cjk-codepages-alist | ||
| 338 | '((932 "Japanese" japanese-shift-jis)) | ||
| 339 | "An alist of Far-Eastern codepages and the names of the associated | ||
| 340 | language and supported coding system.") | ||
| 341 | |||
| 342 | (defun dos-codepage-setup () | ||
| 343 | "Set up the MULE environment as appropriate for the installed DOS codepage. | ||
| 344 | |||
| 345 | This function sets coding systems, display tables, and the language | ||
| 346 | environment options as appropriate for the current value of `dos-codepage'. | ||
| 347 | |||
| 348 | This function is automatically run at startup via the `term-setup-hook' | ||
| 349 | list. You can (and should) also run it whenever the value of | ||
| 350 | `dos-codepage' changes." | ||
| 351 | (interactive) | ||
| 352 | (let* ((desc (cdr (assq dos-codepage cjk-codepages-alist))) | ||
| 353 | (lang (car desc)) | ||
| 354 | (coding (car (cdr desc))) | ||
| 355 | coding-dos coding-unix) | ||
| 356 | (if (null desc) | ||
| 357 | (dos-cpNNN-setup dos-codepage) | ||
| 358 | ;; We've got one of the Far-Eastern codepages which support | ||
| 359 | ;; MULE native coding systems directly. | ||
| 360 | (setq coding-dos (intern (format "%s-dos" coding)) | ||
| 361 | coding-unix (intern (format "%s-unix" coding))) | ||
| 362 | (set-language-environment (car desc)) | ||
| 363 | (set-selection-coding-system coding-dos) | ||
| 364 | (setq file-name-coding-system coding-unix) | ||
| 365 | (set-terminal-coding-system | ||
| 366 | (setq default-terminal-coding-system coding-unix)) | ||
| 367 | ;; Assume they support non-ASCII Latin characters like the IBM | ||
| 368 | ;; codepage 437 does. | ||
| 369 | (IT-display-table-setup "cp437") | ||
| 370 | (prefer-coding-system coding-dos) | ||
| 371 | (if default-enable-multibyte-characters | ||
| 372 | (setq unibyte-display-via-language-environment t)) | ||
| 373 | ))) | ||
| 374 | |||
| 338 | ;; We want to delay the terminal and other codepage-related setup | 375 | ;; We want to delay the terminal and other codepage-related setup |
| 339 | ;; until after the terminal is set and user's .emacs is processed, | 376 | ;; until after the terminal is set and user's .emacs is processed, |
| 340 | ;; because people might define their `dos-codepage-setup-hook' there. | 377 | ;; because people might define their `dos-codepage-setup-hook' there. |