9a56c808fde8531a87ed747186ab8be39fc4d795
[elisp/tm.git] / mime-setup.el
1 ;;;
2 ;;; mime-setup: setup file to use tm and mime.el.
3 ;;;
4 ;;; $Id: mime-setup.el,v 6.2 1995/09/06 10:07:26 morioka Exp $
5 ;;;
6
7 (require 'tm-setup)
8
9
10 ;;; @ variables
11 ;;;
12
13 (defvar mime-setup-use-sc nil)
14 (defvar mime-setup-use-signature t)
15 (defvar mime-setup-signature-key "\C-c\C-s")
16
17
18 ;;; @ for Edit MIME mode
19 ;;;
20
21 (autoload 'mime-mode "mime" "Edit MIME message." t)
22 (autoload 'mime-convert-buffer "mime" "convert to MIME." t)
23
24 (setq mime-content-types
25       '(("text"
26          ;; Charset parameter need not to be specified, since it is
27          ;; defined automatically while translation.
28          ("plain"
29           ;;("charset" "" "ISO-2022-JP" "US-ASCII" "ISO-8859-1" "ISO-8859-8")
30           )
31          ("richtext"
32           ;;("charset" "" "ISO-2022-JP" "US-ASCII" "ISO-8859-1" "ISO-8859-8")
33           )
34          ("enriched"
35           ;;("charset" "" "ISO-2022-JP" "US-ASCII" "ISO-8859-1" "ISO-8859-8")
36           )
37          ("x-latex"
38           ("x-name")
39           ;;("charset" "" "ISO-2022-JP" "US-ASCII" "ISO-8859-1" "ISO-8859-8")
40           )
41          ("html"
42           ("x-name")
43           ;;("charset" "" "ISO-2022-JP" "US-ASCII" "ISO-8859-1" "ISO-8859-8")
44           ))
45         ("message"
46          ("external-body"
47           ("access-type"
48            ("anon-ftp"
49             ("site" "ftp.jaist.ac.jp" "wnoc-fuk.wide.ad.jp" "nic.karrn.ad.jp")
50             ("directory" "/pub/GNU/elisp/mime")
51             ("name")
52             ("mode" "binary" "ascii"))
53            ("ftp"
54             ("site")
55             ("directory")
56             ("name")
57             ("mode" "binary" "ascii"))
58            ("tftp"
59             ("site")
60             ("name"))
61            ("afs"
62             ("site")
63             ("name"))
64            ("local-file"
65             ("site")
66             ("name"))
67            ("mail-server"
68             ("server"))))
69          ("rfc822"))
70         ("application"
71          ("octet-stream"
72           ("name")
73           ("type" "" "tar" "shar")
74           ("conversions"))
75          ("postscript")
76          ("x-kiss"
77           ("x-name")
78           ("x-cnf")))
79         ("image"
80          ("gif"  ("x-name"))
81          ("jpeg" ("x-name"))
82          ("x-pic"  ("x-name"))
83          ("x-xwd")
84          ("x-xbm"))
85         ("audio"
86          ("basic"))
87         ("video"
88          ("mpeg")))
89       )
90
91
92 ;;; @ for signature
93 ;;;
94
95 (if mime-setup-use-signature
96     (progn
97       (autoload 'insert-signature "signature" "Insert signature" t)
98       
99       (add-hook 'mime-mode-hook
100                 (function
101                  (lambda ()
102                    (define-key (current-local-map)
103                      mime-setup-signature-key
104                      (function insert-signature))
105                    )))
106       
107       (setq gnus-signature-file nil)
108       ))
109
110
111 ;;; @ for tiny-mime
112 ;;;
113
114 (autoload 'mime/encode-message-header "tiny-mime"
115   "convert message header to MIME style." t)
116
117 (add-hook 'mime-translate-hook (function mime/encode-message-header))
118
119 (setq mime-header-charset-chooser
120       (function
121        (lambda (begin end)
122          )))
123
124
125 ;;; @ for tm-comp
126 ;;;
127
128 (call-after-loaded
129  'tm-comp
130  (function
131   (lambda ()
132     (setq mime-transfer-encoders
133           '(("base64"           "mmencode")
134             ("quoted-printable" "mmencode" "-q")
135             ("7bit"             nil)    ;Default
136             ("8bit"             nil)
137             ("binary"           nil)
138             ("x-uue"            "uuencode" "-")
139             ))
140     
141     (setq mime-file-types
142           '(("\\.rtf$"
143              "text"     "richtext"      nil     nil)
144             ("\\.html$"
145              "text"     "html"          nil     nil)
146             ("\\.ps$"
147              "application" "postscript" nil     "quoted-printable")
148             ("\\.gif$"
149              "image"    "gif"           nil     "base64")
150             ("\\.jpg$"
151              "image"    "jpeg"          nil     "base64")
152             ("\\.xwd$"
153              "image"    "x-xwd"         nil     "base64")
154             ("\\.xbm$"
155              "image"    "x-xbm"         nil     "base64")
156             ("\\.pic$"
157              "image"    "x-pic"         nil     "base64")
158             ("\\.tiff$"
159              "image"    "tiff"          nil     "base64")
160             ("\\.au$"
161              "audio"    "basic"         nil     "base64")
162             ("\\.mpg$"
163              "video"    "mpeg"          nil     "base64")
164             ("\\.el$"
165              "application" "octet-stream" (("name" . file)
166                                            ("type" . "emacs-lisp")) "7bit")
167             ("\\.tar.gz$"
168              "application" "octet-stream" (("name" . file)
169                                            ("type" . "tar")
170                                            ("conversions" . "gzip")) nil)
171             ("\\.signature"
172              "text"     "plain"         nil     nil)
173             (".*"       nil             nil     nil     nil))
174           )
175     )))
176
177
178 ;;; @ about SuperCite
179 ;;;
180
181 (if mime-setup-use-sc
182     (require 'sc-setup)
183   )
184
185
186 ;;; @ for mh-e
187 ;;;
188
189 (add-hook 'mh-letter-mode-hook
190           (function
191            (lambda ()
192              (mime/decode-message-header)
193              (mime-mode)
194              (make-local-variable 'mail-header-separator)
195              (setq mail-header-separator "--------"))
196            ))
197
198
199 ;;; @ for GNUS
200 ;;;
201
202 (add-hook 'news-reply-mode-hook
203           (function
204            (lambda ()
205              (mime/decode-message-header)
206              (set-buffer-modified-p nil)
207              (mime-mode)
208              )))
209
210
211 ;;; @ for Mail mode (includes VM mode)
212 ;;;
213
214 (add-hook 'mail-mode-hook (function mime-mode))
215 (add-hook 'mail-setup-hook (function mime/decode-message-header))
216
217 ;;; @@ In VM, the following definitions may be requried:
218 ;;; 
219
220 (if (boundp 'vm-visible-headers)
221     (progn
222       (setq vm-preview-lines nil)
223       (setq vm-invisible-header-regexp nil)
224       (setq vm-visible-headers
225             (append vm-visible-headers
226                     '("Mime-Version:"
227                       "Content-Type:"
228                       "Content-Transfer-Encoding:")))
229       ))
230
231
232 ;;; @ end
233 ;;;
234
235 (provide 'mime-setup)
236
237 ;;; Local Variables:
238 ;;; mode: emacs-lisp
239 ;;; mode: outline-minor
240 ;;; outline-regexp: ";;; @+\\|(......"
241 ;;; End: