comparison lisp/tl/mime-setup.el @ 4:b82b59fe008d r19-15b3

Import from CVS: tag r19-15b3
author cvs
date Mon, 13 Aug 2007 08:46:56 +0200
parents
children
comparison
equal deleted inserted replaced
3:30df88044ec6 4:b82b59fe008d
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.1.1 1996/12/18 03:55:31 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
30 (require 'tl-misc)
31
32 (defvar mime-viewer/external-progs
33 (expand-file-name "lib-src" data-directory))
34 (require 'tm-setup)
35
36 (autoload 'mime/editor-mode "tm-edit"
37 "Minor mode for editing MIME message." t)
38 (autoload 'mime/decode-message-header "tm-ew-d"
39 "Decode MIME encoded-words in message header." t)
40
41 (defun mime-setup-decode-message-header ()
42 (save-excursion
43 (save-restriction
44 (goto-char (point-min))
45 (narrow-to-region
46 (point-min)
47 (if (re-search-forward
48 (concat "^" (regexp-quote mail-header-separator) "$")
49 nil t)
50 (match-beginning 0)
51 (point-max)
52 ))
53 (mime/decode-message-header)
54 (set-buffer-modified-p nil)
55 )))
56
57 (add-hook 'mime/editor-mode-hook 'mime-setup-decode-message-header)
58
59
60 ;;; @ variables
61 ;;;
62
63 (defvar mime-setup-use-sc nil
64 "If it is not nil, mime-setup requires sc-setup. [mime-setup.el]")
65
66 (defvar mime-setup-use-signature t
67 "If it is not nil, mime-setup sets up to use signature.el.
68 \[mime-setup.el]")
69
70 (defvar mime-setup-default-signature-key "\C-c\C-s"
71 "*Key to insert signature. [mime-setup.el]")
72
73 (defvar mime-setup-signature-key-alist '((mail-mode . "\C-c\C-w"))
74 "Alist of major-mode vs. key to insert signature. [mime-setup.el]")
75
76
77 ;;; @ for signature
78 ;;;
79
80 (defun mime-setup-set-signature-key ()
81 (let ((key (or (cdr (assq major-mode mime-setup-signature-key-alist))
82 mime-setup-default-signature-key)))
83 (define-key (current-local-map) key (function insert-signature))
84 ))
85
86 (if mime-setup-use-signature
87 (progn
88 (autoload 'insert-signature "signature" "Insert signature" t)
89 (add-hook 'mime/editor-mode-hook 'mime-setup-set-signature-key)
90 (setq gnus-signature-file nil)
91 (setq mail-signature nil)
92 (setq message-signature nil)
93 ))
94
95
96 ;;; @ about SuperCite
97 ;;;
98
99 (if mime-setup-use-sc
100 (require 'sc-setup)
101 )
102
103
104 ;;; @ for mu-cite
105 ;;;
106
107 (add-hook 'mu-cite/pre-cite-hook 'mime/decode-message-header)
108
109
110 ;;; @ for RMAIL and VM
111 ;;;
112
113 (add-hook 'mail-setup-hook 'mime/decode-message-header)
114 (add-hook 'mail-setup-hook 'mime/editor-mode 'append)
115 (add-hook 'mail-send-hook 'mime-editor/maybe-translate)
116
117
118 ;;; @ for mh-e
119 ;;;
120
121 (defun mime-setup-mh-draft-setting ()
122 (mime/editor-mode)
123 (make-local-variable 'mail-header-separator)
124 (setq mail-header-separator "--------")
125 (save-excursion
126 (goto-char (point-min))
127 (setq buffer-read-only nil)
128 (if (re-search-forward "^-*$" nil t)
129 (progn
130 (replace-match mail-header-separator)
131 (set-buffer-modified-p (buffer-modified-p))
132 ))
133 ))
134
135 (add-hook 'mh-letter-mode-hook 'mime-setup-mh-draft-setting t)
136 (add-hook 'mh-before-send-letter-hook 'mime-editor/maybe-translate)
137
138
139 ;;; @ for GNUS
140 ;;;
141
142 (add-hook 'news-reply-mode-hook 'mime/editor-mode)
143 (add-hook 'news-inews-hook 'mime-editor/maybe-translate)
144
145
146 ;;; @ for message (September Gnus 0.58 or later)
147 ;;;
148
149 (defun message-maybe-setup-default-charset ()
150 (let ((charset
151 (and (boundp 'gnus-summary-buffer)
152 (buffer-live-p gnus-summary-buffer)
153 (save-excursion
154 (set-buffer gnus-summary-buffer)
155 default-mime-charset))))
156 (if charset
157 (progn
158 (make-local-variable 'default-mime-charset)
159 (setq default-mime-charset charset)
160 ))))
161
162 (or (boundp 'epoch::version)
163 (progn
164 (add-hook 'message-setup-hook 'mime/editor-mode)
165 (add-hook 'message-setup-hook 'message-maybe-setup-default-charset)
166 (add-hook 'message-send-hook 'mime-editor/maybe-translate)
167 (add-hook 'message-header-hook 'mime/encode-message-header)
168
169 (call-after-loaded
170 'message
171 (function
172 (lambda ()
173 (require 'message-mime)
174 )))
175 ))
176
177
178 ;;; @ end
179 ;;;
180
181 (provide 'mime-setup)
182
183 (run-hooks 'mime-setup-load-hook)
184
185 ;;; mime-setup.el ends here
186 ;;;
187 ;;; Local Variables:
188 ;;; mode: emacs-lisp
189 ;;; End: