tm 7.27.
[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.10 1995/11/19 13:47:54 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 and VM
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-setup-hook 'mime/editor-mode 'append)
83 (add-hook 'mail-send-hook  'mime-editor/maybe-translate)
84
85
86 ;;; @ for mh-e
87 ;;;
88
89 (add-hook 'mh-letter-mode-hook
90           (function
91            (lambda ()
92              (mime/editor-mode)
93              (make-local-variable 'mail-header-separator)
94              (setq mail-header-separator "--------")
95              (save-excursion
96                (goto-char (point-min))
97                (if (re-search-forward "^-*$" nil t)
98                    (progn
99                      (replace-match mail-header-separator)
100                      (set-buffer-modified-p (buffer-modified-p))
101                      ))
102                )
103              )) t)
104
105 (add-hook 'mh-before-send-letter-hook 'mime-editor/maybe-translate)
106
107
108 ;;; @ for GNUS
109 ;;;
110
111 (add-hook 'news-reply-mode-hook 'mime/editor-mode)
112 (add-hook 'news-inews-hook      'mime-editor/maybe-translate)
113
114
115 ;;; @ end
116 ;;;
117
118 (provide 'mime-setup)
119
120 (run-hooks 'mime-setup-load-hook)