comparison lisp/tm/mime-setup.el @ 8:4b173ad71786 r19-15b5

Import from CVS: tag r19-15b5
author cvs
date Mon, 13 Aug 2007 08:47:35 +0200
parents
children 49a24b4fd526
comparison
equal deleted inserted replaced
7:c153ca296910 8:4b173ad71786
1 ;;; mime-setup.el --- setup file for tm viewer and composer.
2
3 ;; Copyright (C) 1995,1996 Free Software Foundation, Inc.
4
5 ;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
6 ;; Version:
7 ;; $Id: mime-setup.el,v 1.1 1996/12/22 00:36:44 steve Exp $
8 ;; Keywords: mail, news, MIME, multimedia, multilingual, encoded-word
9
10 ;; This file is part of tm (Tools for MIME).
11
12 ;; This program is free software; you can redistribute it and/or
13 ;; modify it under the terms of the GNU General Public License as
14 ;; published by the Free Software Foundation; either version 2, or (at
15 ;; your option) any later version.
16
17 ;; This program is distributed in the hope that it will be useful, but
18 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 ;; General Public License for more details.
21
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the
24 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
25 ;; Boston, MA 02111-1307, USA.
26
27 ;;; Code:
28
29 (require 'tm-setup)
30
31 (autoload 'mime/editor-mode "tm-edit"
32 "Minor mode for editing MIME message." t)
33 (autoload 'mime/decode-message-header "tm-ew-d"
34 "Decode MIME encoded-words in message header." t)
35
36 (defun mime-setup-decode-message-header ()
37 (save-excursion
38 (save-restriction
39 (goto-char (point-min))
40 (narrow-to-region
41 (point-min)
42 (if (re-search-forward
43 (concat "^" (regexp-quote mail-header-separator) "$")
44 nil t)
45 (match-beginning 0)
46 (point-max)
47 ))
48 (mime/decode-message-header)
49 (set-buffer-modified-p nil)
50 )))
51
52 (add-hook 'mime/editor-mode-hook 'mime-setup-decode-message-header)
53
54
55 ;;; @ variables
56 ;;;
57
58 (defvar mime-setup-use-sc nil
59 "If it is not nil, mime-setup requires sc-setup. [mime-setup.el]")
60
61 (defvar mime-setup-use-signature t
62 "If it is not nil, mime-setup sets up to use signature.el.
63 \[mime-setup.el]")
64
65 (defvar mime-setup-default-signature-key "\C-c\C-s"
66 "*Key to insert signature. [mime-setup.el]")
67
68 (defvar mime-setup-signature-key-alist '((mail-mode . "\C-c\C-w"))
69 "Alist of major-mode vs. key to insert signature. [mime-setup.el]")
70
71
72 ;;; @ for signature
73 ;;;
74
75 (defun mime-setup-set-signature-key ()
76 (let ((key (or (cdr (assq major-mode mime-setup-signature-key-alist))
77 mime-setup-default-signature-key)))
78 (define-key (current-local-map) key (function insert-signature))
79 ))
80
81 (if mime-setup-use-signature
82 (progn
83 (autoload 'insert-signature "signature" "Insert signature" t)
84 (add-hook 'mime/editor-mode-hook 'mime-setup-set-signature-key)
85 (setq gnus-signature-file nil)
86 (setq mail-signature nil)
87 (setq message-signature nil)
88 ))
89
90
91 ;;; @ about SuperCite
92 ;;;
93
94 (if mime-setup-use-sc
95 (require 'sc-setup)
96 )
97
98
99 ;;; @ for mu-cite
100 ;;;
101
102 (add-hook 'mu-cite/pre-cite-hook 'mime/decode-message-header)
103
104
105 ;;; @ for RMAIL and VM
106 ;;;
107
108 (add-hook 'mail-setup-hook 'mime/decode-message-header)
109 (add-hook 'mail-setup-hook 'mime/editor-mode 'append)
110 (add-hook 'mail-send-hook 'mime-editor/maybe-translate)
111
112
113 ;;; @ for mh-e
114 ;;;
115
116 (defun mime-setup-mh-draft-setting ()
117 (mime/editor-mode)
118 (make-local-variable 'mail-header-separator)
119 (setq mail-header-separator "--------")
120 (save-excursion
121 (goto-char (point-min))
122 (setq buffer-read-only nil)
123 (if (re-search-forward "^-*$" nil t)
124 (progn
125 (replace-match mail-header-separator)
126 (set-buffer-modified-p (buffer-modified-p))
127 ))
128 ))
129
130 (add-hook 'mh-letter-mode-hook 'mime-setup-mh-draft-setting t)
131 (add-hook 'mh-before-send-letter-hook 'mime-editor/maybe-translate)
132
133
134 ;;; @ for GNUS
135 ;;;
136
137 (add-hook 'news-reply-mode-hook 'mime/editor-mode)
138 (add-hook 'news-inews-hook 'mime-editor/maybe-translate)
139
140
141 ;;; @ for message (September Gnus 0.58 or later)
142 ;;;
143
144 (defun message-maybe-setup-default-charset ()
145 (let ((charset
146 (and (boundp 'gnus-summary-buffer)
147 (buffer-live-p gnus-summary-buffer)
148 (save-excursion
149 (set-buffer gnus-summary-buffer)
150 default-mime-charset))))
151 (if charset
152 (progn
153 (make-local-variable 'default-mime-charset)
154 (setq default-mime-charset charset)
155 ))))
156
157 (or (boundp 'epoch::version)
158 (progn
159 (add-hook 'message-setup-hook 'mime/editor-mode)
160 (add-hook 'message-setup-hook 'message-maybe-setup-default-charset)
161 (add-hook 'message-send-hook 'mime-editor/maybe-translate)
162 (add-hook 'message-header-hook 'mime/encode-message-header)
163
164 (call-after-loaded
165 'message
166 (function
167 (lambda ()
168 (require 'message-mime)
169 )))
170 ))
171
172
173 ;;; @ end
174 ;;;
175
176 (provide 'mime-setup)
177
178 (run-hooks 'mime-setup-load-hook)
179
180 ;;; mime-setup.el ends here
181 ;;;
182 ;;; Local Variables:
183 ;;; mode: emacs-lisp
184 ;;; End: