cb64c53cef8a5d2b274784838df08f7874ff2756
[elisp/semi.git] / semi-setup.el
1 ;;; semi-setup.el --- setup file for MIME-View.
2
3 ;; Copyright (C) 1994,1995,1996,1997 Free Software Foundation, Inc.
4
5 ;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
6 ;; Version: $Id: semi-setup.el,v 0.4 1997-02-27 13:28:10 tmorioka Exp $
7 ;; Keywords: mail, news, MIME, multimedia, multilingual, encoded-word
8
9 ;; This file is part of SEMI (SEMI is Emacs MIME Interfaces).
10
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.
15
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.
20
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.
25
26 ;;; Code:
27
28 ;;; @ Utility
29 ;;;
30
31 (defun call-after-loaded (module func &optional hook-name)
32   "If MODULE is provided, then FUNC is called.
33 Otherwise func is set to MODULE-load-hook.
34 If optional argument HOOK-NAME is specified,
35 it is used as hook to set."
36   (if (featurep module)
37       (funcall func)
38     (or hook-name
39         (setq hook-name (intern (concat (symbol-name module) "-load-hook")))
40         )
41     (add-hook hook-name func)
42     ))
43
44
45 ;;; @ for mime-view
46 ;;;
47
48 (call-after-loaded
49  'mime-view
50  (function
51   (lambda ()
52     ;; for message/partial
53     (require 'mime-partial)
54     
55     ;; for anonymous ftp
56     (set-atype 'mime/content-decoding-condition
57                '((type . "message/external-body")
58                  ("access-type" . "anon-ftp")
59                  (method . mime-article/decode-message/external-ftp)
60                  ))
61     (autoload 'mime-article/decode-message/external-ftp "tm-ftp")
62     
63     ;; for LaTeX
64     (set-atype 'mime/content-decoding-condition
65                '((type . "text/x-latex")
66                  (method . mime/decode-text/latex)
67                  ))
68     (set-atype 'mime/content-decoding-condition
69                '((type . "application/x-latex")
70                  (method . mime/decode-text/latex)
71                  ))
72     ;;(set-atype 'mime/content-decoding-condition
73     ;;  '((type . "application/octet-stream")
74     ;;            ("type" . "latex")
75     ;;            (method . mime/decode-text/latex)
76     ;;            ))
77     (autoload 'mime/decode-text/latex "tm-latex")
78     )))
79
80
81 (defvar running-xemacs (string-match "XEmacs" emacs-version))
82
83 ;; for image/* and X-Face
84 (defvar mime-setup-enable-inline-image
85   (and window-system
86        (or running-xemacs
87            (and (featurep 'mule)(module-installed-p 'bitmap))
88            ))
89   "*If it is non-nil, semi-setup sets up to use mime-image.")
90
91 (if mime-setup-enable-inline-image
92     (call-after-loaded 'mime-view
93                        (function
94                         (lambda ()
95                           (require 'mime-image)
96                           )))
97   )
98
99
100 (defvar mime-setup-enable-pgp
101   (module-installed-p 'mailcrypt)
102   "*If it is non-nil, semi-setup sets uf to use tm-pgp.")
103
104 ;; for PGP
105 (if mime-setup-enable-pgp
106     (call-after-loaded 'mime-view
107                        (function
108                         (lambda ()
109                           (require 'tm-pgp)
110                           )))
111   )
112
113
114 ;;; @ for mh-e
115 ;;;
116
117 (defun semi-setup-load-emh ()
118   (require 'emh)
119   )
120
121 (call-after-loaded 'mh-e 'semi-setup-load-emh 'mh-folder-mode-hook)
122 (or (featurep 'mh-e)
123     (add-hook 'mh-letter-mode-hook 'semi-setup-load-emh)
124     )
125
126
127 ;;; @ for Gnus
128 ;;;
129   
130 (defun semi-setup-load-gnus ()
131   (let (gnus-load-hook)
132     (require 'gnus-mime)
133     ))
134
135 (add-hook 'gnus-load-hook 'semi-setup-load-gnus)
136
137
138 ;;; @ end
139 ;;;
140
141 (provide 'semi-setup)
142
143 ;;; semi-setup.el ends here