annotate lisp/tm/tm-rmail.el @ 74:54cc21c15cbb r20-0b32

Import from CVS: tag r20-0b32
author cvs
date Mon, 13 Aug 2007 09:04:33 +0200
parents 131b0175ea99
children 0d2f883870bc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
1 ;;; tm-rmail.el --- MIME extension for RMAIL
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
2
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
3 ;; Copyright (C) 1994,1995,1996 Free Software Foundation, Inc.
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
4
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
5 ;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
6 ;; modified by KOBAYASHI Shuhei <shuhei-k@jaist.ac.jp>
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
7 ;; Created: 1994/8/30
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
8 ;; Version: $Revision: 1.1.1.2 $
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
9 ;; Keywords: mail, MIME, multimedia, multilingual, encoded-word
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
10
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
11 ;; This file is not part of tm (Tools for MIME).
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
12
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
13 ;; This program is free software; you can redistribute it and/or
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
14 ;; modify it under the terms of the GNU General Public License as
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
15 ;; published by the Free Software Foundation; either version 2, or (at
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
16 ;; your option) any later version.
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
17
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
18 ;; This program is distributed in the hope that it will be useful, but
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
19 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
21 ;; General Public License for more details.
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
22
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
23 ;; You should have received a copy of the GNU General Public License
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
24 ;; along with GNU Emacs; see the file COPYING. If not, write to the
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
25 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
26 ;; Boston, MA 02111-1307, USA.
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
27
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
28 ;;; Code:
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
29
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
30 (require 'tl-list)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
31 (require 'tl-misc)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
32 (require 'rmail)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
33
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
34 (autoload 'mime/viewer-mode "tm-view" "View MIME message." t)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
35 (autoload 'mime/Content-Type "tm-view" "parse Content-Type field.")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
36 (autoload 'mime/decode-message-header "tm-ew-d" "Decode MIME encoded-word." t)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
37
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
38
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
39 ;;; @ variables
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
40 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
41
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
42 (defconst tm-rmail/RCS-ID
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
43 "$Id: tm-rmail.el,v 1.1.1.2 1996/12/21 20:50:48 steve Exp $")
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
44 (defconst tm-rmail/version (get-version-string tm-rmail/RCS-ID))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
45
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
46 (defvar tm-rmail/decode-all nil)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
47
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
48
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
49 ;;; @ message filter
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
50 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
51
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
52 (setq rmail-message-filter
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
53 (function
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
54 (lambda ()
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
55 (let ((mf (buffer-modified-p))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
56 (buffer-read-only nil))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
57 (mime/decode-message-header)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
58 (set-buffer-modified-p mf)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
59 ))))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
60
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
61
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
62 ;;; @ MIME preview
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
63 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
64
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
65 (defun tm-rmail/show-all-header-p ()
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
66 (save-restriction
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
67 (narrow-to-region (point-min)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
68 (and (re-search-forward "^$" nil t)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
69 (match-beginning 0)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
70 (goto-char (point-min))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
71 (re-search-forward rmail-ignored-headers nil t)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
72 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
73
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
74 (defun tm-rmail/preview-message ()
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
75 (interactive)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
76 (setq tm-rmail/decode-all t)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
77 (let ((ret (tm-rmail/get-Content-Type-and-Content-Transfer-Encoding)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
78 (narrow-to-region (point-min)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
79 (save-excursion
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
80 (goto-char (point-max))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
81 (if (and (re-search-backward "^\n")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
82 (eq (match-end 0)(point-max)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
83 (match-beginning 0)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
84 (point-max)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
85 )))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
86 (let ((abuf (current-buffer))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
87 (buf-name (format "*Preview-%s [%d/%d]*"
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
88 (buffer-name)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
89 rmail-current-message rmail-total-messages))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
90 buf win)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
91 (if (and mime::article/preview-buffer
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
92 (setq buf (get-buffer mime::article/preview-buffer))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
93 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
94 (progn
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
95 (save-excursion
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
96 (set-buffer buf)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
97 (rename-buffer buf-name)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
98 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
99 (if (setq win (get-buffer-window buf))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
100 (progn
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
101 (delete-window (get-buffer-window abuf))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
102 (set-window-buffer win abuf)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
103 (set-buffer abuf)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
104 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
105 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
106 (setq win (get-buffer-window abuf))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
107 (save-window-excursion
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
108 (mime/viewer-mode nil (car ret)(cdr ret) nil buf-name)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
109 (or buf
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
110 (setq buf (current-buffer))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
111 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
112 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
113 (set-window-buffer win buf)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
114 )))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
115
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
116 (defun tm-rmail/preview-message-if-you-need ()
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
117 (if tm-rmail/decode-all
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
118 (tm-rmail/preview-message)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
119 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
120
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
121 (add-hook 'rmail-show-message-hook 'tm-rmail/preview-message-if-you-need)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
122
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
123 (load "rmailsum")
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
124
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
125 (cond ((fboundp 'rmail-summary-rmail-update)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
126 ;; for Emacs 19 or later
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
127 (or (fboundp 'tm:rmail-summary-rmail-update)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
128 (fset 'tm:rmail-summary-rmail-update
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
129 (symbol-function 'rmail-summary-rmail-update))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
130 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
131
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
132 (defun rmail-summary-rmail-update ()
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
133 (tm:rmail-summary-rmail-update)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
134 (if tm-rmail/decode-all
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
135 (let ((win (get-buffer-window rmail-buffer)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
136 (if win
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
137 (delete-window win)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
138 )))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
139 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
140
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
141 (defun tm-rmail/get-Content-Type-and-Content-Transfer-Encoding ()
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
142 (rmail-widen-to-current-msgbeg
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
143 (function
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
144 (lambda ()
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
145 (cons (mime/Content-Type)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
146 (mime/Content-Transfer-Encoding "7bit")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
147 )))))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
148 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
149 (t
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
150 ;; for Emacs 18
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
151 (defun tm-rmail/get-Content-Type-and-Content-Transfer-Encoding ()
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
152 (save-restriction
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
153 (rmail-widen-to-current-msgbeg
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
154 (function
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
155 (lambda ()
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
156 (goto-char (point-min))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
157 (narrow-to-region (or (and (re-search-forward "^.+:" nil t)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
158 (match-beginning 0))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
159 (point-min))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
160 (point-max))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
161 )))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
162 (cons (mime/Content-Type)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
163 (mime/Content-Transfer-Encoding "7bit")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
164 )))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
165 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
166
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
167 (define-key rmail-mode-map "v" (function tm-rmail/preview-message))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
168
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
169 (defun tm-rmail/setup ()
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
170 (local-set-key "v" (function
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
171 (lambda ()
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
172 (interactive)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
173 (set-buffer rmail-buffer)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
174 (tm-rmail/preview-message)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
175 )))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
176 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
177
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
178 (add-hook 'rmail-summary-mode-hook 'tm-rmail/setup)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
179
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
180
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
181 ;;; @ over-to-* and quitting methods
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
182 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
183
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
184 (defun tm-rmail/quitting-method-to-summary ()
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
185 (mime-viewer/kill-buffer)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
186 (rmail-summary)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
187 (delete-other-windows)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
188 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
189
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
190 (defun tm-rmail/quitting-method-to-article ()
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
191 (setq tm-rmail/decode-all nil)
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 22
diff changeset
192 (mime-viewer/kill-buffer)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 22
diff changeset
193 )
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
194
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
195 (defalias 'tm-rmail/quitting-method 'tm-rmail/quitting-method-to-article)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
196
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
197
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
198 (defun tm-rmail/over-to-previous-method ()
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
199 (let (tm-rmail/decode-all)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
200 (mime-viewer/quit)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
201 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
202 (if (not (eq (rmail-next-undeleted-message -1) t))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
203 (tm-rmail/preview-message)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
204 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
205 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
206
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
207 (defun tm-rmail/over-to-next-method ()
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
208 (let (tm-rmail/decode-all)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
209 (mime-viewer/quit)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
210 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
211 (if (not (eq (rmail-next-undeleted-message 1) t))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
212 (tm-rmail/preview-message)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
213 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
214 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
215
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
216 (defun tm-rmail/show-summary-method ()
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
217 (save-excursion
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
218 (set-buffer mime::preview/article-buffer)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
219 (rmail-summary)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
220 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
221
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
222 (call-after-loaded
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
223 'tm-view
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
224 (function
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
225 (lambda ()
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
226 (set-alist 'mime-viewer/quitting-method-alist
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
227 'rmail-mode
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
228 (function tm-rmail/quitting-method))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
229
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
230 (set-alist 'mime-viewer/over-to-previous-method-alist
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
231 'rmail-mode
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
232 (function tm-rmail/over-to-previous-method))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
233
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
234 (set-alist 'mime-viewer/over-to-next-method-alist
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
235 'rmail-mode
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
236 (function tm-rmail/over-to-next-method))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
237
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
238 (set-alist 'mime-viewer/show-summary-method
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
239 'rmail-mode
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
240 (function tm-rmail/show-summary-method))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
241 )))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
242
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
243
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
244 ;;; @ for tm-partial
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
245 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
246
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
247 (call-after-loaded
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
248 'tm-partial
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
249 (function
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
250 (lambda ()
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
251 (set-atype 'mime/content-decoding-condition
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
252 '((type . "message/partial")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
253 (method . mime-article/grab-message/partials)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
254 (major-mode . rmail-mode)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
255 (summary-buffer-exp
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
256 . (progn
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
257 (rmail-summary)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
258 (pop-to-buffer rmail-buffer)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
259 rmail-summary-buffer))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
260 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
261 (set-alist 'tm-partial/preview-article-method-alist
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
262 'rmail-mode
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
263 (function
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
264 (lambda ()
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
265 (rmail-summary-goto-msg (count-lines 1 (point)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
266 (pop-to-buffer rmail-buffer)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
267 (tm-rmail/preview-message)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
268 )))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
269 )))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
270
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
271
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
272 ;;; @ for tm-edit
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
273 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
274
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
275 (defun tm-rmail/forward ()
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
276 "Forward current message in message/rfc822 content-type message
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
277 from rmail. The message will be appended if being composed."
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
278 (interactive)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
279 ;;>> this gets set even if we abort. Can't do anything about it, though.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
280 (rmail-set-attribute "forwarded" t)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
281 (let ((initialized nil)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
282 (beginning nil)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
283 (msgnum rmail-current-message)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
284 (rmail-buffer (current-buffer))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
285 (subject (concat "["
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
286 (mail-strip-quoted-names
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
287 (mail-fetch-field "From"))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
288 ": " (or (mail-fetch-field "Subject") "") "]")))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
289 ;; If only one window, use it for the mail buffer.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
290 ;; Otherwise, use another window for the mail buffer
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
291 ;; so that the Rmail buffer remains visible
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
292 ;; and sending the mail will get back to it.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
293 (setq initialized
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
294 (if (one-window-p t)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
295 (mail nil nil subject)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
296 (mail-other-window nil nil subject)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
297 (save-excursion
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
298 ;; following two variables are used in 19.29 or later.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
299 (make-local-variable 'rmail-send-actions-rmail-buffer)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
300 (make-local-variable 'rmail-send-actions-rmail-msg-number)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
301 (make-local-variable 'mail-reply-buffer)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
302 (setq rmail-send-actions-rmail-buffer rmail-buffer)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
303 (setq rmail-send-actions-rmail-msg-number msgnum)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
304 (setq mail-reply-buffer rmail-buffer)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
305 (goto-char (point-max))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
306 (forward-line 1)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
307 (setq beginning (point))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
308 (mime-editor/insert-tag "message" "rfc822")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
309 ;; (insert-buffer rmail-buffer))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
310 ;; (mime-editor/inserted-message-filter))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
311 (tm-mail/insert-message))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
312 (if (not initialized)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
313 (goto-char beginning))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
314 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
315
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
316 (defun gnus-mail-forward-using-mail-mime ()
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
317 "Forward current article in message/rfc822 content-type message from
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
318 GNUS. The message will be appended if being composed."
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
319 (let ((initialized nil)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
320 (beginning nil)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
321 (forwarding-buffer (current-buffer))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
322 (subject
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
323 (concat "[" gnus-newsgroup-name "] "
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
324 ;;(mail-strip-quoted-names (gnus-fetch-field "From")) ": "
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
325 (or (gnus-fetch-field "Subject") ""))))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
326 ;; If only one window, use it for the mail buffer.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
327 ;; Otherwise, use another window for the mail buffer
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
328 ;; so that the Rmail buffer remains visible
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
329 ;; and sending the mail will get back to it.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
330 (setq initialized
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
331 (if (one-window-p t)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
332 (mail nil nil subject)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
333 (mail-other-window nil nil subject)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
334 (save-excursion
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
335 (goto-char (point-max))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
336 (setq beginning (point))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
337 (mime-editor/insert-tag "message" "rfc822")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
338 (insert-buffer forwarding-buffer)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
339 ;; You have a chance to arrange the message.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
340 (run-hooks 'gnus-mail-forward-hook)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
341 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
342 (if (not initialized)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
343 (goto-char beginning))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
344 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
345
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
346 (call-after-loaded
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
347 'mime-setup
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
348 (function
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
349 (lambda ()
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
350 (substitute-key-definition
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
351 'rmail-forward 'tm-rmail/forward rmail-mode-map)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
352
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
353 ;; (setq gnus-mail-forward-method 'gnus-mail-forward-using-mail-mime)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
354
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
355 (call-after-loaded
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
356 'tm-edit
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
357 (function
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
358 (lambda ()
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
359 (require 'tm-mail)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
360 (set-alist 'mime-editor/message-inserter-alist
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
361 'mail-mode (function tm-mail/insert-message))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
362 (set-alist 'mime-editor/split-message-sender-alist
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
363 'mail-mode (function
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
364 (lambda ()
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
365 (interactive)
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
366 (funcall send-mail-function)
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
367 )))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
368 )))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
369 )))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
370
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
371
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
372 ;;; @ for BBDB
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
373 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
374
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
375 (call-after-loaded
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
376 'bbdb
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
377 (function
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
378 (lambda ()
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
379 (require 'tm-bbdb)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
380 )))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
381
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
382
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
383 ;;; @ end
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
384 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
385
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
386 (provide 'tm-rmail)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
387
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
388 (run-hooks 'tm-rmail-load-hook)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
389
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
390 ;;; tm-rmail.el ends here.