1 ;;; emu-x20.el --- emu API implementation for XEmacs with mule
3 ;; Copyright (C) 1994,1995,1996,1997,1998 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 emu.
11 ;; This program is free software; you can redistribute it and/or
12 ;; modify it under the terms of the GNU General Public License as
13 ;; published by the Free Software Foundation; either version 2, or (at
14 ;; your option) any later version.
16 ;; This program 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 GNU Emacs; see the file COPYING. If not, write to the
23 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
24 ;; Boston, MA 02111-1307, USA.
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 (defun insert-binary-file-contents (filename &optional visit beg end replace)
44 "Like `insert-file-contents', q.v., but don't code and format conversion."
45 (let ((coding-system-for-read 'binary)
47 (insert-file-contents filename visit beg end replace)
54 (defsubst encode-mime-charset-region (start end charset)
55 "Encode the text between START and END as MIME CHARSET."
56 (let ((cs (mime-charset-to-coding-system charset)))
58 (encode-coding-region start end cs)
61 (defsubst decode-mime-charset-region (start end charset)
62 "Decode the text between START and END as MIME CHARSET."
63 (let ((cs (mime-charset-to-coding-system charset)))
65 (decode-coding-region start end cs)
68 (defsubst encode-mime-charset-string (string charset)
69 "Encode the STRING as MIME CHARSET."
70 (let ((cs (mime-charset-to-coding-system charset)))
72 (encode-coding-string string cs)
75 (defsubst decode-mime-charset-string (string charset)
76 "Decode the STRING as MIME CHARSET."
77 (let ((cs (mime-charset-to-coding-system charset)))
79 (decode-coding-string string cs)
83 (defvar charsets-mime-charset-alist
84 '(((ascii) . us-ascii)
85 ((ascii latin-iso8859-1) . iso-8859-1)
86 ((ascii latin-iso8859-2) . iso-8859-2)
87 ((ascii latin-iso8859-3) . iso-8859-3)
88 ((ascii latin-iso8859-4) . iso-8859-4)
89 ((ascii cyrillic-iso8859-5) . iso-8859-5)
90 ;;; ((ascii cyrillic-iso8859-5) . koi8-r)
91 ((ascii arabic-iso8859-6) . iso-8859-6)
92 ((ascii greek-iso8859-7) . iso-8859-7)
93 ((ascii hebrew-iso8859-8) . iso-8859-8)
94 ((ascii latin-iso8859-9) . iso-8859-9)
95 ((ascii latin-jisx0201
96 japanese-jisx0208-1978 japanese-jisx0208) . iso-2022-jp)
97 ((ascii korean-ksc5601) . euc-kr)
98 ((ascii chinese-gb2312) . cn-gb-2312)
99 ((ascii chinese-big5-1 chinese-big5-2) . cn-big5)
100 ((ascii latin-iso8859-1 greek-iso8859-7
101 latin-jisx0201 japanese-jisx0208-1978
102 chinese-gb2312 japanese-jisx0208
103 korean-ksc5601 japanese-jisx0212) . iso-2022-jp-2)
104 ((ascii latin-iso8859-1 greek-iso8859-7
105 latin-jisx0201 japanese-jisx0208-1978
106 chinese-gb2312 japanese-jisx0208
107 korean-ksc5601 japanese-jisx0212
108 chinese-cns11643-1 chinese-cns11643-2) . iso-2022-int-1)
109 ((ascii latin-iso8859-1 latin-iso8859-2
110 cyrillic-iso8859-5 greek-iso8859-7
111 latin-jisx0201 japanese-jisx0208-1978
112 chinese-gb2312 japanese-jisx0208
113 korean-ksc5601 japanese-jisx0212
114 chinese-cns11643-1 chinese-cns11643-2
115 chinese-cns11643-3 chinese-cns11643-4
116 chinese-cns11643-5 chinese-cns11643-6
117 chinese-cns11643-7) . iso-2022-int-1)
120 (defun detect-mime-charset-region (start end)
121 "Return MIME charset for region between START and END."
122 (charsets-to-mime-charset (charsets-in-region start end)))
128 ;;; @@ Mule emulating aliases
130 ;;; You should not use them.
132 (defalias 'char-leading-char 'char-charset)
134 (defun char-category (character)
135 "Return string of category mnemonics for CHAR in TABLE.
136 CHAR can be any multilingual character
137 TABLE defaults to the current buffer's category table."
138 (mapconcat (lambda (chr)
139 (char-to-string (int-char chr))
141 (char-category-list character)
148 (defun string-to-int-list (str)
149 (mapcar #'char-int str)
158 ;;; emu-x20.el ends here