1 ;;; semi-setup.el --- setup file for MIME-View.
3 ;; Copyright (C) 1994,1995,1996,1997,1998 Free Software Foundation, Inc.
5 ;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
6 ;; Keywords: mail, news, MIME, multimedia, multilingual, encoded-word
8 ;; This file is part of SEMI (Setting for Emacs MIME Interfaces).
10 ;; This program is free software; you can redistribute it and/or
11 ;; modify it under the terms of the GNU General Public License as
12 ;; published by the Free Software Foundation; either version 2, or (at
13 ;; your option) any later version.
15 ;; This program is distributed in the hope that it will be useful, but
16 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 ;; General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA.
30 (defun call-after-loaded (module func &optional hook-name)
31 "If MODULE is provided, then FUNC is called.
32 Otherwise func is set to MODULE-load-hook.
33 If optional argument HOOK-NAME is specified,
34 it is used as hook to set."
38 (setq hook-name (intern (concat (symbol-name module) "-load-hook"))))
39 (add-hook hook-name func)))
42 ;; for image/* and X-Face
43 (defvar mime-setup-enable-inline-image
45 (or (featurep 'xemacs)
46 (and (featurep 'mule)(module-installed-p 'bitmap))))
47 "*If it is non-nil, semi-setup sets up to use mime-image.")
49 (if mime-setup-enable-inline-image
50 (call-after-loaded 'mime-view
53 (require 'mime-image)))))
57 (defvar mime-setup-enable-inline-html
58 (module-installed-p 'w3)
59 "*If it is non-nil, semi-setup sets up to use mime-w3.")
61 (if mime-setup-enable-inline-html
66 (autoload 'mime-preview-text/html "mime-w3")
68 (ctree-set-calist-strictly
69 'mime-preview-condition
70 '((type . text)(subtype . html)
72 (body-presentation-method . mime-preview-text/html)))
74 (set-alist 'mime-view-type-subtype-score-alist
79 (defvar mime-setup-enable-pgp t
80 "*If it is non-nil, semi-setup sets up to use mime-pgp.")
82 (if mime-setup-enable-pgp
83 (eval-after-load "mime-view"
86 'preview '((type . application)(subtype . pgp)
87 (message-button . visible)))
89 'action '((type . application)(subtype . pgp)
90 (method . mime-view-application/pgp))
93 'action '((type . text)(subtype . x-pgp)
94 (method . mime-view-application/pgp)))
97 'action '((type . multipart)(subtype . signed)
98 (method . mime-verify-multipart/signed))
103 '((type . application)(subtype . pgp-signature)
104 (method . mime-verify-application/pgp-signature))
109 '((type . application)(subtype . pgp-encrypted)
110 (method . mime-decrypt-application/pgp-encrypted))
115 '((type . application)(subtype . pgp-keys)
116 (method . mime-add-application/pgp-keys))
121 '((type . application)(subtype . pkcs7-signature)
122 (method . mime-verify-application/pkcs7-signature))
127 '((type . application)(subtype . x-pkcs7-signature)
128 (method . mime-verify-application/pkcs7-signature))
133 '((type . application)(subtype . pkcs7-mime)
134 (method . mime-view-application/pkcs7-mime))
139 '((type . application)(subtype . x-pkcs7-mime)
140 (method . mime-view-application/pkcs7-mime))
141 'strict "mime-pgp"))))
147 (defun mime-setup-decode-message-header ()
150 (goto-char (point-min))
153 (if (re-search-forward
154 (concat "^" (regexp-quote mail-header-separator) "$")
158 (mime-decode-header-in-buffer)
159 (set-buffer-modified-p nil))))
161 (add-hook 'mime-edit-mode-hook 'mime-setup-decode-message-header)
167 (defvar mime-setup-use-signature t
168 "If it is not nil, mime-setup sets up to use signature.el.")
170 (defvar mime-setup-default-signature-key "\C-c\C-s"
171 "*Key to insert signature.")
173 (defvar mime-setup-signature-key-alist '((mail-mode . "\C-c\C-w"))
174 "Alist of major-mode vs. key to insert signature.")
180 (defun mime-setup-set-signature-key ()
181 (let ((keymap (current-local-map)))
184 (or (cdr (assq major-mode mime-setup-signature-key-alist))
185 mime-setup-default-signature-key)))
186 (define-key keymap key (function insert-signature))))))
188 (when mime-setup-use-signature
189 (autoload 'insert-signature "signature" "Insert signature" t)
190 (add-hook 'mime-edit-mode-hook 'mime-setup-set-signature-key)
191 ;; (setq message-signature nil)
198 (add-hook 'mu-cite/pre-cite-hook 'eword-decode-header)
204 (provide 'semi-setup)
206 ;;; semi-setup.el ends here