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