Initial Commit
[packages] / mule-packages / mule-ucs / lisp / jisx0213 / x0213-mime.el
1 ;;; x0213-mime.el --- MIME configurations of JIS X 0213:2000
2 ;;;                   for FLIM/APEL/SEMI.
3
4 ;; Copyright (C) 2000 Miyashita Hisashi
5
6 ;; Keywords: mule, multilingual, character set,
7 ;;           internet messsage, APEL, FLIM, SEMI, JIS X 0213
8
9 ;; This file is free software; you can redistribute it and/or modify
10 ;; it under the terms of the GNU General Public License as published by
11 ;; the Free Software Foundation; either version 2 of the License, or
12 ;; (at your option) any later version.
13 ;;
14 ;; This program is distributed in the hope that it will be useful,
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 ;; GNU General Public License for more details.
18 ;;
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with this program; if not, write to the Free Software
21 ;; Foundation, Inc., 59 Temple Place - Suite 330,
22 ;; Boston, MA 02111-1307, USA.
23
24 (defvar coding-system-for-mime-charset-iso-2022-jp-3
25   ;; 'iso-2022-jp-3
26   ;; 'iso-2022-jp-3-compatible
27   'iso-2022-jp-3-strict
28   "* coding system used for MIME charset `ISO-2022-JP-3'.
29 APEL will use this coding system for encoding or decoding
30 `ISO-2022-JP-3'.")
31
32 (defun setup-iso-2022-jp-3-mcharset-environment ()
33   (if (and (boundp 'mime-charset-coding-system-alist)
34            (null (assq 'iso-2022-jp-3
35                        mime-charset-coding-system-alist)))
36       (setq mime-charset-coding-system-alist
37             (cons
38              (cons 'iso-2022-jp-3
39                    (if (coding-system-p
40                         coding-system-for-mime-charset-iso-2022-jp-3)
41                        coding-system-for-mime-charset-iso-2022-jp-3
42                      (message 
43                       "*Warning* Cannot find %S coding-system!"
44                       coding-system-for-mime-charset-iso-2022-jp-3)
45                      'iso-2022-jp-3))
46              mime-charset-coding-system-alist)))
47   (let ((slot
48          '((ascii japanese-jisx0208
49                   japanese-jisx0213-1
50                   japanese-jisx0213-2) . iso-2022-jp-3)))
51     (if (and (boundp 'charsets-mime-charset-alist)
52              (not (member slot charsets-mime-charset-alist)))
53         (setq charsets-mime-charset-alist
54               (append charsets-mime-charset-alist (list slot))))))
55
56 (defun setup-iso-2022-jp-3-eword-environment ()
57   (if (and (boundp 'eword-charset-encoding-alist)
58            (not (assq 'iso-2022-jp-3
59                       eword-charset-encoding-alist)))
60       (setq eword-charset-encoding-alist
61             (cons '(iso-2022-jp-3 . "B")
62                   eword-charset-encoding-alist))))
63
64 (defun setup-iso-2022-jp-3-mime-edit-environment ()
65   (if (and (boundp 'mime-charset-type-list)
66            (not (assq 'iso-2022-jp-3
67                       mime-charset-type-list)))
68       (setq mime-charset-type-list 
69             (cons '(iso-2022-jp-3 7 "base64")
70                   mime-charset-type-list))))
71
72 (eval-after-load
73     "mcharset" '(setup-iso-2022-jp-3-mcharset-environment))
74
75 (eval-after-load
76     "eword-encode" '(setup-iso-2022-jp-3-eword-environment))
77
78 (add-hook
79  'mime-edit-load-hook
80  (function setup-iso-2022-jp-3-mime-edit-environment))
81
82 (provide 'x0213-mime)