tm 7.67.
[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 .. 1996 MORIOKA Tomohiko
6 ;;;
7 ;;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
8 ;;; Version:
9 ;;;     $Id: mime-setup.el,v 7.14 1996/02/14 09:15:36 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 ;;; Code:
29
30 (require 'tm-setup)
31
32 (autoload 'mime/editor-mode "tm-edit"
33   "Minor mode for editing MIME message." t)
34 (autoload 'mime/decode-message-header "tm-ew-d"
35   "Decode MIME encoded-words in message header." t)
36
37 (defun mime-setup-decode-message-header ()
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 (add-hook 'mime/editor-mode-hook 'mime-setup-decode-message-header)
54
55
56 ;;; @ variables
57 ;;;
58
59 (defvar mime-setup-use-sc nil)
60 (defvar mime-setup-use-signature t)
61 (defvar mime-setup-default-signature-key "\C-c\C-s")
62 (defvar mime-setup-signature-key-alist '((mail-mode . "\C-c\C-w")))
63
64
65 ;;; @ for signature
66 ;;;
67
68 (defun mime-setup-set-signature-key ()
69   (let ((key (or (cdr (assq major-mode mime-setup-signature-key-alist))
70                  mime-setup-default-signature-key)))
71     (define-key (current-local-map) key (function insert-signature))
72     ))
73
74 (if mime-setup-use-signature
75     (progn
76       (autoload 'insert-signature "signature" "Insert signature" t)
77       (add-hook 'mime/editor-mode-hook 'mime-setup-set-signature-key)
78       (setq gnus-signature-file nil)
79       (setq mail-signature nil)
80       ))
81
82
83 ;;; @ about SuperCite
84 ;;;
85
86 (if mime-setup-use-sc
87     (require 'sc-setup)
88   )
89
90
91 ;;; @ for RMAIL and VM
92 ;;;
93
94 (add-hook 'mail-setup-hook 'mime/decode-message-header)
95 (add-hook 'mail-setup-hook 'mime/editor-mode 'append)
96 (add-hook 'mail-send-hook  'mime-editor/maybe-translate)
97
98
99 ;;; @ for mh-e
100 ;;;
101
102 (defun mime-setup-mh-draft-setting ()
103   (mime/editor-mode)
104   (make-local-variable 'mail-header-separator)
105   (setq mail-header-separator "--------")
106   (save-excursion
107     (goto-char (point-min))
108     (setq buffer-read-only nil)
109     (if (re-search-forward "^-*$" nil t)
110         (progn
111           (replace-match mail-header-separator)
112           (set-buffer-modified-p (buffer-modified-p))
113           ))
114     ))
115
116 (add-hook 'mh-letter-mode-hook 'mime-setup-mh-draft-setting t)
117 (add-hook 'mh-before-send-letter-hook 'mime-editor/maybe-translate)
118
119
120 ;;; @ for GNUS
121 ;;;
122
123 (add-hook 'news-reply-mode-hook 'mime/editor-mode)
124 (add-hook 'news-inews-hook      'mime-editor/maybe-translate)
125
126
127 ;;; @ end
128 ;;;
129
130 (provide 'mime-setup)
131
132 (run-hooks 'mime-setup-load-hook)
133
134 ;;; mime-setup.el ends here