Modify for SEMI 1.2.4 (Arimagawa).
[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     (call-after-loaded 'mime-view
55                        (function
56                         (lambda ()
57                           (require 'mime-pgp)
58                           )))
59   )
60
61
62 ;;; @ for mime-edit
63 ;;;
64
65 (defun mime-setup-decode-message-header ()
66   (save-excursion
67     (save-restriction
68       (goto-char (point-min))
69       (narrow-to-region
70        (point-min)
71        (if (re-search-forward
72             (concat "^" (regexp-quote mail-header-separator) "$")
73             nil t)
74            (match-beginning 0)
75          (point-max)
76          ))
77       (eword-decode-header)
78       (set-buffer-modified-p nil)
79       )))
80
81 (add-hook 'mime-edit-mode-hook 'mime-setup-decode-message-header)
82
83
84 ;;; @@ variables
85 ;;;
86
87 (defvar mime-setup-use-signature t
88   "If it is not nil, mime-setup sets up to use signature.el.")
89
90 (defvar mime-setup-default-signature-key "\C-c\C-s"
91   "*Key to insert signature.")
92
93 (defvar mime-setup-signature-key-alist '((mail-mode . "\C-c\C-w"))
94   "Alist of major-mode vs. key to insert signature.")
95
96
97 ;;; @@ for signature
98 ;;;
99
100 (defun mime-setup-set-signature-key ()
101   (let ((keymap (current-local-map)))
102     (if keymap
103         (let ((key
104                (or (cdr (assq major-mode mime-setup-signature-key-alist))
105                    mime-setup-default-signature-key)))
106           (define-key keymap key (function insert-signature))
107           ))))
108
109 (if mime-setup-use-signature
110     (progn
111       (autoload 'insert-signature "signature" "Insert signature" t)
112       (add-hook 'mime-edit-mode-hook 'mime-setup-set-signature-key)
113       (setq gnus-signature-file nil)
114       (setq mail-signature nil)
115       (setq message-signature nil)
116       ))
117
118
119 ;;; @ for mu-cite
120 ;;;
121
122 (add-hook 'mu-cite/pre-cite-hook 'eword-decode-header)
123
124
125 ;;; @ end
126 ;;;
127
128 (provide 'semi-setup)
129
130 ;;; semi-setup.el ends here