tm 7.22.
[elisp/tm.git] / mime-setup.el
1 ;;;
2 ;;; mime-setup.el --- setup file to use tm and mime.el.
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.9 1995/10/28 06:02:53 morioka Exp $
10 ;;; Keywords: mail, news, MIME, multimedia, multilingual, encoded-word
11 ;;;
12 ;;; This file is part of tm (Tools for MIME).
13 ;;;
14
15 (require 'tm-setup)
16
17 (autoload 'mime/editor-mode "tm-edit"
18   "Minor mode for editing MIME message." t)
19
20 (add-hook 'mime/editor-mode-hook
21           (function
22            (lambda ()
23              (save-excursion
24                (save-restriction
25                  (goto-char (point-min))
26                  (narrow-to-region
27                   (point-min)
28                   (if (re-search-forward
29                        (concat "^" (regexp-quote mail-header-separator) "$")
30                        nil t)
31                       (match-beginning 0)
32                     (point-max)
33                     ))
34                  (mime/decode-message-header)
35                  (set-buffer-modified-p nil)
36                  )))))
37
38
39 ;;; @ variables
40 ;;;
41
42 (defvar mime-setup-use-sc nil)
43 (defvar mime-setup-use-signature t)
44 (defvar mime-setup-default-signature-key "\C-c\C-s")
45 (defvar mime-setup-signature-key-alist '((mail-mode . "\C-c\C-w")))
46
47
48 ;;; @ for signature
49 ;;;
50
51 (if mime-setup-use-signature
52     (progn
53       (autoload 'insert-signature "signature" "Insert signature" t)
54       (add-hook 'mime/editor-mode-hook
55                 (function
56                  (lambda ()
57                    (let ((key (or (cdr
58                                    (assq major-mode
59                                          mime-setup-signature-key-alist)
60                                    )
61                                   mime-setup-default-signature-key)))
62                      (define-key (current-local-map)
63                        key (function insert-signature))
64                      ))))
65       (setq gnus-signature-file nil)
66       ))
67
68
69 ;;; @ about SuperCite
70 ;;;
71
72 (if mime-setup-use-sc
73     (require 'sc-setup)
74   )
75
76
77 ;;; @ for RMAIL
78 ;;;
79
80 (add-hook 'mail-mode-hook  'mime/editor-mode)
81 (add-hook 'mail-setup-hook 'mime/decode-message-header)
82 (add-hook 'mail-send-hook  'mime-editor/maybe-translate)
83
84
85 ;;; @ for mh-e
86 ;;;
87
88 (add-hook 'mh-letter-mode-hook
89           (function
90            (lambda ()
91              (mime/editor-mode)
92              (make-local-variable 'mail-header-separator)
93              (setq mail-header-separator "--------")
94              (save-excursion
95                (goto-char (point-min))
96                (if (re-search-forward "^-*$" nil t)
97                    (progn
98                      (replace-match mail-header-separator)
99                      (set-buffer-modified-p (buffer-modified-p))
100                      ))
101                )
102              )) t)
103
104 (add-hook 'mh-before-send-letter-hook 'mime-editor/maybe-translate)
105
106
107 ;;; @ for GNUS
108 ;;;
109
110 (add-hook 'news-reply-mode-hook 'mime/editor-mode)
111 (add-hook 'news-inews-hook      'mime-editor/maybe-translate)
112
113
114 ;;; @ end
115 ;;;
116
117 (provide 'mime-setup)
118
119 (run-hooks 'mime-setup-load-hook)