Mercurial > emacs
comparison lisp/term/internal.el @ 24563:c2f09365ec12
(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.
author | Eli Zaretskii <eliz@gnu.org> |
---|---|
date | Mon, 05 Apr 1999 14:59:21 +0000 |
parents | 7a5f7af21c27 |
children | 87e4cdfac07b |
comparison
equal
deleted
inserted
replaced
24562:9bd33c9d9a4e | 24563:c2f09365ec12 |
---|---|
247 ;; Most Windows programs send out apostrophe's as \222. Most DOS | 247 ;; Most Windows programs send out apostrophe's as \222. Most DOS |
248 ;; fonts contain a different character at that position. Map it | 248 ;; fonts contain a different character at that position. Map it |
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 | 254 |
255 This function sets coding systems, display tables, and the language | 255 This function creates the coding system cpNNN (where NNN is the value |
256 environment options as appropriate for the current value of `dos-codepage'. | 256 of the argument CODEPAGE), and then uses this coding system to set up |
257 | 257 display tables, and the language environment options as appropriate." |
258 This function is automatically run at startup via the `term-setup-hook' | 258 (let* ((cp (format "cp%s" codepage)) |
259 list. You can (and should) also run it whenever the value of | |
260 `dos-codepage' changes." | |
261 (interactive) | |
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) |
266 ;; This is done by set-language-environment. | 262 ;; This is done by set-language-environment. |
267 ;;(setq nonascii-translation-table | 263 ;;(setq nonascii-translation-table |
302 ;; displayed as blanks or triangles are not what they | 298 ;; displayed as blanks or triangles are not what they |
303 ;; look lile at all! (Use `C-x =' to see what they | 299 ;; look lile at all! (Use `C-x =' to see what they |
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ĪĨ")))) |
313 | 309 |
314 (while (< i 256) | 310 (while (< i 256) |
333 ;; all the codepages). So I provide a hook for those who want to | 329 ;; all the codepages). So I provide a hook for those who want to |
334 ;; squeeze every bit of support out of their terminal/font. | 330 ;; squeeze every bit of support out of their terminal/font. |
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. |
341 (add-hook 'term-setup-hook 'dos-codepage-setup) | 378 (add-hook 'term-setup-hook 'dos-codepage-setup) |
342 | 379 |