Mercurial > emacs
comparison lisp/international/codepage.el @ 88155:d7ddb3e565de
sync with trunk
author | Henrik Enberg <henrik.enberg@telia.com> |
---|---|
date | Mon, 16 Jan 2006 00:03:54 +0000 |
parents | 0d8b17d428b5 |
children |
comparison
equal
deleted
inserted
replaced
88154:8ce476d3ba36 | 88155:d7ddb3e565de |
---|---|
1 ;;; codepage.el --- MS-DOS/MS-Windows specific coding systems | 1 ;;; codepage.el --- MS-DOS/MS-Windows specific coding systems |
2 | 2 |
3 ;; Copyright (C) 1998 Free Software Foundation, Inc. | 3 ;; Copyright (C) 1998, 1999, 2000, 2002 Free Software Foundation, Inc. |
4 ;; Copyright (C) 2000 | |
5 ;; National Institute of Advanced Industrial Science and Technology (AIST) | |
6 ;; Registration Number H14PRO021 | |
4 | 7 |
5 ;; Author: Eli Zaretskii | 8 ;; Author: Eli Zaretskii |
6 ;; Maintainer: FSF | 9 ;; Maintainer: FSF |
7 ;; Keywords: i18n ms-dos ms-windows codepage | 10 ;; Keywords: i18n ms-dos ms-windows codepage |
8 | 11 |
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 21 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
19 ;; GNU General Public License for more details. | 22 ;; GNU General Public License for more details. |
20 | 23 |
21 ;; You should have received a copy of the GNU General Public License | 24 ;; You should have received a copy of the GNU General Public License |
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the | 25 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
23 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 26 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
24 ;; Boston, MA 02111-1307, USA. | 27 ;; Boston, MA 02110-1301, USA. |
25 | 28 |
26 ;;; Commentary: | 29 ;;; Commentary: |
27 | 30 |
28 ;; Special coding systems for DOS/Windows codepage support. | 31 ;; Special coding systems for DOS/Windows codepage support. |
29 ;; | 32 ;; |
38 ;; | 41 ;; |
39 ;; Thanks to Ken'ichi Handa <handa@etl.go.jp> for writing the CCL | 42 ;; Thanks to Ken'ichi Handa <handa@etl.go.jp> for writing the CCL |
40 ;; encoders/decoders, and for help in debugging this code. | 43 ;; encoders/decoders, and for help in debugging this code. |
41 | 44 |
42 ;;; Code: | 45 ;;; Code: |
46 | |
47 (defvar dos-unsupported-char-glyph) | |
43 | 48 |
44 (defun cp-coding-system-for-codepage-1 (coding mnemonic iso-name | 49 (defun cp-coding-system-for-codepage-1 (coding mnemonic iso-name |
45 decoder encoder) | 50 decoder encoder) |
46 "Make coding system CODING for a DOS codepage using translation tables. | 51 "Make coding system CODING for a DOS codepage using translation tables. |
47 MNEMONIC is a character to be displayed on mode line for the coding system. | 52 MNEMONIC is a character to be displayed on mode line for the coding system. |
655 characters used by the IBM codepages, typically in conjunction with files | 660 characters used by the IBM codepages, typically in conjunction with files |
656 read/written by MS-DOS software, or for display on the MS-DOS terminal." | 661 read/written by MS-DOS software, or for display on the MS-DOS terminal." |
657 (interactive | 662 (interactive |
658 (let ((completion-ignore-case t) | 663 (let ((completion-ignore-case t) |
659 (candidates (cp-supported-codepages))) | 664 (candidates (cp-supported-codepages))) |
660 (list (completing-read "Setup DOS Codepage: (default 437) " candidates | 665 (list (completing-read "Setup DOS Codepage (default 437): " candidates |
661 nil t nil nil "437")))) | 666 nil t nil nil "437")))) |
662 (let* ((cp (format "cp%s" codepage)) | 667 (let* ((cp (format "cp%s" codepage)) |
663 (cp-defined (intern-soft cp))) | 668 (cp-defined (intern-soft cp))) |
664 (or (and cp-defined ;; avoid defining if already defined | 669 (or (and cp-defined ;; avoid defining if already defined |
665 (coding-system-p cp-defined)) | 670 (coding-system-p cp-defined)) |
666 (cp-make-coding-systems-for-codepage | 671 (cp-make-coding-systems-for-codepage |
667 cp (cp-charset-for-codepage cp) (cp-offset-for-codepage cp))))) | 672 cp (cp-charset-for-codepage cp) (cp-offset-for-codepage cp))))) |
668 | 673 |
674 ;; Add DOS codepages to `non-iso-charset-alist'. | |
675 (eval-after-load "mule-diag" | |
676 '(let ((tail (cp-supported-codepages)) | |
677 elt) | |
678 (while tail | |
679 (setq elt (car tail) tail (cdr tail)) | |
680 ;; Now ELT is (CODEPAGE . CHARSET), where CODEPAGE is a string | |
681 ;; (e.g. "850"), CHARSET is a charset that characters in CODEPAGE | |
682 ;; are mapped to. | |
683 (unless (assq (intern (concat "cp" (car elt))) non-iso-charset-alist) | |
684 (setq non-iso-charset-alist | |
685 (cons (list (intern (concat "cp" (car elt))) | |
686 (list 'ascii (cdr elt)) | |
687 `(lambda (code) | |
688 (decode-codepage-char ,(string-to-int (car elt)) | |
689 code)) | |
690 (list (list 0 255))) | |
691 non-iso-charset-alist)))))) | |
692 | |
669 (provide 'codepage) | 693 (provide 'codepage) |
670 | 694 |
695 ;;; arch-tag: 80328de8-b94e-4386-be26-5876105731f0 | |
671 ;;; codepage.el ends here | 696 ;;; codepage.el ends here |