Move definition of variable `mime-raw-representation-type' from
[elisp/semi.git] / semi-setup.el
1 ;;; semi-setup.el --- setup file for MIME-View.
2
3 ;; Copyright (C) 1994,1995,1996,1997,1998 Free Software Foundation, Inc.
4
5 ;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
6 ;; Keywords: mail, news, MIME, multimedia, multilingual, encoded-word
7
8 ;; This file is part of SEMI (Setting for Emacs MIME Interfaces).
9
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.
14
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.
19
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.
24
25 ;;; Code:
26
27 (require 'semi-def)
28 (require 'path-util)
29
30
31 ;; for image/* and X-Face
32 (defvar mime-setup-enable-inline-image
33   (and window-system
34        (or running-xemacs
35            (and (featurep 'mule)(module-installed-p 'bitmap))
36            ))
37   "*If it is non-nil, semi-setup sets up to use mime-image.")
38
39 (if mime-setup-enable-inline-image
40     (call-after-loaded 'mime-view
41                        (function
42                         (lambda ()
43                           (require 'mime-image)
44                           )))
45   )
46
47
48 (defvar mime-setup-enable-pgp
49   (module-installed-p 'mailcrypt)
50   "*If it is non-nil, semi-setup sets uf to use mime-pgp.")
51
52 ;; for PGP
53 (if mime-setup-enable-pgp
54     (eval-after-load "mime-view"
55       '(progn
56          (mime-add-condition
57           'preview '((type . application)(subtype . pgp)
58                      (message-button . visible)))
59          (mime-add-condition
60           'action '((type . application)(subtype . pgp)
61                     (method . mime-method-for-application/pgp))
62           'strict "mime-pgp")
63          (mime-add-condition
64           'action '((type . text)(subtype . x-pgp)
65                     (method . mime-method-for-application/pgp)))
66          
67          (mime-add-condition
68           'action '((type . multipart)(subtype . signed)
69                     (method . mime-method-to-verify-multipart/signed))
70           'strict "mime-pgp")
71          
72          (mime-add-condition
73           'action
74           '((type . application)(subtype . pgp-signature)
75             (method . mime-method-to-verify-application/pgp-signature))
76           'strict "mime-pgp")
77          
78          (mime-add-condition
79           'action
80           '((type . application)(subtype . pgp-encrypted)
81             (method . mime-method-to-decrypt-application/pgp-encrypted))
82           'strict "mime-pgp")
83          
84          (mime-add-condition
85           'action
86           '((type . application)(subtype . pgp-keys)
87             (method . mime-method-to-add-application/pgp-keys))
88           'strict "mime-pgp")
89          ))
90   )
91
92
93 ;;; @ for mime-edit
94 ;;;
95
96 (defun mime-setup-decode-message-header ()
97   (save-excursion
98     (save-restriction
99       (goto-char (point-min))
100       (narrow-to-region
101        (point-min)
102        (if (re-search-forward
103             (concat "^" (regexp-quote mail-header-separator) "$")
104             nil t)
105            (match-beginning 0)
106          (point-max)
107          ))
108       (eword-decode-header)
109       (set-buffer-modified-p nil)
110       )))
111
112 (add-hook 'mime-edit-mode-hook 'mime-setup-decode-message-header)
113
114
115 ;;; @@ variables
116 ;;;
117
118 (defvar mime-setup-use-signature t
119   "If it is not nil, mime-setup sets up to use signature.el.")
120
121 (defvar mime-setup-default-signature-key "\C-c\C-s"
122   "*Key to insert signature.")
123
124 (defvar mime-setup-signature-key-alist '((mail-mode . "\C-c\C-w"))
125   "Alist of major-mode vs. key to insert signature.")
126
127
128 ;;; @@ for signature
129 ;;;
130
131 (defun mime-setup-set-signature-key ()
132   (let ((keymap (current-local-map)))
133     (if keymap
134         (let ((key
135                (or (cdr (assq major-mode mime-setup-signature-key-alist))
136                    mime-setup-default-signature-key)))
137           (define-key keymap key (function insert-signature))
138           ))))
139
140 (when mime-setup-use-signature
141   (autoload 'insert-signature "signature" "Insert signature" t)
142   (add-hook 'mime-edit-mode-hook 'mime-setup-set-signature-key)
143   ;; (setq message-signature nil)
144   )
145
146
147 ;;; @ for mu-cite
148 ;;;
149
150 (add-hook 'mu-cite/pre-cite-hook 'eword-decode-header)
151
152
153 ;;; @ end
154 ;;;
155
156 (provide 'semi-setup)
157
158 ;;; semi-setup.el ends here