Merge semi21-D20010129.
[elisp/lemi.git] / mime / emh-setup.el
1 ;;; emh-setup.el --- setup file for emh.
2
3 ;; Copyright (C) 1994,1995,1996,1997,1998 Free Software Foundation, Inc.
4
5 ;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
6 ;; Keywords: mh-e, mail, news, MIME, multimedia, multilingual
7
8 ;; This file is part of emh.
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-setup)
28
29
30 ;;; @ for emh
31 ;;;
32
33 (eval-after-load "mh-e" '(require 'emh))
34
35
36 ;;; @ for mime-edit
37 ;;;
38
39 (autoload 'turn-on-mime-edit "mime-edit"
40   "Unconditionally turn on MIME-Edit minor mode." t)
41
42 (defun emh-setup-mh-draft-setting ()
43   (make-local-variable 'mail-header-separator)
44   (setq mail-header-separator "--------")
45   (mime-decode-header-in-buffer nil mail-header-separator)
46   (let ((ua mime-edit-user-agent-value))
47     (make-local-variable 'mime-edit-user-agent-value)
48     (setq mime-edit-user-agent-value (concat "EMH/" emh-version " " ua))
49     )
50   (turn-on-mime-edit)
51   (save-excursion
52     (goto-char (point-min))
53     (setq buffer-read-only nil)
54     (if (re-search-forward "^-*$" nil t)
55         (progn
56           (replace-match mail-header-separator)
57           (set-buffer-modified-p (buffer-modified-p))
58           ))
59     ))
60
61 (add-hook 'mh-letter-mode-hook 'emh-setup-mh-draft-setting t)
62 (add-hook 'mh-before-send-letter-hook 'mime-edit-maybe-translate)
63
64
65 ;;; @@ for emh-comp.el
66 ;;;
67
68 (autoload 'emh-edit-again "emh-comp"
69   "Clean-up a draft or a message previously sent and make it resendable." t)
70 (autoload 'emh-extract-rejected-mail "emh-comp"
71   "Extract a letter returned by the mail system and make it re-editable." t)
72 (autoload 'emh-forward "emh-comp"
73   "Forward a message or message sequence by MIME style." t)
74
75 (eval-after-load
76     "mh-e"
77   '(progn
78      (substitute-key-definition
79       'mh-edit-again 'emh-edit-again
80       mh-folder-mode-map)
81      (substitute-key-definition
82       'mh-extract-rejected-mail 'emh-extract-rejected-mail
83       mh-folder-mode-map)
84      (substitute-key-definition
85       'mh-forward 'emh-forward
86       mh-folder-mode-map)
87      ))
88
89 (eval-after-load "mh-comp" '(require 'emh-comp))
90
91
92 ;;; @ end
93 ;;;
94
95 (provide 'emh-setup)
96
97 ;;; emh-setup.el ends here