86fc4da55215adbcc520ffe4491c256c3ef4c435
[elisp/tm.git] / mime-setup.el
1 ;;;
2 ;;; $Id: mime-setup.el,v 5.1 1994/11/29 16:10:15 morioka Exp $
3 ;;;
4
5 (provide 'mime-setup)
6
7 (require 'tm-setup)
8
9
10 ;;; @ variables
11 ;;;
12 (defvar mime-setup-use-sc nil)
13
14
15 ;;; @ for Edit MIME mode
16 ;;;
17 (autoload 'mime-mode "mime" "Edit MIME message." t)
18 (autoload 'mime-convert-buffer "mime" "convert to MIME." t)
19
20 (autoload 'mime/encode-message-header "tiny-mime"
21           "convert message header to MIME style." t)
22
23 (autoload 'insert-signature "signature" "Insert signature" t)
24
25 (add-hook 'mime-mode-hook
26           (function
27            (lambda ()
28              (define-key (current-local-map)
29                "\C-c\C-s" (function insert-signature))
30              )))
31 (setq mime-translate-hook (function mime/encode-message-header))
32
33 (if (boundp 'MULE)
34     (progn
35       (defun mime-header-charset-chooser-for-mule-no-encode-ISO-2022-JP (begin end)
36         (let ((lclist (find-charset-region begin end)))
37           (cond ((null lclist) nil)             ;US-ASCII requres no encoding.
38                 ((memq lc-ltn1 lclist)
39                  '("ISO-8859-1" . "Q"))
40                 ((memq lc-ltn2 lclist)
41                  '("ISO-8859-2" . "Q"))
42                 ((memq lc-ltn3 lclist)
43                  '("ISO-8859-3" . "Q"))
44                 ((memq lc-ltn4 lclist)
45                  '("ISO-8859-4" . "Q"))
46                 ((memq lc-crl lclist)
47                  '("ISO-8859-5" . "Q"))
48                 ;;((memq lc-arb lclist)
49                 ;; '("ISO-8859-6" . "Q"))
50                 ((memq lc-grk lclist)
51                  '("ISO-8859-7" . "Q"))
52                 ((memq lc-hbw lclist)
53                  '("ISO-8859-8" . "Q"))
54                 ((memq lc-ltn5 lclist)
55                  '("ISO-8859-9" . "Q"))
56                 ((memq lc-jp lclist) nil)
57                 (t                              ;Unknown charset.  It must be Mule!
58                  '("ISO-2022-JP-2" . "B"))
59                 )))
60       (setq mime-header-charset-chooser
61             'mime-header-charset-chooser-for-mule-no-encode-ISO-2022-JP)
62       )
63   (progn
64     (defun mime-header-charset-chooser-for-nemacs-no-encode-ISO-2022-JP (begin end))
65     (setq mime-header-charset-chooser
66           'mime-header-charset-chooser-for-nemacs-no-encode-ISO-2022-JP)
67     ))
68
69 (setq mime-content-types
70       '(("text"
71          ;; Charset parameter need not to be specified, since it is
72          ;; defined automatically while translation.
73          ("plain"
74           ;;("charset" "" "ISO-2022-JP" "US-ASCII" "ISO-8859-1" "ISO-8859-8")
75           )
76          ("richtext"
77           ;;("charset" "" "ISO-2022-JP" "US-ASCII" "ISO-8859-1" "ISO-8859-8")
78           )
79          ("enriched"
80           ;;("charset" "" "ISO-2022-JP" "US-ASCII" "ISO-8859-1" "ISO-8859-8")
81           )
82          ("x-latex"
83           ("x-name")
84           ;;("charset" "" "ISO-2022-JP" "US-ASCII" "ISO-8859-1" "ISO-8859-8")
85           ))
86         ("message"
87          ("external-body"
88           ("access-type"
89            ("anon-ftp"
90             ("site" "wnoc-fuk.wide.ad.jp" "nic.karrn.ad.jp")
91             ("directory")
92             ("name")
93             ("mode" "binary" "ascii"))
94            ("ftp"
95             ("site")
96             ("directory")
97             ("name")
98             ("mode" "binary" "ascii"))
99            ("tftp"
100             ("site")
101             ("name"))
102            ("afs"
103             ("site")
104             ("name"))
105            ("local-file"
106             ("site")
107             ("name"))
108            ("mail-server"
109             ("server"))))
110          ("rfc822"))
111         ("application"
112          ("octet-stream"
113           ("name")
114           ("type" "" "tar" "shar")
115           ("conversions"))
116          ("postscript")
117          ("x-kiss"
118           ("x-name")
119           ("x-cnf")))
120         ("image"
121          ("gif"  ("x-name"))
122          ("jpeg" ("x-name"))
123          ("x-pic"  ("x-name"))
124          ("x-xwd")
125          ("x-xbm"))
126         ("audio"
127          ("basic"))
128         ("video"
129          ("mpeg")))
130       )
131
132 (setq mime-file-types
133       '(("\\.rtf$"      "text"  "richtext"      nil     nil)
134         ("\\.ps$"       "application"   "postscript"    nil     "quoted-printable")
135         ("\\.gif$"      "image"         "gif"   nil     "base64")
136         ("\\.jpg$"      "image"         "jpeg"  nil     "base64")
137         ("\\.xwd$"      "image"         "x-xwd" nil     "base64")
138         ("\\.xbm$"      "image"         "x-xbm" nil     "base64")
139         ("\\.PIC$"      "image"         "x-pic" nil     "base64")
140         ("\\.pic$"      "image"         "x-pic" nil     "base64")
141         ("\\.tiff$"     "image"         "tiff"  nil     "base64")
142         ("\\.au$"       "audio"         "basic" nil     "base64")
143         ("\\.mpg$"      "video"         "mpeg"  nil     "base64")
144         ("\\.el$"       "application"   "octet-stream"  nil     "7bit")
145         ("\\.signature" "text"  "plain" nil     nil)
146         (".*"   nil             nil     nil     nil))
147       )
148
149
150 ;;; @ about SuperCite
151 ;;;
152 (if mime-setup-use-sc
153     (require 'sc-setup)
154   )
155
156
157 ;;; @ for mh-e
158 ;;;
159 (add-hook 'mh-letter-mode-hook
160           (function
161            (lambda ()
162              (mime/decode-message-header)
163              (mime-mode)
164              (make-local-variable 'mail-header-separator)
165              (setq mail-header-separator "--------"))
166            ))
167
168
169 ;;; @ for GNUS
170 ;;;
171 (add-hook 'news-reply-mode-hook
172           (function
173            (lambda ()
174              (mime/decode-message-header)
175              (mime-mode)
176              )))
177 (setq gnus-signature-file nil)
178
179
180 ;;; @ for Mail mode (includes VM mode)
181 ;;;
182 (add-hook 'mail-mode-hook (function mime-mode))
183 (add-hook 'mail-setup-hook (function mime/decode-message-header))
184
185 ;;; @@ In VM, the following definitions may be requried:
186 ;;; 
187 (if (boundp 'vm-visible-headers)
188     (progn
189       (setq vm-preview-lines nil)
190       (setq vm-invisible-header-regexp nil)
191       (setq vm-visible-headers
192             (append vm-visible-headers
193                     '("Mime-Version:"
194                       "Content-Type:"
195                       "Content-Transfer-Encoding:")))
196       ))
197
198 ;;; Local Variables:
199 ;;; mode: emacs-lisp
200 ;;; mode: outline-minor
201 ;;; outline-regexp: ";;; @+\\|(......"
202 ;;; End: