e611caf78387725e836605636b1c5e84aa54e2ea
[elisp/tm.git] / mime-setup.el
1 ;;;
2 ;;; mime-setup.el --- setup file for tm viewer and composer.
3 ;;;
4 ;;; Copyright (C) 1995 Free Software Foundation, Inc.
5 ;;; Copyright (C) 1994,1995 MORIOKA Tomohiko
6 ;;;
7 ;;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
8 ;;; Version:
9 ;;;     $Id: mime-setup.el,v 7.12 1995/11/29 21:51:05 morioka Exp $
10 ;;; Keywords: mail, news, MIME, multimedia, multilingual, encoded-word
11 ;;;
12 ;;; This file is part of tm (Tools for MIME).
13 ;;;
14 ;;; This program is free software; you can redistribute it and/or
15 ;;; modify it under the terms of the GNU General Public License as
16 ;;; published by the Free Software Foundation; either version 2, or
17 ;;; (at your option) any later version.
18 ;;;
19 ;;; This program is distributed in the hope that it will be useful,
20 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
21 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
22 ;;; General Public License for more details.
23 ;;;
24 ;;; You should have received a copy of the GNU General Public License
25 ;;; along with This program.  If not, write to the Free Software
26 ;;; Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
27
28 (require 'tm-setup)
29
30 (autoload 'mime/editor-mode "tm-edit"
31   "Minor mode for editing MIME message." t)
32 (autoload 'mime/decode-message-header "tm-ew-d"
33   "Decode MIME encoded-words in message header." t)
34
35 (add-hook 'mime/editor-mode-hook
36           (function
37            (lambda ()
38              (save-excursion
39                (save-restriction
40                  (goto-char (point-min))
41                  (narrow-to-region
42                   (point-min)
43                   (if (re-search-forward
44                        (concat "^" (regexp-quote mail-header-separator) "$")
45                        nil t)
46                       (match-beginning 0)
47                     (point-max)
48                     ))
49                  (mime/decode-message-header)
50                  (set-buffer-modified-p nil)
51                  )))))
52
53
54 ;;; @ variables
55 ;;;
56
57 (defvar mime-setup-use-sc nil)
58 (defvar mime-setup-use-signature t)
59 (defvar mime-setup-default-signature-key "\C-c\C-s")
60 (defvar mime-setup-signature-key-alist '((mail-mode . "\C-c\C-w")))
61
62
63 ;;; @ for signature
64 ;;;
65
66 (if mime-setup-use-signature
67     (progn
68       (autoload 'insert-signature "signature" "Insert signature" t)
69       (add-hook 'mime/editor-mode-hook
70                 (function
71                  (lambda ()
72                    (let ((key (or (cdr
73                                    (assq major-mode
74                                          mime-setup-signature-key-alist)
75                                    )
76                                   mime-setup-default-signature-key)))
77                      (define-key (current-local-map)
78                        key (function insert-signature))
79                      ))))
80       (setq gnus-signature-file nil)
81       (setq mail-signature nil)
82       ))
83
84
85 ;;; @ about SuperCite
86 ;;;
87
88 (if mime-setup-use-sc
89     (require 'sc-setup)
90   )
91
92
93 ;;; @ for RMAIL and VM
94 ;;;
95
96 (add-hook 'mail-setup-hook 'mime/decode-message-header)
97 (add-hook 'mail-setup-hook 'mime/editor-mode 'append)
98 (add-hook 'mail-send-hook  'mime-editor/maybe-translate)
99
100
101 ;;; @ for mh-e
102 ;;;
103
104 (add-hook 'mh-letter-mode-hook
105           (function
106            (lambda ()
107              (mime/editor-mode)
108              (make-local-variable 'mail-header-separator)
109              (setq mail-header-separator "--------")
110              (save-excursion
111                (goto-char (point-min))
112                (if (re-search-forward "^-*$" nil t)
113                    (progn
114                      (replace-match mail-header-separator)
115                      (set-buffer-modified-p (buffer-modified-p))
116                      ))
117                )
118              )) t)
119
120 (add-hook 'mh-before-send-letter-hook 'mime-editor/maybe-translate)
121
122
123 ;;; @ for GNUS
124 ;;;
125
126 (add-hook 'news-reply-mode-hook 'mime/editor-mode)
127 (add-hook 'news-inews-hook      'mime-editor/maybe-translate)
128
129
130 ;;; @ end
131 ;;;
132
133 (provide 'mime-setup)
134
135 (run-hooks 'mime-setup-load-hook)