(emh-version): Update.
[elisp/emh.git] / 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: mail, news, MIME, multimedia, multilingual, encoded-word
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   (eword-decode-header nil mail-header-separator)
46   (turn-on-mime-edit)
47   (save-excursion
48     (goto-char (point-min))
49     (setq buffer-read-only nil)
50     (if (re-search-forward "^-*$" nil t)
51         (progn
52           (replace-match mail-header-separator)
53           (set-buffer-modified-p (buffer-modified-p))
54           ))
55     ))
56
57 (add-hook 'mh-letter-mode-hook 'emh-setup-mh-draft-setting t)
58 (add-hook 'mh-before-send-letter-hook 'mime-edit-maybe-translate)
59
60
61 ;;; @@ for emh-comp.el
62 ;;;
63
64 (autoload 'emh-edit-again "emh-comp"
65   "Clean-up a draft or a message previously sent and make it resendable." t)
66 (autoload 'emh-extract-rejected-mail "emh-comp"
67   "Extract a letter returned by the mail system and make it re-editable." t)
68 (autoload 'emh-forward "emh-comp"
69   "Forward a message or message sequence by MIME style." t)
70
71 (eval-after-load
72     "mh-e"
73   '(progn
74      (substitute-key-definition
75       'mh-edit-again 'emh-edit-again
76       mh-folder-mode-map)
77      (substitute-key-definition
78       'mh-extract-rejected-mail 'emh-extract-rejected-mail
79       mh-folder-mode-map)
80      (substitute-key-definition
81       'mh-forward 'emh-forward
82       mh-folder-mode-map)
83      ))
84
85 (eval-after-load "mh-comp" '(require 'emh-comp))
86
87
88 ;;; @ end
89 ;;;
90
91 (provide 'emh-setup)
92
93 ;;; emh-setup.el ends here