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