annotate lisp/tm/mime-setup.el @ 16:0293115a14e9 r19-15b91

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