1 ;;; emu-x20.el --- emu API implementation for XEmacs with mule
3 ;; Copyright (C) 1994,1995,1996,1997 MORIOKA Tomohiko
5 ;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
6 ;; Version: $Id: emu-x20.el,v 7.69 1998/01/10 18:00:57 morioka Exp $
7 ;; Keywords: emulation, compatibility, Mule, XEmacs
9 ;; This file is part of XEmacs.
11 ;; XEmacs is free software; you can redistribute it and/or modify it
12 ;; under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation; either version 2, or (at your option)
16 ;; XEmacs is distributed in the hope that it will be useful, but
17 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 ;; General Public License for more details.
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with XEmacs; see the file COPYING. If not, write to the Free
23 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
28 ;; This module requires XEmacs 20.3-b5 or later with mule.
36 (and (coding-system-property 'iso-2022-jp 'input-charset-conversion)
37 (copy-coding-system 'iso-2022-7bit 'iso-2022-jp))
43 (defsubst encode-mime-charset-region (start end charset)
44 "Encode the text between START and END as MIME CHARSET."
45 (let ((cs (mime-charset-to-coding-system charset)))
47 (encode-coding-region start end cs)
50 (defsubst decode-mime-charset-region (start end charset)
51 "Decode the text between START and END as MIME CHARSET."
52 (let ((cs (mime-charset-to-coding-system charset)))
54 (decode-coding-region start end cs)
57 (defsubst encode-mime-charset-string (string charset)
58 "Encode the STRING as MIME CHARSET."
59 (let ((cs (mime-charset-to-coding-system charset)))
61 (encode-coding-string string cs)
64 (defsubst decode-mime-charset-string (string charset)
65 "Decode the STRING as MIME CHARSET."
66 (let ((cs (mime-charset-to-coding-system charset)))
68 (decode-coding-string string cs)
72 (defvar charsets-mime-charset-alist
73 '(((ascii) . us-ascii)
74 ((ascii latin-iso8859-1) . iso-8859-1)
75 ((ascii latin-iso8859-2) . iso-8859-2)
76 ((ascii latin-iso8859-3) . iso-8859-3)
77 ((ascii latin-iso8859-4) . iso-8859-4)
78 ((ascii cyrillic-iso8859-5) . iso-8859-5)
79 ;;; ((ascii cyrillic-iso8859-5) . koi8-r)
80 ((ascii arabic-iso8859-6) . iso-8859-6)
81 ((ascii greek-iso8859-7) . iso-8859-7)
82 ((ascii hebrew-iso8859-8) . iso-8859-8)
83 ((ascii latin-iso8859-9) . iso-8859-9)
84 ((ascii latin-jisx0201
85 japanese-jisx0208-1978 japanese-jisx0208) . iso-2022-jp)
86 ((ascii korean-ksc5601) . euc-kr)
87 ((ascii chinese-gb2312) . cn-gb-2312)
88 ((ascii chinese-big5-1 chinese-big5-2) . cn-big5)
89 ((ascii latin-iso8859-1 greek-iso8859-7
90 latin-jisx0201 japanese-jisx0208-1978
91 chinese-gb2312 japanese-jisx0208
92 korean-ksc5601 japanese-jisx0212) . iso-2022-jp-2)
93 ((ascii latin-iso8859-1 greek-iso8859-7
94 latin-jisx0201 japanese-jisx0208-1978
95 chinese-gb2312 japanese-jisx0208
96 korean-ksc5601 japanese-jisx0212
97 chinese-cns11643-1 chinese-cns11643-2) . iso-2022-int-1)
98 ((ascii latin-iso8859-1 latin-iso8859-2
99 cyrillic-iso8859-5 greek-iso8859-7
100 latin-jisx0201 japanese-jisx0208-1978
101 chinese-gb2312 japanese-jisx0208
102 korean-ksc5601 japanese-jisx0212
103 chinese-cns11643-1 chinese-cns11643-2
104 chinese-cns11643-3 chinese-cns11643-4
105 chinese-cns11643-5 chinese-cns11643-6
106 chinese-cns11643-7) . iso-2022-int-1)
109 (defun detect-mime-charset-region (start end)
110 "Return MIME charset for region between START and END."
111 (charsets-to-mime-charset (charsets-in-region start end)))
117 ;;; @@ Mule emulating aliases
119 ;;; You should not use them.
121 (defalias 'char-leading-char 'char-charset)
123 (defun char-category (character)
124 "Return string of category mnemonics for CHAR in TABLE.
125 CHAR can be any multilingual character
126 TABLE defaults to the current buffer's category table."
127 (mapconcat (lambda (chr)
128 (char-to-string (int-char chr))
130 (char-category-list character)
137 (defun string-to-int-list (str)
138 (mapcar #'char-int str)
147 ;;; emu-x20.el ends here