annotate lisp/vm/vm-reply.el @ 98:0d2f883870bc r20-1b1

Import from CVS: tag r20-1b1
author cvs
date Mon, 13 Aug 2007 09:13:56 +0200
parents c0c698873ce1
children 4be1180a9e89
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 ;;; Mailing, forwarding, and replying commands for VM
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
2 ;;; Copyright (C) 1989-1997 Kyle E. Jones
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 ;;; This program is free software; you can redistribute it and/or modify
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 ;;; it under the terms of the GNU General Public License as published by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 ;;; the Free Software Foundation; either version 1, or (at your option)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 ;;; any later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 ;;; This program is distributed in the hope that it will be useful,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 ;;; GNU General Public License for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 ;;; You should have received a copy of the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 ;;; along with this program; if not, write to the Free Software
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 ;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 (provide 'vm-reply)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 (defun vm-do-reply (to-all include-text count)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 (let ((mlist (vm-select-marked-or-prefixed-messages count))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 (dir default-directory)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 (message-pointer vm-message-pointer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 (case-fold-search t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 to cc subject mp in-reply-to references tmp tmp2 newsgroups)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 (setq mp mlist)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 (while mp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 ((eq mlist mp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 (cond ((setq to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 (let ((reply-to
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
32 (vm-get-header-contents (car mp) "Reply-To:"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
33 ", ")))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 (if (vm-ignored-reply-to reply-to)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 reply-to ))))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
37 ((setq to (vm-get-header-contents (car mp) "From:" ", ")))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 ;; bad, but better than nothing for some
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 ((setq to (vm-grok-From_-author (car mp))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 (t (error "No From: or Reply-To: header in message")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 (setq subject (vm-get-header-contents (car mp) "Subject:")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 in-reply-to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 (and vm-in-reply-to-format
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 (let ((vm-summary-uninteresting-senders nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 (vm-sprintf 'vm-in-reply-to-format (car mp))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 in-reply-to (and (not (equal "" in-reply-to)) in-reply-to))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 (and subject vm-reply-subject-prefix
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 (let ((case-fold-search t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 (not
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 (equal
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 (string-match (regexp-quote vm-reply-subject-prefix)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 subject)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 0)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 (setq subject (concat vm-reply-subject-prefix subject))))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
55 (t (cond ((setq tmp (vm-get-header-contents (car mp) "Reply-To:"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
56 ", "))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 (setq to (concat to "," tmp)))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
58 ((setq tmp (vm-get-header-contents (car mp) "From:"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
59 ", "))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 (setq to (concat to "," tmp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 ;; bad, but better than nothing for some
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 ((setq tmp (vm-grok-From_-author (car mp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 (setq to (concat to "," tmp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 (t (error "No From: or Reply-To: header in message")))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 (if to-all
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 (progn
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
67 (setq tmp (vm-get-header-contents (car mp) "To:"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
68 ", "))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
69 (setq tmp2 (vm-get-header-contents (car mp) "Cc:"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
70 ", "))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 (if tmp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 (if cc
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 (setq cc (concat cc "," tmp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 (setq cc tmp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 (if tmp2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 (if cc
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 (setq cc (concat cc "," tmp2))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 (setq cc tmp2)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 (setq references
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
80 (cons (vm-get-header-contents (car mp) "References:" " ")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
81 (cons (vm-get-header-contents (car mp) "In-reply-to:" " ")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
82 (cons (vm-get-header-contents (car mp) "Message-ID:"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
83 " ")
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 references))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 (setq newsgroups
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
86 (cons (or (and to-all (vm-get-header-contents (car mp) "Followup-To:" ","))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
87 (vm-get-header-contents (car mp) "Newsgroups:" ","))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 newsgroups))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 (setq mp (cdr mp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 (if vm-strip-reply-headers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 (let ((mail-use-rfc822 t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 (and to (setq to (mail-strip-quoted-names to)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 (and cc (setq cc (mail-strip-quoted-names cc)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 (setq to (vm-parse-addresses to)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 cc (vm-parse-addresses cc))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 (if vm-reply-ignored-addresses
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 (setq to (vm-strip-ignored-addresses to)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 cc (vm-strip-ignored-addresses cc)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 (setq to (vm-delete-duplicates to nil t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 (setq cc (vm-delete-duplicates
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 (append (vm-delete-duplicates cc nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 to (copy-sequence to))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 t t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 (and to (setq to (mapconcat 'identity to ",\n ")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 (and cc (setq cc (mapconcat 'identity cc ",\n ")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 (and (null to) (setq to cc cc nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 (setq references (delq nil references)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 references (mapconcat 'identity references " ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 references (vm-parse references "[^<]*\\(<[^>]+>\\)")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 references (vm-delete-duplicates references)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 references (if references (mapconcat 'identity references "\n\t")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 (setq newsgroups (delq nil newsgroups)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 newsgroups (mapconcat 'identity newsgroups ",")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 newsgroups (vm-parse newsgroups "[ \t\f\r\n,]*\\([^ \t\f\r\n,]+\\)")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 newsgroups (vm-delete-duplicates newsgroups)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 newsgroups (if newsgroups (mapconcat 'identity newsgroups ",")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 (vm-mail-internal
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 (format "reply to %s%s" (vm-su-full-name (car mlist))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 (if (cdr mlist) ", ..." ""))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 to subject in-reply-to cc references newsgroups)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 (make-local-variable 'vm-reply-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 (setq vm-system-state 'replying
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 vm-reply-list mlist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 default-directory dir)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 (if include-text
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 (let ((case-fold-search nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 (re-search-forward
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 (concat "^" (regexp-quote mail-header-separator) "$") nil 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 (forward-char 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 (while mlist
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
133 (vm-yank-message (car mlist))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
134 (goto-char (point-max))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 (setq mlist (cdr mlist)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 (run-hooks 'vm-reply-hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 (run-hooks 'vm-mail-mode-hook)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 (defun vm-strip-ignored-addresses (addresses)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 (setq addresses (copy-sequence addresses))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 (let (re-list list addr-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 (setq re-list vm-reply-ignored-addresses)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 (while re-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 (setq addr-list addresses)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 (while addr-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 (if (string-match (car re-list) (car addr-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 (setq addresses (delq (car addr-list) addresses)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 (setq addr-list (cdr addr-list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 (setq re-list (cdr re-list))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 addresses )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 (defun vm-ignored-reply-to (reply-to)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 (if reply-to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 (let (re-list result)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 (setq re-list vm-reply-ignored-reply-tos)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 (while re-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 (if (string-match (car re-list) reply-to)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 (setq result t re-list nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 (setq re-list (cdr re-list))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 result )))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 (defun vm-mail-yank-default (message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 (vm-reorder-message-headers nil vm-included-text-headers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 vm-included-text-discard-header-regexp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 ;; if all the headers are gone, delete the trailing blank line, too.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 (if (eq (following-char) ?\n)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 (delete-char 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 (if vm-included-text-attribution-format
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 (let ((vm-summary-uninteresting-senders nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 (insert (vm-sprintf 'vm-included-text-attribution-format message))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 ; turn off zmacs-regions for Lucid Emacs 19
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 ; and get around transient-mark-mode in FSF Emacs 19
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 ; all this so that (mark) does what it did in v18, sheesh.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 (let* ((zmacs-regions nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 (mark-even-if-inactive t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 (end (mark-marker)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 (while (< (point) end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 (insert vm-included-text-prefix)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 (forward-line 1)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 (defun vm-yank-message-other-folder (folder)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 "Like vm-yank-message except the message is yanked from a folder other
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 than the one that spawned the current Mail mode buffer. The name of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 folder is read from the minibuffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 Don't call this function from a program."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 (interactive
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 (list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 (let ((dir (if vm-folder-directory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 (expand-file-name vm-folder-directory)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 default-directory))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 (last-command last-command)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 (this-command this-command))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 (read-file-name "Yank from folder: " dir nil t))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 (let ((b (current-buffer)) newbuf sumbuf default result prompt mp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 (set-buffer (or (vm-get-file-buffer folder) (find-file-noselect folder)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 (setq newbuf (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 (if (not (eq major-mode 'vm-mode))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 (vm-mode))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
201 (if vm-presentation-buffer-handle
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
202 (vm-bury-buffer vm-presentation-buffer-handle))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 (if (null vm-message-pointer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 (error "No messages in folder %s" folder))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 (setq default (vm-number-of (car vm-message-pointer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 (save-window-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 (save-window-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 (vm-summarize))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 (vm-display vm-summary-buffer t '(vm-yank-message-other-folder)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 '(vm-yank-message-other-folder composing-message))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 (setq sumbuf (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 (setq prompt (format "Yank message number: (default %s) " default)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 result 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 (while (zerop result)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 (setq result (read-string prompt))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 (and (string= result "") default (setq result default))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 (setq result (string-to-int result)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 (if (null (setq mp (nthcdr (1- result) vm-message-list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 (error "No such message."))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 (set-buffer b)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 (unwind-protect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 (let ((vm-mail-buffer newbuf))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 (vm-yank-message (car mp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 (vm-bury-buffer newbuf)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 (vm-bury-buffer sumbuf))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228 (defun vm-yank-message (message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 "Yank message number N into the current buffer at point.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 When called interactively N is always read from the minibuffer. When
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 called non-interactively the first argument is expected to be a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 message struct.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 This command is meant to be used in VM created Mail mode buffers; the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 yanked message comes from the mail buffer containing the message you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 are replying to, forwarding, or invoked VM's mail command from.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 All message headers are yanked along with the text. Point is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 left before the inserted text, the mark after. Any hook
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240 functions bound to mail-citation-hook are run, after inserting
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 the text and setting point and mark. For backward compatibility,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 if mail-citation-hook is set to nil, `mail-yank-hooks' is run
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 instead.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 If mail-citation-hook and mail-yank-hooks are both nil, this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 default action is taken: the yanked headers are trimmed as
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 specified by vm-included-text-headers and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 vm-included-text-discard-header-regexp, and the value of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 vm-included-text-prefix is prepended to every yanked line."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 (interactive
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 (list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252 ;; What we really want for the first argument is a message struct,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 ;; but if called interactively, we let the user type in a message
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 ;; number instead.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255 (let (mp default
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 (result 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 prompt
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 (last-command last-command)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 (this-command this-command))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 (vm-select-folder-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 (setq default (and vm-message-pointer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263 (vm-number-of (car vm-message-pointer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264 prompt (if default
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 (format "Yank message number: (default %s) "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266 default)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 "Yank message number: "))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 (while (zerop result)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 (setq result (read-string prompt))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 (and (string= result "") default (setq result default))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271 (setq result (string-to-int result)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 (if (null (setq mp (nthcdr (1- result) vm-message-list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273 (error "No such message.")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274 (car mp))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275 (if (not (bufferp vm-mail-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276 (error "This is not a VM Mail mode buffer."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277 (if (null (buffer-name vm-mail-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278 (error "The folder buffer containing message %d has been killed."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279 (vm-number-of message)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280 (vm-display nil nil '(vm-yank-message) '(vm-yank-message composing-message))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281 (setq message (vm-real-message-of message))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282 (let ((b (current-buffer)) (start (point)) end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284 (widen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285 (save-excursion
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
286 (if (vectorp (vm-mm-layout message))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
287 (let* ((o (vm-mm-layout message))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
288 (type (car (vm-mm-layout-type o)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
289 parts)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
290 (vm-insert-region-from-buffer (vm-buffer-of message)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
291 (vm-headers-of message)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
292 (vm-text-of message))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
293 (cond ((vm-mime-types-match "multipart" type)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
294 (setq parts (vm-mm-layout-parts o)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
295 (t (setq parts (list o))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
296 (while parts
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
297 (cond ((vm-mime-text-type-p (car parts))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
298 (if (vm-mime-display-internal-text/plain (car parts) t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
299 nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
300 ;; charset problems probably
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
301 ;; just dump the raw bits
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
302 (vm-mime-insert-mime-body (car parts))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
303 (vm-mime-transfer-decode-region (car parts)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
304 start (point)))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
305 (setq parts (cdr parts)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
306 (setq end (point-marker)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
307 (set-buffer (vm-buffer-of message))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
308 (save-restriction
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
309 (widen)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
310 (append-to-buffer b (vm-headers-of message)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
311 (vm-text-end-of message))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
312 (setq end (vm-marker (+ start (- (vm-text-end-of message)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
313 (vm-headers-of message))) b)))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314 (push-mark end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315 (cond (mail-citation-hook (run-hooks 'mail-citation-hook))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316 (mail-yank-hooks (run-hooks 'mail-yank-hooks))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317 (t (vm-mail-yank-default message))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319 (defun vm-mail-send-and-exit (arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
320 "Just like mail-send-and-exit except that VM flags the appropriate message(s)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
321 as having been replied to, if appropriate."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322 (interactive "P")
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
323 (vm-check-for-killed-folder)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324 (let ((b (current-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325 (vm-mail-send)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
326 (cond ((null (buffer-name b)) ;; dead buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
327 (vm-display nil nil '(vm-mail-send-and-exit)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
328 '(vm-mail-send-and-exit
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
329 reading-message
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
330 startup)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332 (vm-display b nil '(vm-mail-send-and-exit)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333 '(vm-mail-send-and-exit reading-message startup))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334 (vm-bury-buffer b)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336 (defun vm-keep-mail-buffer (buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337 ;; keep this buffer if the user demands it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338 (if (memq buffer vm-kept-mail-buffers)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339 (setq vm-kept-mail-buffers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340 (delq buffer vm-kept-mail-buffers)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341 (setq vm-kept-mail-buffers (cons buffer vm-kept-mail-buffers)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342 vm-kept-mail-buffers (vm-delete 'buffer-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343 vm-kept-mail-buffers t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344 (if (not (eq vm-keep-sent-messages t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345 (let ((extras (nthcdr (or vm-keep-sent-messages 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346 vm-kept-mail-buffers)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347 (mapcar (function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348 (lambda (b)
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
349 (and (buffer-name b) (kill-buffer b))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350 extras)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351 (and vm-kept-mail-buffers extras
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352 (setcdr (memq (car extras) vm-kept-mail-buffers) nil)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354 (defun vm-help-tale ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
356 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357 (while (vm-match-header)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
358 (if (not (vm-match-header "To:\\|Resent-To:\\|Cc:\\|Resent-Cc:"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359 (goto-char (vm-matched-header-end))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360 (goto-char (vm-matched-header-contents-start))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
361 (if (re-search-forward "[^, \t][ \t]*\n[ \t\n]+[^ \t\n]"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362 (vm-matched-header-contents-end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363 t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364 (error "tale is an idiot, and so are you. :-)"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365 (goto-char (vm-matched-header-end))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367 (defun vm-mail-send ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368 "Just like mail-send except that VM flags the appropriate message(s)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369 as replied to, forwarded, etc, if appropriate."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
371 (if vm-tale-is-an-idiot
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372 (vm-help-tale))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
373 ;; protect value of this-command from minibuffer read
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
374 (let ((this-command this-command))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
375 (if (and vm-confirm-mail-send
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
376 (not (y-or-n-p "Send the message? ")))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
377 (error "Message not sent.")))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
378 ;; send mail using MIME if user requests it and if the buffer
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
379 ;; has not already been MIME encoded.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
380 (if (and vm-send-using-mime
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
381 (null (vm-mail-mode-get-header-contents "MIME-Version:")))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
382 (vm-mime-encode-composition))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
383 ;; this to prevent Emacs 19 from asking whether a message that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
384 ;; has already been sent should be sent again. VM renames mail
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
385 ;; buffers after the message has been sent, so the user should
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386 ;; already know that the message has been sent.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
387 (set-buffer-modified-p t)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
388 (let ((composition-buffer (current-buffer))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
389 ;; preserve these in case the composition buffer gets
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
390 ;; killed.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
391 (vm-reply-list vm-reply-list)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
392 (vm-forward-list vm-forward-list)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
393 (vm-redistribute-list vm-redistribute-list))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
394 ;; fragment message using message/partial if it is too big.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
395 (if (and vm-send-using-mime
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
396 (integerp vm-mime-max-message-size)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
397 (> (buffer-size) vm-mime-max-message-size))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
398 (let (list)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
399 (setq list (vm-mime-fragment-composition vm-mime-max-message-size))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
400 (while list
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
401 (save-excursion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
402 (set-buffer (car list))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
403 (vm-mail-send)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
404 (kill-buffer (car list)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
405 (setq list (cdr list)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
406 ;; what mail-send would have done
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
407 (set-buffer-modified-p nil))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
408 ;; don't want a buffer change to occur here
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
409 ;; save-excursion to be sure.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
410 ;;
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
411 ;; also protect value of this-command from minibuffer reads
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
412 (let ((this-command this-command))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
413 (save-excursion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
414 (mail-send))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
415 (cond ((eq vm-system-state 'replying)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
416 (vm-mail-mark-replied))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
417 ((eq vm-system-state 'forwarding)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
418 (vm-mail-mark-forwarded))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
419 ((eq vm-system-state 'redistributing)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
420 (vm-mail-mark-redistributed)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
421 ;; be careful, something could have killed the composition
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
422 ;; buffer inside mail-send.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
423 (if (eq (current-buffer) composition-buffer)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
424 (progn
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
425 (vm-rename-current-mail-buffer)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
426 (vm-keep-mail-buffer (current-buffer))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
427 (vm-display nil nil '(vm-mail-send) '(vm-mail-send))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
428
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
429 (defun vm-mail-mode-get-header-contents (header-name-regexp)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
430 (let ((contents nil)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
431 regexp)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
432 (setq regexp (concat "^\\(" header-name-regexp "\\)\\|\\(^"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
433 (regexp-quote mail-header-separator) "$\\)"))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
434 (save-excursion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
435 (save-restriction
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
436 (widen)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
437 (goto-char (point-min))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
438 (let ((case-fold-search t))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
439 (if (and (re-search-forward regexp nil t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
440 (match-beginning 1)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
441 (progn (goto-char (match-beginning 0))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
442 (vm-match-header)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
443 (vm-matched-header-contents)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
444 nil ))))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
445
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
446 (defun vm-rename-current-mail-buffer ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
447 (if vm-rename-current-buffer-function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
448 (funcall vm-rename-current-buffer-function)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
449 (let ((case-fold-search nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
450 (if (not (string-match "^sent " (buffer-name)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
451 (let (prefix name n)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
452 (if (not (= ?* (aref (buffer-name) 0)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
453 (setq prefix (format "sent %s" (buffer-name)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
454 (let (recipients)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
455 (cond ((not (zerop (length (setq recipients
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
456 (mail-fetch-field "To"))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
457 ((not (zerop (length (setq recipients
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
458 (mail-fetch-field "Cc"))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
459 ((not (zerop (length (setq recipients
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
460 (mail-fetch-field "Bcc"))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
461 ; can't happen?!?
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
462 (t (setq recipients "the horse with no name")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
463 (setq prefix (format "sent mail to %s" recipients))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
464 (if (> (length prefix) 44)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
465 (setq prefix (concat (substring prefix 0 40) " ...")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
466 (setq name prefix n 2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
467 (while (get-buffer name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
468 (setq name (format "%s<%d>" prefix n))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
469 (vm-increment n))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
470 (rename-buffer name))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
471
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
472 (defun vm-mail-mark-replied ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
473 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
474 (let ((mp vm-reply-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
475 (while mp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
476 (if (null (buffer-name (vm-buffer-of (car mp))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
477 ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
478 (set-buffer (vm-buffer-of (car mp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
479 (cond ((and (memq (car mp) vm-message-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
480 (null (vm-replied-flag (car mp))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
481 (vm-set-replied-flag (car mp) t))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
482 (setq mp (cdr mp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
483 (vm-update-summary-and-mode-line))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
484
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
485 (defun vm-mail-mark-forwarded ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
486 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
487 (let ((mp vm-forward-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
488 (while mp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
489 (if (null (buffer-name (vm-buffer-of (car mp))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
490 ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
491 (set-buffer (vm-buffer-of (car mp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
492 (cond ((and (memq (car mp) vm-message-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
493 (null (vm-forwarded-flag (car mp))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
494 (vm-set-forwarded-flag (car mp) t))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
495 (setq mp (cdr mp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
496 (vm-update-summary-and-mode-line))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
497
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
498 (defun vm-mail-mark-redistributed ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
499 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
500 (let ((mp vm-redistribute-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
501 (while mp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
502 (if (null (buffer-name (vm-buffer-of (car mp))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
503 ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
504 (set-buffer (vm-buffer-of (car mp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
505 (cond ((and (memq (car mp) vm-message-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
506 (null (vm-redistributed-flag (car mp))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
507 (vm-set-redistributed-flag (car mp) t))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
508 (setq mp (cdr mp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
509 (vm-update-summary-and-mode-line))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
510
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
511 (defun vm-reply (count)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
512 "Reply to the sender of the current message.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
513 Numeric prefix argument N means to reply to the current message plus the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
514 next N-1 messages. A negative N means reply to the current message and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
515 the previous N-1 messages.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
516
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
517 If invoked on marked messages (via vm-next-command-uses-marks),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
518 all marked messages will be replied to.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
519
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
520 You will be placed into a standard Emacs Mail mode buffer to compose and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
521 send your message. See the documentation for the function `mail' for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
522 more info.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
523
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
524 Note that the normal binding of C-c C-y in the reply buffer is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
525 automatically changed to vm-yank-message during a reply. This
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
526 allows you to yank any message from the current folder into a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
527 reply.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
528
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
529 Normal VM commands may be accessed in the reply buffer by prefixing them
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
530 with C-c C-v."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
531 (interactive "p")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
532 (vm-follow-summary-cursor)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
533 (vm-select-folder-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
534 (vm-check-for-killed-summary)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
535 (vm-error-if-folder-empty)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
536 (vm-do-reply nil nil count))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
537
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
538 (defun vm-reply-include-text (count)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
539 "Reply to the sender (only) of the current message and include text
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
540 from the message. See the documentation for function vm-reply for details."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
541 (interactive "p")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
542 (vm-follow-summary-cursor)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
543 (vm-select-folder-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
544 (vm-check-for-killed-summary)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
545 (vm-error-if-folder-empty)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
546 (vm-do-reply nil t count))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
547
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
548 (defun vm-followup (count)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
549 "Reply to all recipients of the current message.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
550 See the documentation for the function vm-reply for details."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
551 (interactive "p")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
552 (vm-follow-summary-cursor)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
553 (vm-select-folder-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
554 (vm-check-for-killed-summary)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
555 (vm-error-if-folder-empty)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
556 (vm-do-reply t nil count))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
557
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
558 (defun vm-followup-include-text (count)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
559 "Reply to all recipients of the current message and include text from
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
560 the message. See the documentation for the function vm-reply for details."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
561 (interactive "p")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
562 (vm-follow-summary-cursor)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
563 (vm-select-folder-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
564 (vm-check-for-killed-summary)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
565 (vm-error-if-folder-empty)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
566 (vm-do-reply t t count))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
567
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
568 (defun vm-forward-message-all-headers ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
569 "Like vm-forward-message but always forwards all the headers."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
570 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
571 (let ((vm-forwarded-headers nil)
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
572 (vm-unforwarded-header-regexp "only-drop-this-header"))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
573 (vm-forward-message)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
574
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
575 (defun vm-forward-message ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
576 "Forward the current message to one or more recipients.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
577 You will be placed in a Mail mode buffer as you would with a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
578 reply, but you must fill in the To: header and perhaps the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
579 Subject: header manually."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
580 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
581 (vm-follow-summary-cursor)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
582 (vm-select-folder-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
583 (vm-check-for-killed-summary)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
584 (vm-error-if-folder-empty)
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
585 (if (eq last-command 'vm-next-command-uses-marks)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
586 (let ((vm-digest-send-type vm-forwarding-digest-type))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
587 (setq this-command 'vm-next-command-uses-marks)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
588 (command-execute 'vm-send-digest))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
589 (let ((dir default-directory)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
590 (miming (and vm-send-using-mime
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
591 (equal vm-forwarding-digest-type "mime")))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
592 mail-buffer
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
593 header-end boundary
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
594 (mp vm-message-pointer))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
595 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
596 (widen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
597 (vm-mail-internal
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
598 (format "forward of %s's note re: %s"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
599 (vm-su-full-name (car vm-message-pointer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
600 (vm-su-subject (car vm-message-pointer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
601 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
602 (and vm-forwarding-subject-format
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
603 (let ((vm-summary-uninteresting-senders nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
604 (vm-sprintf 'vm-forwarding-subject-format (car mp)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
605 (make-local-variable 'vm-forward-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
606 (setq vm-system-state 'forwarding
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
607 vm-forward-list (list (car mp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
608 default-directory dir)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
609 (if miming
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
610 (progn
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
611 (setq mail-buffer (current-buffer))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
612 (set-buffer (generate-new-buffer "*vm-forward-buffer*"))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
613 (setq header-end (point))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
614 (insert "\n"))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
615 (goto-char (point-min))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
616 (re-search-forward (concat "^" (regexp-quote mail-header-separator)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
617 "\n"))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
618 (goto-char (match-end 0))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
619 (setq header-end (match-beginning 0)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
620 (cond ((equal vm-forwarding-digest-type "mime")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
621 (setq boundary (vm-mime-encapsulate-messages
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
622 (list (car mp)) vm-forwarded-headers
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
623 vm-unforwarded-header-regexp))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
624 (goto-char header-end)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
625 (insert "MIME-Version: 1.0\n")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
626 (insert (if vm-mime-avoid-folding-content-type
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
627 "Content-Type: multipart/digest; boundary=\""
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
628 "Content-Type: multipart/digest;\n\tboundary=\"")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
629 boundary "\"\n")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
630 (insert "Content-Transfer-Encoding: "
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
631 (vm-determine-proper-content-transfer-encoding
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
632 (point)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
633 (point-max))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
634 "\n"))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
635 ((equal vm-forwarding-digest-type "rfc934")
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
636 (vm-rfc934-encapsulate-messages
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
637 vm-forward-list vm-forwarded-headers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
638 vm-unforwarded-header-regexp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
639 ((equal vm-forwarding-digest-type "rfc1153")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
640 (vm-rfc1153-encapsulate-messages
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
641 vm-forward-list vm-forwarded-headers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
642 vm-unforwarded-header-regexp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
643 ((equal vm-forwarding-digest-type nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
644 (vm-no-frills-encapsulate-message
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
645 (car vm-forward-list) vm-forwarded-headers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
646 vm-unforwarded-header-regexp)))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
647 (if miming
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
648 (let ((b (current-buffer)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
649 (set-buffer mail-buffer)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
650 (mail-text)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
651 (vm-mime-attach-object b "multipart/digest"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
652 (list (concat "boundary=\""
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
653 boundary "\"")) t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
654 (add-hook 'kill-buffer-hook
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
655 (list 'lambda ()
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
656 (list 'if (list 'eq mail-buffer '(current-buffer))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
657 (list 'kill-buffer b))))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
658 (mail-position-on-field "To"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
659 (run-hooks 'vm-forward-message-hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
660 (run-hooks 'vm-mail-mode-hook))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
661
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
662 (defun vm-resend-bounced-message ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
663 "Extract the original text from a bounced message and resend it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
664 You will be placed in a Mail mode buffer with the extracted message and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
665 you can change the recipient address before resending the message."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
666 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
667 (vm-follow-summary-cursor)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
668 (vm-select-folder-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
669 (vm-check-for-killed-summary)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
670 (vm-error-if-folder-empty)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
671 (let ((b (current-buffer)) start
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
672 (dir default-directory)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
673 (layout (vm-mm-layout (car vm-message-pointer)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
674 (lim (vm-text-end-of (car vm-message-pointer))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
675 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
676 (widen)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
677 (if (or (not (vectorp layout))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
678 (not (setq layout (vm-mime-layout-contains-type
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
679 layout "message/rfc822"))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
680 (save-excursion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
681 (goto-char (vm-text-of (car vm-message-pointer)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
682 (let ((case-fold-search t))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
683 ;; What a wonderful world it would be if mailers
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
684 ;; used a single message encapsulation standard
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
685 ;; instead of all the weird variants. It is
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
686 ;; useless to try to cover them all. This simple
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
687 ;; rule should cover the sanest of the formats
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
688 (if (not (re-search-forward "^Received:" lim t))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
689 (error "This doesn't look like a bounced message."))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
690 (beginning-of-line)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
691 (setq start (point)))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
692 ;; briefly nullify vm-mail-header-from to keep vm-mail-internal
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
693 ;; from inserting another From header.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
694 (let ((vm-mail-header-from nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
695 (vm-mail-internal
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
696 (format "retry of bounce from %s"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
697 (vm-su-from (car vm-message-pointer)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
698 (goto-char (point-min))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
699 (if (vectorp layout)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
700 (progn
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
701 (setq start (point))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
702 (vm-mime-insert-mime-body layout)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
703 (vm-mime-transfer-decode-region layout start (point)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
704 (insert-buffer-substring b start lim))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
705 (delete-region (point) (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
706 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
707 ;; delete all but pertinent headers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
708 (vm-reorder-message-headers nil nil "\\(X-VM-\\|Status:\\|Sender:\\)")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
709 (vm-reorder-message-headers nil vm-resend-bounced-headers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
710 vm-resend-bounced-discard-header-regexp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
711 (if (search-forward "\n\n" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
712 (replace-match "")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
713 (goto-char (point-max)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
714 (insert ?\n mail-header-separator ?\n)
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
715 (mail-position-on-field "To")
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
716 (setq default-directory dir)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
717 (run-hooks 'vm-resend-bounced-message-hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
718 (run-hooks 'vm-mail-mode-hook))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
719
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
720 (defun vm-resend-message ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
721 "Resend the current message to someone else.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
722 The current message will be copied to a Mail mode buffer and you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
723 can edit the message and send it as usual.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
724
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
725 NOTE: since you are doing a resend, a Resent-To header is
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
726 provided for you to fill in. If you don't fill it in, when you
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
727 send the message it will go to the original recipients listed in
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
728 the To and Cc headers. You may also create a Resent-Cc header."
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
729 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
730 (vm-follow-summary-cursor)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
731 (vm-select-folder-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
732 (vm-check-for-killed-summary)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
733 (vm-error-if-folder-empty)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
734 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
735 (widen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
736 (let ((b (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
737 (dir default-directory)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
738 (vmp vm-message-pointer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
739 (start (vm-headers-of (car vm-message-pointer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
740 (lim (vm-text-end-of (car vm-message-pointer))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
741 ;; briefly nullify vm-mail-header-from to keep vm-mail-internal
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
742 ;; from inserting another From header.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
743 (let ((vm-mail-header-from nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
744 (vm-mail-internal
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
745 (format "resend of %s's note re: %s"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
746 (vm-su-full-name (car vm-message-pointer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
747 (vm-su-subject (car vm-message-pointer)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
748 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
749 (insert-buffer-substring b start lim)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
750 (delete-region (point) (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
751 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
752 (if vm-mail-header-from
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
753 (insert "Resent-From: " vm-mail-header-from ?\n))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
754 (insert "Resent-To: \n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
755 (if mail-self-blind
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
756 (insert "Bcc: " (user-login-name) ?\n))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
757 (if mail-archive-file-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
758 (insert "FCC: " mail-archive-file-name ?\n))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
759 ;; delete all but pertinent headers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
760 (vm-reorder-message-headers nil nil "\\(X-VM-\\|Status:\\|Sender:\\)")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
761 (vm-reorder-message-headers nil vm-resend-headers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
762 vm-resend-discard-header-regexp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
763 (if (search-forward "\n\n" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
764 (replace-match ""))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
765 (insert ?\n mail-header-separator ?\n)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
766 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
767 (mail-position-on-field "Resent-To")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
768 (make-local-variable 'vm-redistribute-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
769 (setq vm-system-state 'redistributing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
770 vm-redistribute-list (list (car vmp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
771 default-directory dir)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
772 (run-hooks 'vm-resend-message-hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
773 (run-hooks 'vm-mail-mode-hook))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
774
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
775 (defun vm-send-digest (&optional prefix)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
776 "Send a digest of all messages in the current folder to recipients.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
777 The type of the digest is specified by the variable vm-digest-send-type.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
778 You will be placed in a Mail mode buffer as is usual with replies, but you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
779 must fill in the To: and Subject: headers manually.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
780
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
781 Prefix arg means to insert a list of preamble lines at the beginning of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
782 the digest. One line is generated for each message being digestified.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
783 The variable vm-digest-preamble-format determines the format of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
784 preamble lines.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
785
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
786 If invoked on marked messages (via vm-next-command-uses-marks),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
787 only marked messages will be put into the digest."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
788 (interactive "P")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
789 (vm-select-folder-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
790 (vm-check-for-killed-summary)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
791 (vm-error-if-folder-empty)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
792 (let ((dir default-directory)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
793 (miming (and vm-send-using-mime (equal vm-digest-send-type "mime")))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
794 mp mail-buffer b
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
795 ;; prefix arg doesn't have "normal" meaning here, so only call
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
796 ;; vm-select-marked-or-prefixed-messages if we're using marks.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
797 (mlist (if (eq last-command 'vm-next-command-uses-marks)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
798 (vm-select-marked-or-prefixed-messages 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
799 vm-message-list))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
800 start header-end boundary)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
801 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
802 (widen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
803 (vm-mail-internal (format "digest from %s" (buffer-name)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
804 (make-local-variable 'vm-forward-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
805 (setq vm-system-state 'forwarding
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
806 vm-forward-list mlist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
807 default-directory dir)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
808 (if miming
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
809 (progn
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
810 (setq mail-buffer (current-buffer))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
811 (set-buffer (generate-new-buffer "*vm-digest-buffer*"))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
812 (setq header-end (point))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
813 (insert "\n")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
814 (setq start (point-marker)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
815 (goto-char (point-min))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
816 (re-search-forward (concat "^" (regexp-quote mail-header-separator)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
817 "\n"))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
818 (goto-char (match-end 0))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
819 (setq start (point-marker)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
820 header-end (match-beginning 0)))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
821 (vm-unsaved-message "Building %s digest..." vm-digest-send-type)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
822 (cond ((equal vm-digest-send-type "mime")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
823 (setq boundary (vm-mime-encapsulate-messages
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
824 mlist vm-mime-digest-headers
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
825 vm-mime-digest-discard-header-regexp))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
826 (goto-char header-end)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
827 (insert "MIME-Version: 1.0\n")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
828 (insert (if vm-mime-avoid-folding-content-type
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
829 "Content-Type: multipart/digest; boundary=\""
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
830 "Content-Type: multipart/digest;\n\tboundary=\"")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
831 boundary "\"\n")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
832 (insert "Content-Transfer-Encoding: "
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
833 (vm-determine-proper-content-transfer-encoding
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
834 (point)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
835 (point-max))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
836 "\n"))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
837 ((equal vm-digest-send-type "rfc934")
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
838 (vm-rfc934-encapsulate-messages
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
839 mlist vm-rfc934-digest-headers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
840 vm-rfc934-digest-discard-header-regexp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
841 ((equal vm-digest-send-type "rfc1153")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
842 (vm-rfc1153-encapsulate-messages
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
843 mlist vm-rfc1153-digest-headers
76
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 70
diff changeset
844 vm-rfc1153-digest-discard-header-regexp)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
845 (goto-char start)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
846 (setq mp mlist)
54
05472e90ae02 Import from CVS: tag r19-16-pre2
cvs
parents: 36
diff changeset
847 (if prefix
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
848 (progn
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
849 (vm-unsaved-message "Building digest preamble...")
54
05472e90ae02 Import from CVS: tag r19-16-pre2
cvs
parents: 36
diff changeset
850 (while mp
05472e90ae02 Import from CVS: tag r19-16-pre2
cvs
parents: 36
diff changeset
851 (let ((vm-summary-uninteresting-senders nil))
05472e90ae02 Import from CVS: tag r19-16-pre2
cvs
parents: 36
diff changeset
852 (insert (vm-sprintf 'vm-digest-preamble-format (car mp)) "\n"))
05472e90ae02 Import from CVS: tag r19-16-pre2
cvs
parents: 36
diff changeset
853 (if vm-digest-center-preamble
05472e90ae02 Import from CVS: tag r19-16-pre2
cvs
parents: 36
diff changeset
854 (progn
05472e90ae02 Import from CVS: tag r19-16-pre2
cvs
parents: 36
diff changeset
855 (forward-char -1)
05472e90ae02 Import from CVS: tag r19-16-pre2
cvs
parents: 36
diff changeset
856 (center-line)
05472e90ae02 Import from CVS: tag r19-16-pre2
cvs
parents: 36
diff changeset
857 (forward-char 1)))
05472e90ae02 Import from CVS: tag r19-16-pre2
cvs
parents: 36
diff changeset
858 (setq mp (cdr mp)))))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
859 (if miming
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
860 (let ((b (current-buffer)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
861 (set-buffer mail-buffer)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
862 (mail-text)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
863 (vm-mime-attach-object b "multipart/digest"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
864 (list (concat "boundary=\""
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
865 boundary "\"")) t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
866 (add-hook 'kill-buffer-hook
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
867 (list 'lambda ()
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
868 (list 'if (list 'eq mail-buffer '(current-buffer))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
869 (list 'kill-buffer b))))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
870 (mail-position-on-field "To")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
871 (message "Building %s digest... done" vm-digest-send-type)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
872 (run-hooks 'vm-send-digest-hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
873 (run-hooks 'vm-mail-mode-hook))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
874
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
875 (defun vm-send-rfc934-digest (&optional preamble)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
876 "Like vm-send-digest but always sends an RFC 934 digest."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
877 (interactive "P")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
878 (let ((vm-digest-send-type "rfc934"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
879 (vm-send-digest preamble)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
880
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
881 (defun vm-send-rfc1153-digest (&optional preamble)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
882 "Like vm-send-digest but always sends an RFC 1153 digest."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
883 (interactive "P")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
884 (let ((vm-digest-send-type "rfc1153"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
885 (vm-send-digest preamble)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
886
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
887 (defun vm-send-mime-digest (&optional preamble)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
888 "Like vm-send-digest but always sends an MIME (multipart/digest) digest."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
889 (interactive "P")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
890 (let ((vm-digest-send-type "mime"))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
891 (vm-send-digest preamble)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
892
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
893 (defun vm-continue-composing-message (&optional not-picky)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
894 "Find and select the most recently used mail composition buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
895 If the selected buffer is already a Mail mode buffer then it is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
896 buried before beginning the search. Non Mail mode buffers and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
897 unmodified Mail buffers are skipped. Prefix arg means unmodified
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
898 Mail mode buffers are not skipped. If no suitable buffer is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
899 found, the current buffer remains selected."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
900 (interactive "P")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
901 (if (eq major-mode 'mail-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
902 (vm-bury-buffer (current-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
903 (let ((b (vm-find-composition-buffer not-picky)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
904 (if (not (or (null b) (eq b (current-buffer))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
905 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
906 ;; avoid having the window configuration code choose a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
907 ;; different composition buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
908 (vm-unbury-buffer b)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
909 (set-buffer b)
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
910 (if (and vm-frame-per-composition (vm-multiple-frames-possible-p)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
911 ;; only pop up a frame if there's an undisplay
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
912 ;; hook in place to make the frame go away.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
913 vm-undisplay-buffer-hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
914 (let ((w (vm-get-buffer-window b)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
915 (if (null w)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
916 (vm-goto-new-frame 'composition)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
917 (select-window w)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
918 (and vm-warp-mouse-to-new-frame
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
919 (vm-warp-mouse-to-frame-maybe (vm-window-frame w))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
920 ;; need to do this here too, since XEmacs has per
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
921 ;; frame buffer lists.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
922 (vm-unbury-buffer b)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
923 (vm-set-hooks-for-frame-deletion)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
924 (vm-display b t '(vm-continue-composing-message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
925 '(vm-continue-composing-message composing-message)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
926 (message "No composition buffers found"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
927
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
928 (defun vm-mail-to-mailto-url (url)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
929 (let ((address (car (vm-parse url "^mailto:\\(.+\\)"))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
930 (vm-select-folder-buffer)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
931 (vm-check-for-killed-summary)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
932 (vm-mail-internal nil address)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
933 (run-hooks 'vm-mail-hook)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
934 (run-hooks 'vm-mail-mode-hook)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
935
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
936 ;; to quiet the v19 byte compiler
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
937 (defvar mail-mode-map)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
938 (defvar mail-aliases)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
939 (defvar mail-default-reply-to)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
940 (defvar mail-signature-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
941
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
942 (defun vm-mail-internal
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
943 (&optional buffer-name to subject in-reply-to cc references newsgroups)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
944 (let ((folder-buffer nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
945 (if (memq major-mode '(vm-mode vm-virtual-mode))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
946 (setq folder-buffer (current-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
947 (set-buffer (generate-new-buffer (or buffer-name "*VM-mail*")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
948 ;; avoid trying to write auto-save files in potentially
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
949 ;; unwritable directories.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
950 (setq default-directory (or vm-folder-directory (expand-file-name "~/")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
951 (auto-save-mode (if auto-save-default 1 -1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
952 (mail-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
953 (use-local-map vm-mail-mode-map)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
954 ;; make mail-mode-map the parent of this vm-mail-mode-map, if we can.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
955 ;; do it only once.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
956 (if (not vm-mail-mode-map-parented)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
957 (cond ((fboundp 'set-keymap-parents)
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
958 (set-keymap-parents vm-mail-mode-map (list mail-mode-map)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
959 ((consp mail-mode-map)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
960 (nconc vm-mail-mode-map mail-mode-map)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
961 (setq vm-mail-mode-map-parented t))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
962 (setq vm-mail-buffer folder-buffer
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
963 mode-popup-menu (and vm-use-menus vm-popup-menu-on-mouse-3
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
964 (vm-menu-support-possible-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
965 (vm-menu-mode-menu)))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
966 ;; sets up popup menu for FSF Emacs
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
967 (and vm-use-menus (vm-menu-support-possible-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
968 (vm-menu-install-mail-mode-menu))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
969 (if (fboundp 'mail-aliases-setup) ; use mail-abbrevs.el if present
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
970 (mail-aliases-setup)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
971 (if (eq mail-aliases t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
972 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
973 (setq mail-aliases nil)
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
974 (if (file-exists-p "~/.mailrc")
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
975 (build-mail-aliases)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
976 (if (stringp vm-mail-header-from)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
977 (insert "From: " vm-mail-header-from "\n"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
978 (insert "To: " (or to "") "\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
979 (and cc (insert "Cc: " cc "\n"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
980 (insert "Subject: " (or subject "") "\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
981 (and newsgroups (insert "Newsgroups: " newsgroups "\n"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
982 (and in-reply-to (insert "In-Reply-To: " in-reply-to "\n"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
983 (and references (insert "References: " references "\n"))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
984 ;; REPLYTO support for FSF Emacs v19.29
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
985 (and (eq mail-default-reply-to t)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
986 (setq mail-default-reply-to (getenv "REPLYTO")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
987 (if mail-default-reply-to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
988 (insert "Reply-To: " mail-default-reply-to "\n"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
989 (if mail-self-blind
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
990 (insert "Bcc: " (user-login-name) "\n"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
991 (if mail-archive-file-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
992 (insert "FCC: " mail-archive-file-name "\n"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
993 (if mail-default-headers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
994 (insert mail-default-headers))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
995 (if (not (= (preceding-char) ?\n))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
996 (insert ?\n))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
997 (insert mail-header-separator "\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
998 (cond ((stringp mail-signature)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
999 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1000 (insert mail-signature)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1001 ((eq mail-signature t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1002 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1003 (insert "-- \n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1004 (insert-file-contents (or (and (boundp 'mail-signature-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1005 (stringp mail-signature-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1006 mail-signature-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1007 "~/.signature")))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1008 ;; move this buffer to the head of the buffer list so window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1009 ;; config stuff will select it as the composition buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1010 (vm-unbury-buffer (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1011 ;; make a new frame if the user wants it.
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
1012 (if (and vm-frame-per-composition (vm-multiple-frames-possible-p))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1013 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1014 (vm-goto-new-frame 'composition)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1015 (vm-set-hooks-for-frame-deletion)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1016 ;; now do window configuration
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1017 (vm-display (current-buffer) t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1018 '(vm-mail
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1019 vm-mail-other-frame
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1020 vm-mail-other-window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1021 vm-reply
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1022 vm-reply-other-frame
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1023 vm-reply-include-text
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1024 vm-reply-include-text-other-frame
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1025 vm-followup
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1026 vm-followup-other-frame
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1027 vm-followup-include-text
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1028 vm-followup-include-text-other-frame
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1029 vm-send-digest
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1030 vm-send-digest-other-frame
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1031 vm-send-rfc934-digest
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1032 vm-send-rfc934-digest-other-frame
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1033 vm-send-rfc1153-digest
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1034 vm-send-rfc1153-digest-other-frame
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
1035 vm-send-mime-digest
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
1036 vm-send-mime-digest-other-frame
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1037 vm-forward-message
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1038 vm-forward-message-other-frame
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1039 vm-forward-message-all-headers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1040 vm-forward-message-all-headers-other-frame
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1041 vm-resend-message
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1042 vm-resend-message-other-frame
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1043 vm-resend-bounced-message
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1044 vm-resend-bounced-message-other-frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1045 (list this-command 'composing-message))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1046 (if (null to)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1047 (mail-position-on-field "To"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1048 (run-hooks 'mail-setup-hook)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1049
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1050 (defun vm-reply-other-frame (count)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1051 "Like vm-reply, but run in a newly created frame."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1052 (interactive "p")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1053 (if (vm-multiple-frames-possible-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1054 (vm-goto-new-frame 'composition))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1055 (let ((vm-frame-per-composition nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1056 (vm-search-other-frames nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1057 (vm-reply count))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1058 (if (vm-multiple-frames-possible-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1059 (vm-set-hooks-for-frame-deletion)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1060
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1061 (defun vm-reply-include-text-other-frame (count)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1062 "Like vm-reply-include-text, but run in a newly created frame."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1063 (interactive "p")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1064 (if (vm-multiple-frames-possible-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1065 (vm-goto-new-frame 'composition))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1066 (let ((vm-frame-per-composition nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1067 (vm-search-other-frames nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1068 (vm-reply-include-text count))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1069 (if (vm-multiple-frames-possible-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1070 (vm-set-hooks-for-frame-deletion)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1071
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1072 (defun vm-followup-other-frame (count)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1073 "Like vm-followup, but run in a newly created frame."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1074 (interactive "p")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1075 (if (vm-multiple-frames-possible-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1076 (vm-goto-new-frame 'composition))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1077 (let ((vm-frame-per-composition nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1078 (vm-search-other-frames nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1079 (vm-followup count))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1080 (if (vm-multiple-frames-possible-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1081 (vm-set-hooks-for-frame-deletion)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1082
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1083 (defun vm-followup-include-text-other-frame (count)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1084 "Like vm-followup-include-text, but run in a newly created frame."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1085 (interactive "p")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1086 (if (vm-multiple-frames-possible-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1087 (vm-goto-new-frame 'composition))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1088 (let ((vm-frame-per-composition nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1089 (vm-search-other-frames nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1090 (vm-followup-include-text count))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1091 (if (vm-multiple-frames-possible-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1092 (vm-set-hooks-for-frame-deletion)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1093
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1094 (defun vm-forward-message-all-headers-other-frame ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1095 "Like vm-forward-message-all-headers, but run in a newly created frame."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1096 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1097 (if (vm-multiple-frames-possible-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1098 (vm-goto-new-frame 'composition))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1099 (let ((vm-frame-per-composition nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1100 (vm-search-other-frames nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1101 (vm-forward-message-all-headers))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1102 (if (vm-multiple-frames-possible-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1103 (vm-set-hooks-for-frame-deletion)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1104
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1105 (defun vm-forward-message-other-frame ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1106 "Like vm-forward-message, but run in a newly created frame."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1107 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1108 (if (vm-multiple-frames-possible-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1109 (vm-goto-new-frame 'composition))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1110 (let ((vm-frame-per-composition nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1111 (vm-search-other-frames nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1112 (vm-forward-message))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1113 (if (vm-multiple-frames-possible-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1114 (vm-set-hooks-for-frame-deletion)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1115
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1116 (defun vm-resend-message-other-frame ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1117 "Like vm-resend-message, but run in a newly created frame."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1118 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1119 (if (vm-multiple-frames-possible-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1120 (vm-goto-new-frame 'composition))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1121 (let ((vm-frame-per-composition nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1122 (vm-search-other-frames nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1123 (vm-resend-message))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1124 (if (vm-multiple-frames-possible-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1125 (vm-set-hooks-for-frame-deletion)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1126
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1127 (defun vm-resend-bounced-message-other-frame ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1128 "Like vm-resend-bounced-message, but run in a newly created frame."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1129 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1130 (if (vm-multiple-frames-possible-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1131 (vm-goto-new-frame 'composition))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1132 (let ((vm-frame-per-composition nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1133 (vm-search-other-frames nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1134 (vm-resend-bounced-message))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1135 (if (vm-multiple-frames-possible-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1136 (vm-set-hooks-for-frame-deletion)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1137
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1138 (defun vm-send-digest-other-frame (&optional prefix)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1139 "Like vm-send-digest, but run in a newly created frame."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1140 (interactive "P")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1141 (if (vm-multiple-frames-possible-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1142 (vm-goto-new-frame 'composition))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1143 (let ((vm-frame-per-composition nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1144 (vm-search-other-frames nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1145 (vm-send-digest prefix))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1146 (if (vm-multiple-frames-possible-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1147 (vm-set-hooks-for-frame-deletion)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1148
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1149 (defun vm-send-rfc934-digest-other-frame (&optional prefix)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1150 "Like vm-send-rfc934-digest, but run in a newly created frame."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1151 (interactive "P")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1152 (if (vm-multiple-frames-possible-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1153 (vm-goto-new-frame 'composition))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1154 (let ((vm-frame-per-composition nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1155 (vm-search-other-frames nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1156 (vm-send-rfc934-digest prefix))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1157 (if (vm-multiple-frames-possible-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1158 (vm-set-hooks-for-frame-deletion)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1159
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1160 (defun vm-send-rfc1153-digest-other-frame (&optional prefix)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1161 "Like vm-send-rfc1153-digest, but run in a newly created frame."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1162 (interactive "P")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1163 (if (vm-multiple-frames-possible-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1164 (vm-goto-new-frame 'composition))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1165 (let ((vm-frame-per-composition nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1166 (vm-search-other-frames nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1167 (vm-send-rfc1153-digest prefix))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1168 (if (vm-multiple-frames-possible-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1169 (vm-set-hooks-for-frame-deletion)))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
1170
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
1171 (defun vm-send-mime-digest-other-frame (&optional prefix)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
1172 "Like vm-send-mime-digest, but run in a newly created frame."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
1173 (interactive "P")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
1174 (if (vm-multiple-frames-possible-p)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
1175 (vm-goto-new-frame 'composition))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
1176 (let ((vm-frame-per-composition nil)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
1177 (vm-search-other-frames nil))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
1178 (vm-send-mime-digest prefix))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
1179 (if (vm-multiple-frames-possible-p)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
1180 (vm-set-hooks-for-frame-deletion)))