`mime-preview/default-content-button-function' ->
[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.15 1997-03-14 08:46:14 morioka 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 (require 'mime-def)
29 (require 'file-detect)
30
31
32 ;;; @ for mime-view
33 ;;;
34
35 (call-after-loaded
36  'mime-view
37  (function
38   (lambda ()
39     ;; for message/partial
40     (require 'mime-partial)
41     )))
42
43
44 ;; for image/* and X-Face
45 (defvar mime-setup-enable-inline-image
46   (and window-system
47        (or running-xemacs
48            (and (featurep 'mule)(module-installed-p 'bitmap))
49            ))
50   "*If it is non-nil, semi-setup sets up to use mime-image.")
51
52 (if mime-setup-enable-inline-image
53     (call-after-loaded 'mime-view
54                        (function
55                         (lambda ()
56                           (require 'mime-image)
57                           )))
58   )
59
60
61 (defvar mime-setup-enable-pgp
62   (module-installed-p 'mailcrypt)
63   "*If it is non-nil, semi-setup sets uf to use mime-pgp.")
64
65 ;; for PGP
66 (if mime-setup-enable-pgp
67     (call-after-loaded 'mime-view
68                        (function
69                         (lambda ()
70                           (require 'mime-pgp)
71                           )))
72   )
73
74
75 ;;; @ for mime-edit
76 ;;;
77
78 (defun mime-setup-decode-message-header ()
79   (save-excursion
80     (save-restriction
81       (goto-char (point-min))
82       (narrow-to-region
83        (point-min)
84        (if (re-search-forward
85             (concat "^" (regexp-quote mail-header-separator) "$")
86             nil t)
87            (match-beginning 0)
88          (point-max)
89          ))
90       (eword-decode-header)
91       (set-buffer-modified-p nil)
92       )))
93
94 (add-hook 'mime-edit-mode-hook 'mime-setup-decode-message-header)
95
96
97 ;;; @@ variables
98 ;;;
99
100 (defvar mime-setup-use-signature t
101   "If it is not nil, mime-setup sets up to use signature.el.")
102
103 (defvar mime-setup-default-signature-key "\C-c\C-s"
104   "*Key to insert signature.")
105
106 (defvar mime-setup-signature-key-alist '((mail-mode . "\C-c\C-w"))
107   "Alist of major-mode vs. key to insert signature.")
108
109
110 ;;; @@ for signature
111 ;;;
112
113 (defun mime-setup-set-signature-key ()
114   (let ((key (or (cdr (assq major-mode mime-setup-signature-key-alist))
115                  mime-setup-default-signature-key)))
116     (define-key (current-local-map) key (function insert-signature))
117     ))
118
119 (if mime-setup-use-signature
120     (progn
121       (autoload 'insert-signature "signature" "Insert signature" t)
122       (add-hook 'mime-edit-mode-hook 'mime-setup-set-signature-key)
123       (setq gnus-signature-file nil)
124       (setq mail-signature nil)
125       (setq message-signature nil)
126       ))
127
128
129 ;;; @ for mu-cite
130 ;;;
131
132 (add-hook 'mu-cite/pre-cite-hook 'eword-decode-header)
133
134
135 ;;; @ end
136 ;;;
137
138 (provide 'semi-setup)
139
140 ;;; semi-setup.el ends here