(char-list-to-string): New inline-function; copied from emu-19.el.
[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.5 1997-02-27 13:37:11 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 (eval-when-compile
29   (require 'mime-view)
30   )
31
32
33 ;;; @ Utility
34 ;;;
35
36 (defun call-after-loaded (module func &optional hook-name)
37   "If MODULE is provided, then FUNC is called.
38 Otherwise func is set to MODULE-load-hook.
39 If optional argument HOOK-NAME is specified,
40 it is used as hook to set."
41   (if (featurep module)
42       (funcall func)
43     (or hook-name
44         (setq hook-name (intern (concat (symbol-name module) "-load-hook")))
45         )
46     (add-hook hook-name func)
47     ))
48
49
50 ;;; @ for mime-view
51 ;;;
52
53 (call-after-loaded
54  'mime-view
55  (function
56   (lambda ()
57     ;; for message/partial
58     (require 'mime-partial)
59     
60     ;; for anonymous ftp
61     (set-atype 'mime/content-decoding-condition
62                '((type . "message/external-body")
63                  ("access-type" . "anon-ftp")
64                  (method . mime-article/decode-message/external-ftp)
65                  ))
66     (autoload 'mime-article/decode-message/external-ftp "tm-ftp")
67     
68     ;; for LaTeX
69     (set-atype 'mime/content-decoding-condition
70                '((type . "text/x-latex")
71                  (method . mime/decode-text/latex)
72                  ))
73     (set-atype 'mime/content-decoding-condition
74                '((type . "application/x-latex")
75                  (method . mime/decode-text/latex)
76                  ))
77     ;;(set-atype 'mime/content-decoding-condition
78     ;;  '((type . "application/octet-stream")
79     ;;            ("type" . "latex")
80     ;;            (method . mime/decode-text/latex)
81     ;;            ))
82     (autoload 'mime/decode-text/latex "tm-latex")
83     )))
84
85
86 (defvar running-xemacs (string-match "XEmacs" emacs-version))
87
88 ;; for image/* and X-Face
89 (defvar mime-setup-enable-inline-image
90   (and window-system
91        (or running-xemacs
92            (and (featurep 'mule)(module-installed-p 'bitmap))
93            ))
94   "*If it is non-nil, semi-setup sets up to use mime-image.")
95
96 (if mime-setup-enable-inline-image
97     (call-after-loaded 'mime-view
98                        (function
99                         (lambda ()
100                           (require 'mime-image)
101                           )))
102   )
103
104
105 (defvar mime-setup-enable-pgp
106   (module-installed-p 'mailcrypt)
107   "*If it is non-nil, semi-setup sets uf to use tm-pgp.")
108
109 ;; for PGP
110 (if mime-setup-enable-pgp
111     (call-after-loaded 'mime-view
112                        (function
113                         (lambda ()
114                           (require 'tm-pgp)
115                           )))
116   )
117
118
119 ;;; @ for mh-e
120 ;;;
121
122 (defun semi-setup-load-emh ()
123   (require 'emh)
124   )
125
126 (call-after-loaded 'mh-e 'semi-setup-load-emh 'mh-folder-mode-hook)
127 (or (featurep 'mh-e)
128     (add-hook 'mh-letter-mode-hook 'semi-setup-load-emh)
129     )
130
131
132 ;;; @ for Gnus
133 ;;;
134   
135 (defun semi-setup-load-gnus ()
136   (let (gnus-load-hook)
137     (require 'gnus-mime)
138     ))
139
140 (add-hook 'gnus-load-hook 'semi-setup-load-gnus)
141
142
143 ;;; @ end
144 ;;;
145
146 (provide 'semi-setup)
147
148 ;;; semi-setup.el ends here