1 ;;; mew-mule3.el --- Environment of Mule version 3 for Mew
3 ;; Author: Kazu Yamamoto <Kazu@Mew.org>
4 ;; Created: Mar 20, 1997
5 ;; Revised: Aug 30, 1999
9 (defconst mew-mule3-version "mew-mule3.el version 0.14")
12 (if (fboundp 'find-coding-system)
13 (fset 'mew-coding-system-p (symbol-function 'find-coding-system))
14 (fset 'mew-coding-system-p (symbol-function 'coding-system-p)))
16 ;; In the context of Mew, 'charset' means MIME charset.
17 ;; 'cs' means the internal representation of Emacs (was known as Mule).
20 ;; User CS definitions
23 ;; iso-2022-7bit-ss2 is iso-2022-jp-2
27 (copy-coding-system 'no-conversion 'mew-cs-text)
28 (copy-coding-system 'no-conversion-unix 'mew-cs-text-lf)
29 (copy-coding-system 'no-conversion-dos 'mew-cs-text-crlf)
30 (copy-coding-system 'no-conversion-mac 'mew-cs-text-cr))
32 (define-coding-system-alias 'mew-cs-text 'raw-text)
33 (define-coding-system-alias 'mew-cs-text-lf 'raw-text-unix)
34 (define-coding-system-alias 'mew-cs-text-crlf 'raw-text-dos)
35 (define-coding-system-alias 'mew-cs-text-cr 'raw-text-mac)))
37 (defvar mew-cs-dummy 'binary)
38 (defvar mew-cs-binary 'binary)
39 (defvar mew-cs-text-for-read 'mew-cs-text)
40 (defvar mew-cs-text-for-write 'mew-cs-text-lf)
41 (defvar mew-cs-autoconv 'undecided)
42 (defvar mew-cs-7bit 'iso-2022-7bit-ss2)
43 (defvar mew-cs-7bit-crlf 'iso-2022-7bit-ss2-dos)
44 (defvar mew-cs-mime-trans 'iso-2022-7bit-ss2)
45 (defvar mew-cs-rfc822-trans 'iso-2022-7bit-ss2)
46 (defvar mew-cs-draft 'iso-2022-7bit-ss2)
47 (defvar mew-cs-scan 'ctext)
48 (defvar mew-cs-infile 'undecided) ;; guess in +draft
49 (defvar mew-cs-outfile 'iso-2022-7bit-ss2)
50 (defvar mew-cs-virtual (if (mew-coding-system-p 'ctext-unix)
51 'ctext-unix 'ctext)) ;; ^M as it is
52 (defvar mew-cs-pick 'euc-jp)
54 (defvar mew-cs-database
55 '(("us-ascii" (ascii) nil "7bit"
57 ("iso-8859-1" (ascii latin-iso8859-1) iso-8859-1 "quoted-printable"
59 ("iso-8859-2" (ascii latin-iso8859-2) iso-8859-2 "quoted-printable"
61 ("iso-8859-3" (ascii latin-iso8859-3) iso-8859-3 "quoted-printable"
63 ("iso-8859-4" (ascii latin-iso8859-4) iso-8859-4 "quoted-printable"
65 ("koi8-r" (ascii cyrillic-iso8859-5) koi8-r "quoted-printable"
67 ("iso-8859-6" (ascii arabic-iso8859-6) iso-8859-6 "base64"
69 ("iso-8859-7" (ascii greek-iso8859-7) iso-8859-7 "base64"
71 ("iso-8859-8" (ascii hebrew-iso8859-8) iso-8859-8 "base64"
73 ("iso-8859-9" (ascii latin-iso8859-9) iso-8859-9 "quoted-printable"
75 ("tis-620" (ascii thai-tis620) tis620 "base64"
78 (ascii latin-jisx0201 japanese-jisx0208 japanese-jisx0208-1978)
81 ("euc-kr" (ascii korean-ksc5601) euc-kr "base64"
83 ("iso-2022-kr" (ascii korean-ksc5601) iso-2022-kr "7bit"
85 ("gb2312" (ascii chinese-gb2312) cn-gb-2312 "base64"
87 ("hz-gb-2312" (ascii chinese-gb2312) hz-gb-2312 "7bit"
89 ("big5" (ascii chinese-big5-1 chinese-big5-2)
94 latin-jisx0201 japanese-jisx0208 japanese-jisx0208-1978 japanese-jisx0212
95 chinese-gb2312 korean-ksc5601 latin-iso8859-1 greek-iso8859-7)
96 iso-2022-7bit-ss2 "7bit"
97 iso-2022-7bit-ss2 "B")
98 ;; charset-to-cs purpose only
99 ("euc-jp" nil euc-japan)
100 ("shift_jis" nil shift_jis)
101 ("cn-gb" nil cn-gb-2312) ;; the same as gb2312 above
102 ("cn-big5" nil chinese-big5) ;; the same as big5 above
103 ("iso-2022-cn" nil iso-2022-cn)
104 ("iso-2022-cn-ext" nil iso-2022-cn-ext)
105 ("iso-2022-int-1" nil iso-2022-int-1)
109 ;; Leading characters
112 (defvar mew-lc-ascii 'ascii)
113 (defvar mew-lc-jp 'japanese-jisx0208)
114 (defvar mew-lc-kana 'katakana-jisx0201)
115 (defalias 'mew-make-char 'make-char)
116 (defalias 'mew-char-charset 'char-charset)
122 (defalias 'mew-find-cs-region 'find-charset-region)
125 (defun mew-cs-decode-region (beg end cs)
126 (if cs (decode-coding-region beg end cs)))
129 (defun mew-cs-encode-region (beg end cs)
130 (if cs (encode-coding-region beg end cs)))
133 (defun mew-cs-decode-string (str cs)
134 (if cs (decode-coding-string str cs) str))
137 (defun mew-cs-encode-string (str cs)
138 (if cs (encode-coding-string str cs) str))
141 ;; Process environment
144 (defun mew-set-process-cs (process read write)
145 (set-process-coding-system process read write))
147 (defmacro mew-plet (&rest body)
148 `(let ((call-process-hook nil)
149 (coding-system-for-read 'binary)
150 (coding-system-for-write 'binary))
153 (defmacro mew-piolet (read write &rest body)
154 `(let ((call-process-hook nil)
155 (coding-system-for-read ,read)
156 (coding-system-for-write ,write))
159 (defmacro mew-pioalet (read write arg &rest body)
160 `(let ((call-process-hook nil)
161 (coding-system-for-read ,read)
162 (coding-system-for-write ,write)
163 (file-name-coding-system ,arg))
166 (defmacro mew-flet (&rest body)
167 `(let ((coding-system-for-read 'binary)
168 (coding-system-for-write 'binary)
169 jam-zcat-filename-list
170 jka-compr-compression-info-list)
173 (defmacro mew-frwlet (read write &rest body)
174 `(let ((coding-system-for-read ,read)
175 (coding-system-for-write ,write)
176 jam-zcat-filename-list
177 jka-compr-compression-info-list)
184 (defun mew-cs-post-conv (cs) ()) ;; not necessary because internally applied
191 ((and mew-temacs-p (string< emacs-version "20.2.90"))
192 (fset 'mew-aref (symbol-function 'sref))
193 (fset 'mew-charlen (symbol-function 'char-bytes)))
195 (fset 'mew-aref (symbol-function 'aref))
196 (defmacro mew-charlen (c) (` 1)))
206 ;;; Copyright Notice:
208 ;; Copyright (C) 1997, 1998, 1999 Mew developing team.
209 ;; All rights reserved.
211 ;; Redistribution and use in source and binary forms, with or without
212 ;; modification, are permitted provided that the following conditions
215 ;; 1. Redistributions of source code must retain the above copyright
216 ;; notice, this list of conditions and the following disclaimer.
217 ;; 2. Redistributions in binary form must reproduce the above copyright
218 ;; notice, this list of conditions and the following disclaimer in the
219 ;; documentation and/or other materials provided with the distribution.
220 ;; 3. Neither the name of the team nor the names of its contributors
221 ;; may be used to endorse or promote products derived from this software
222 ;; without specific prior written permission.
224 ;; THIS SOFTWARE IS PROVIDED BY THE TEAM AND CONTRIBUTORS ``AS IS'' AND
225 ;; ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
226 ;; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
227 ;; PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE TEAM OR CONTRIBUTORS BE
228 ;; LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
229 ;; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
230 ;; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
231 ;; BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
232 ;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
233 ;; OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
234 ;; IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
236 ;;; mew-mule3.el ends here