annotate lisp/tm/tmh-comp.el @ 163:0132846995bd r20-3b8

Import from CVS: tag r20-3b8
author cvs
date Mon, 13 Aug 2007 09:43:35 +0200
parents 8619ce7e4c50
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1 ;;; tm-mh-e.el --- tm-mh-e functions for composing messages
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
2
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
3 ;; Copyright (C) 1993,1994,1995,1996,1997 Free Software Foundation, Inc.
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
5 ;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
6 ;; OKABE Yasuo <okabe@kudpc.kyoto-u.ac.jp>
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
7 ;; Maintainer: MORIOKA Tomohiko <morioka@jaist.ac.jp>
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
8 ;; Created: 1996/2/29 (separated from tm-mh-e.el)
114
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
9 ;; Version: $Id: tmh-comp.el,v 1.5 1997/03/22 06:02:46 steve Exp $
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
10 ;; Keywords: mail, MH, MIME, multimedia, encoded-word, multilingual
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
11
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
12 ;; This file is part of tm (Tools for MIME).
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
13
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
14 ;; This program is free software; you can redistribute it and/or
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
15 ;; modify it under the terms of the GNU General Public License as
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
16 ;; published by the Free Software Foundation; either version 2, or (at
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
17 ;; your option) any later version.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
18
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
19 ;; This program is distributed in the hope that it will be useful, but
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
20 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
21 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
22 ;; General Public License for more details.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
23
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
24 ;; You should have received a copy of the GNU General Public License
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
25 ;; along with GNU Emacs; see the file COPYING. If not, write to the
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
26 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
27 ;; Boston, MA 02111-1307, USA.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
28
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
29 ;;; Code:
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
30
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
31 (require 'mh-comp)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
32 (require 'tm-edit)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
33
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
34
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
35 ;;; @ variable
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
36 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
37
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
38 (defvar tm-mh-e/forwcomps "forwcomps"
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
39 "Name of file to be used as a skeleton for forwarding messages.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
40 Default is \"forwcomps\". If not a complete path name, the file
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
41 is searched for first in the user's MH directory, then in the
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
42 system MH lib directory.")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
43
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
44 (defvar tm-mh-e/message-yank-function 'mh-yank-cur-msg)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
45
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
46
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
47 ;;; @ for tm-edit
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
48 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
49
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
50 (defun tm-mh-e::make-message (folder number)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
51 (vector folder number)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
52 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
53
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
54 (defun tm-mh-e::message/folder (message)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
55 (elt message 0)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
56 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
57
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
58 (defun tm-mh-e::message/number (message)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
59 (elt message 1)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
60 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
61
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
62 (defun tm-mh-e::message/file-name (message)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
63 (expand-file-name
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
64 (tm-mh-e::message/number message)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
65 (mh-expand-file-name (tm-mh-e::message/folder message))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
66 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
67
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
68 ;;; modified by OKABE Yasuo <okabe@kudpc.kyoto-u.ac.jp>
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
69 ;;; 1995/11/14 (cf. [tm-ja:1096])
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
70 (defun tm-mh-e/prompt-for-message (prompt folder &optional default)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
71 (let* ((files
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
72 (directory-files (mh-expand-file-name folder) nil "^[0-9]+$")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
73 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
74 (folder-buf (get-buffer folder))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
75 (default
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
76 (if folder-buf
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
77 (save-excursion
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
78 (set-buffer folder-buf)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
79 (let* ((show-buffer (get-buffer mh-show-buffer))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
80 (show-buffer-file-name
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
81 (buffer-file-name show-buffer)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
82 (if show-buffer-file-name
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
83 (file-name-nondirectory show-buffer-file-name)))))))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
84 (if (or (null default)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
85 (not (string-match "^[0-9]+$" default)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
86 (setq default
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
87 (if (and (string= folder mh-sent-from-folder)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
88 mh-sent-from-msg)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
89 (int-to-string mh-sent-from-msg)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
90 (save-excursion
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
91 (let (cur-msg)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
92 (if (and
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
93 (= 0 (mh-exec-cmd-quiet nil "pick" folder "cur"))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
94 (set-buffer mh-temp-buffer)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
95 (setq cur-msg (buffer-string))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
96 (string-match "^[0-9]+$" cur-msg))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
97 (substring cur-msg 0 (match-end 0))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
98 (car files)))))))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
99 (completing-read prompt
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
100 (let ((i 0))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
101 (mapcar (function
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
102 (lambda (file)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
103 (setq i (+ i 1))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
104 (list file i)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
105 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
106 files)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
107 ) nil nil default)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
108 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
109
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
110 ;;; modified by OKABE Yasuo <okabe@kudpc.kyoto-u.ac.jp>
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
111 ;;; 1995/11/14 (cf. [tm-ja:1096])
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
112 (defun tm-mh-e/query-message (&optional message)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
113 (let (folder number)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
114 (if message
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
115 (progn
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
116 (setq folder (tm-mh-e::message/folder message))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
117 (setq number (tm-mh-e::message/number message))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
118 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
119 (or (stringp folder)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
120 (setq folder (mh-prompt-for-folder
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
121 "Message from"
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
122 (if (and (stringp mh-sent-from-folder)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
123 (string-match "^\\+" mh-sent-from-folder))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
124 mh-sent-from-folder "+inbox")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
125 nil)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
126 (setq number
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
127 (if (numberp number)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
128 (number-to-string number)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
129 (tm-mh-e/prompt-for-message "Message number: " folder)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
130 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
131 (tm-mh-e::make-message folder number)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
132 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
133
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
134 (defun tm-mh-e/insert-message (&optional message)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
135 ;; always ignores message
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
136 (let ((article-buffer
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
137 (if (not (and (stringp mh-sent-from-folder)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
138 (numberp mh-sent-from-msg)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
139 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
140 (cond ((and (boundp 'gnus-original-article-buffer)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
141 (bufferp mh-sent-from-folder)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
142 (get-buffer gnus-original-article-buffer)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
143 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
144 gnus-original-article-buffer)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
145 ((and (boundp 'gnus-article-buffer)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
146 (get-buffer gnus-article-buffer)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
147 (bufferp mh-sent-from-folder)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
148 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
149 (save-excursion
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
150 (set-buffer gnus-article-buffer)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
151 (if (eq major-mode 'mime/viewer-mode)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
152 mime::preview/article-buffer
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
153 (current-buffer)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
154 )))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
155 ))))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
156 (if (null article-buffer)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
157 (tm-mh-e/insert-mail
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
158 (tm-mh-e::make-message mh-sent-from-folder mh-sent-from-msg)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
159 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
160 (insert-buffer article-buffer)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
161 (mime-editor/inserted-message-filter)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
162 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
163 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
164
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
165 (defun tm-mh-e/insert-mail (&optional message)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
166 (save-excursion
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
167 (save-restriction
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
168 (let ((message-file
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
169 (tm-mh-e::message/file-name (tm-mh-e/query-message message))))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
170 (narrow-to-region (point) (point))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
171 (insert-file-contents message-file)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
172 (push-mark (point-max))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
173 (mime-editor/inserted-message-filter)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
174 ))))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
175
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
176 (set-alist 'mime-editor/message-inserter-alist
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
177 'mh-letter-mode (function tm-mh-e/insert-message))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
178 (set-alist 'mime-editor/mail-inserter-alist
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
179 'mh-letter-mode (function tm-mh-e/insert-mail))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
180 (set-alist 'mime-editor/mail-inserter-alist
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
181 'news-reply-mode (function tm-mh-e/insert-mail))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
182 (set-alist
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
183 'mime-editor/split-message-sender-alist
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
184 'mh-letter-mode
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
185 (function
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
186 (lambda (&optional arg)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
187 (interactive "P")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
188 (write-region (point-min) (point-max)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
189 mime-editor/draft-file-name nil 'no-message)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
190 (cond (arg
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
191 (pop-to-buffer "MH mail delivery")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
192 (erase-buffer)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
193 (mh-exec-cmd-output mh-send-prog t "-watch" "-nopush"
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
194 "-nodraftfolder"
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
195 mh-send-args
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
196 mime-editor/draft-file-name)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
197 (goto-char (point-max)) ; show the interesting part
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
198 (recenter -1)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
199 (sit-for 1))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
200 (t
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
201 (apply 'mh-exec-cmd-quiet t mh-send-prog
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
202 (mh-list-to-string
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
203 (list "-nopush" "-nodraftfolder"
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
204 "-noverbose" "-nowatch"
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
205 mh-send-args mime-editor/draft-file-name)))))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
206 )))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
207
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
208
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
209 ;;; @ commands using tm-edit features
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
210 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
211
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
212 (defun tm-mh-e/edit-again (msg)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
213 "Clean-up a draft or a message previously sent and make it resendable.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
214 Default is the current message.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
215 The variable mh-new-draft-cleaned-headers specifies the headers to remove.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
216 See also documentation for `\\[mh-send]' function."
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
217 (interactive (list (mh-get-msg-num t)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
218 (catch 'tag
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
219 (let* ((from-folder mh-current-folder)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
220 (config (current-window-configuration))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
221 code-conversion
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
222 (draft
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
223 (cond ((and mh-draft-folder (equal from-folder mh-draft-folder))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
224 (let ((name (format "draft-%d" msg)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
225 (if (get-buffer name)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
226 (throw 'tag (pop-to-buffer name))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
227 )
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 98
diff changeset
228 (let ((filename (mh-msg-filename msg mh-draft-folder)))
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
229 (set-buffer (get-buffer-create name))
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 98
diff changeset
230 (as-binary-input-file (insert-file-contents filename))
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
231 (setq buffer-file-name filename)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
232 (setq code-conversion t)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
233 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
234 (pop-to-buffer name)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
235 (if (re-search-forward "^-+$" nil t)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
236 (replace-match "")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
237 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
238 name))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
239 (t
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
240 (prog1
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 98
diff changeset
241 (as-binary-input-file
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 98
diff changeset
242 (mh-read-draft "clean-up" (mh-msg-filename msg) nil)
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 98
diff changeset
243 )
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
244 (setq code-conversion t)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
245 ))))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
246 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
247 (goto-char (point-min))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
248 (mh-clean-msg-header (point-min) mh-new-draft-cleaned-headers nil)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
249 (if code-conversion
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
250 (let ((cs (detect-coding-region (point-min)(point-max))))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
251 (set-buffer-file-coding-system
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
252 (if (listp cs)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
253 (car cs)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
254 cs))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
255 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
256 (save-buffer)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
257 (mime/edit-again code-conversion t t)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
258 (goto-char (point-min))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
259 (mh-compose-and-send-mail draft "" from-folder nil nil nil nil nil nil
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
260 config)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
261 )))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
262
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
263 ;;; by OKABE Yasuo <okabe@kudpc.kyoto-u.ac.jp>
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
264 ;;; 1996/2/29 (cf. [tm-ja:1643])
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
265 (defun tm-mh-e/extract-rejected-mail (msg)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
266 "Extract a letter returned by the mail system and make it re-editable.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
267 Default is the current message. The variable mh-new-draft-cleaned-headers
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
268 gives the headers to clean out of the original message."
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
269 (interactive (list (mh-get-msg-num t)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
270 (let ((from-folder mh-current-folder)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
271 (config (current-window-configuration))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
272 (draft (mh-read-draft "extraction" (mh-msg-filename msg) nil)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
273 (setq buffer-read-only nil)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
274 (goto-char (point-min))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
275 (cond
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
276 ((and
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
277 (re-search-forward
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
278 (concat "^\\($\\|[Cc]ontent-[Tt]ype:[ \t]+multipart/\\)") nil t)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
279 (not (bolp))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
280 (re-search-forward "boundary=\"\\([^\"]+\\)\"" nil t))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
281 (let ((case-fold-search t)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
282 (boundary (buffer-substring (match-beginning 1) (match-end 1))))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
283 (cond
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
284 ((re-search-forward
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
285 (concat "^--" boundary "\n"
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
286 "content-type:[ \t]+"
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
287 "\\(message/rfc822\\|text/rfc822-headers\\)\n"
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
288 "\\(.+\n\\)*\n") nil t)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
289 (delete-region (point-min) (point))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
290 (mh-clean-msg-header (point-min) mh-new-draft-cleaned-headers nil)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
291 (search-forward
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
292 (concat "\n--" boundary "--\n") nil t)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
293 (delete-region (match-beginning 0) (point-max)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
294 (t
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
295 (message "Seems no message/rfc822 part.")))))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
296 ((re-search-forward mh-rejected-letter-start nil t)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
297 (skip-chars-forward " \t\n")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
298 (delete-region (point-min) (point))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
299 (mh-clean-msg-header (point-min) mh-new-draft-cleaned-headers nil))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
300 (t
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
301 (message "Does not appear to be a rejected letter.")))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
302 (goto-char (point-min))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
303 (if (re-search-forward "^-+$" nil t)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
304 (replace-match "")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
305 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
306 (mime/edit-again nil t t)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
307 (goto-char (point-min))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
308 (set-buffer-modified-p nil)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
309 (mh-compose-and-send-mail draft "" from-folder msg
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
310 (mh-get-header-field "To:")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
311 (mh-get-header-field "From:")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
312 (mh-get-header-field "Cc:")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
313 nil nil config)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
314
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
315 ;;; by OKABE Yasuo <okabe@kudpc.kyoto-u.ac.jp>
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
316 ;;; 1995/11/14 (cf. [tm-ja:1099])
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
317 (defun tm-mh-e/forward (to cc &optional msg-or-seq)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
318 "Forward a message or message sequence as MIME message/rfc822.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
319 Defaults to displayed message. If optional prefix argument provided,
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
320 then prompt for the message sequence. See also documentation for
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
321 `\\[mh-send]' function."
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
322 (interactive (list (mh-read-address "To: ")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
323 (mh-read-address "Cc: ")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
324 (if current-prefix-arg
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
325 (mh-read-seq-default "Forward" t)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
326 (mh-get-msg-num t)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
327 )))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
328 (or msg-or-seq
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
329 (setq msg-or-seq (mh-get-msg-num t)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
330 (let* ((folder mh-current-folder)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
331 (config (current-window-configuration))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
332 ;; uses "draft" for compatibility with forw.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
333 ;; forw always leaves file in "draft" since it doesn't have -draft
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
334 (draft-name (expand-file-name "draft" mh-user-path))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
335 (draft (cond ((or (not (file-exists-p draft-name))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
336 (y-or-n-p "The file `draft' exists. Discard it? "))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
337 (mh-exec-cmd "comp"
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
338 "-noedit" "-nowhatnowproc"
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
339 "-form" tm-mh-e/forwcomps
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
340 "-nodraftfolder")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
341 (prog1
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
342 (mh-read-draft "" draft-name t)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
343 (mh-insert-fields "To:" to "Cc:" cc)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
344 (set-buffer-modified-p nil)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
345 (t
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
346 (mh-read-draft "" draft-name nil)))))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
347 (let ((msubtype "digest")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
348 orig-from orig-subject multipart-flag
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
349 (tag-regexp
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
350 (concat "^"
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
351 (regexp-quote (mime-make-tag "message" "rfc822"))))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
352 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
353 (goto-char (point-min))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
354 (save-excursion
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
355 (save-restriction
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
356 (goto-char (point-max))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
357 (if (not (bolp)) (insert "\n"))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
358 (let ((beg (point)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
359 (narrow-to-region beg beg)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
360 (mh-exec-cmd-output "pick" nil folder msg-or-seq)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
361 (if (> (count-lines (point) (point-max)) 1)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
362 (setq multipart-flag t)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
363 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
364 (while (re-search-forward "^\\([0-9]+\\)\n" nil t)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
365 (let ((forw-msg
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
366 (buffer-substring (match-beginning 1) (match-end 1)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
367 (beg (match-beginning 0))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
368 (end (match-end 0))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
369 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
370 (save-restriction
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
371 (narrow-to-region beg end)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
372 ;; modified for Emacs 18
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
373 (delete-region beg end)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
374 (insert-file-contents
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
375 (mh-expand-file-name forw-msg
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
376 (mh-expand-file-name folder))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
377 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
378 (save-excursion
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
379 (push-mark (point-max))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
380 (mime-editor/inserted-message-filter))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
381 (goto-char (point-max))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
382 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
383 (save-excursion
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
384 (goto-char beg)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
385 (mime-editor/insert-tag "message" "rfc822")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
386 )))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
387 (delete-region (point) (point-max))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
388 (if multipart-flag
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
389 (mime-editor/enclose-region "digest" beg (point))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
390 ))))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
391 (re-search-forward tag-regexp)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
392 (forward-line 1)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
393 (save-restriction
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
394 (narrow-to-region (point) (point-max))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
395 (setq orig-from (mime-eword/decode-string
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
396 (mh-get-header-field "From:")))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
397 (setq orig-subject (mime-eword/decode-string
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
398 (mh-get-header-field "Subject:")))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
399 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
400 (let ((forw-subject
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
401 (mh-forwarded-letter-subject orig-from orig-subject)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
402 (mh-insert-fields "Subject:" forw-subject)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
403 (goto-char (point-min))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
404 (re-search-forward tag-regexp)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
405 (forward-line -1)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
406 (delete-other-windows)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
407 (if (numberp msg-or-seq)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
408 (mh-add-msgs-to-seq msg-or-seq 'forwarded t)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
409 (mh-add-msgs-to-seq (mh-seq-to-msgs msg-or-seq) 'forwarded t))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
410 (mh-compose-and-send-mail draft "" folder msg-or-seq
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
411 to forw-subject cc
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
412 mh-note-forw "Forwarded:"
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
413 config)))))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
414
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
415 (cond ((not (featurep 'mh-utils))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
416 (defun tm-mh-e::insert-letter (folder number verbatim)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
417 (mh-insert-letter verbatim folder number)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
418 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
419 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
420 ((and (boundp 'mh-e-version)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
421 (string-lessp mh-e-version "5"))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
422 (defun tm-mh-e::insert-letter (folder number verbatim)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
423 (mh-insert-letter number folder verbatim)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
424 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
425 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
426 (t
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
427 (defalias 'tm-mh-e::insert-letter 'mh-insert-letter)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
428 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
429
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
430 (defun tm-mh-e/insert-letter (verbatim)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
431 "Interface to mh-insert-letter."
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
432 (interactive "P")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
433 (let*
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
434 ((folder (mh-prompt-for-folder
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
435 "Message from"
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
436 (if (and (stringp mh-sent-from-folder)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
437 (string-match "^\\+" mh-sent-from-folder))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
438 mh-sent-from-folder "+inbox")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
439 nil))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
440 (number (tm-mh-e/prompt-for-message "Message number: " folder)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
441 (tm-mh-e::insert-letter folder number verbatim)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
442
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
443 (defun tm-mh-e/yank-cur-msg-with-no-filter ()
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
444 "Insert the current message into the draft buffer.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
445 This function makes new show-buffer from article-buffer to disable
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
446 variable `mime-viewer/plain-text-preview-hook'. If you don't want to
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
447 use text filters for replying message, please set it to
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
448 `tm-mh-e/message-yank-function'.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
449 Prefix each non-blank line in the message with the string in
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
450 `mh-ins-buf-prefix'. The entire message will be inserted if
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
451 `mh-yank-from-start-of-msg' is non-nil. If this variable is nil, the
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
452 portion of the message following the point will be yanked. If
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
453 `mh-delete-yanked-msg-window' is non-nil, any window displaying the
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
454 yanked message will be deleted."
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
455 (interactive)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
456 (if (and mh-sent-from-folder mh-sent-from-msg)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
457 (let ((to-point (point))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
458 (to-buffer (current-buffer)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
459 (set-buffer mh-sent-from-folder)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
460 (if mh-delete-yanked-msg-window
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
461 (delete-windows-on mh-show-buffer))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
462 (set-buffer mh-show-buffer) ; Find displayed message
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
463 (let ((mh-ins-str
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
464 (if mime::preview/article-buffer
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
465 (let (mime-viewer/plain-text-preview-hook buf)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
466 (prog1
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
467 (save-window-excursion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
468 (set-buffer mime::preview/article-buffer)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
469 (setq buf (mime/viewer-mode))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
470 (buffer-string)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
471 )
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
472 (kill-buffer buf)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
473 ))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
474 (buffer-string)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
475 )))
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
476 (set-buffer to-buffer)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
477 (save-restriction
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
478 (narrow-to-region to-point to-point)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
479 (push-mark)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
480 (insert mh-ins-str)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
481 (mh-insert-prefix-string mh-ins-buf-prefix)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
482 (insert "\n"))))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
483 (error "There is no current message")))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
484
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
485 (defun tm-mh-e/yank-current-message ()
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
486 "Insert the current message into the draft buffer.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
487 It uses variable `tm-mh-e/message-yank-function'
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
488 to select message yanking function."
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
489 (interactive)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
490 (let ((mh-sent-from-folder mh-sent-from-folder)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
491 (mh-sent-from-msg mh-sent-from-msg))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
492 (if (and (not (stringp mh-sent-from-folder))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
493 (boundp 'gnus-article-buffer)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
494 (get-buffer gnus-article-buffer)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
495 (bufferp mh-sent-from-folder)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
496 ) ; might be called from GNUS
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
497 (if (boundp 'gnus-article-copy) ; might be sgnus
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
498 (save-excursion
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
499 (gnus-copy-article-buffer)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
500 (setq mh-sent-from-folder gnus-article-copy)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
501 (set-buffer mh-sent-from-folder)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
502 (setq mh-show-buffer gnus-article-copy)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
503 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
504 (save-excursion
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
505 (setq mh-sent-from-folder gnus-article-buffer)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
506 (set-buffer gnus-article-buffer)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
507 (setq mh-show-buffer (current-buffer))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
508 )))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
509 (funcall tm-mh-e/message-yank-function)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
510 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
511
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
512 (substitute-key-definition
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
513 'mh-yank-cur-msg 'tm-mh-e/yank-current-message mh-letter-mode-map)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
514 (substitute-key-definition
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
515 'mh-insert-letter 'tm-mh-e/insert-letter mh-letter-mode-map)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
516
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
517
114
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
518 ;;; @ for mu-cite
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
519 ;;;
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
520
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
521 (call-after-loaded
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
522 'mu-cite
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
523 (function
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
524 (lambda ()
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
525 (set-alist 'mu-cite/get-field-value-method-alist
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
526 'mh-letter-mode
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
527 (function
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
528 (lambda (name)
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
529 (if (and (stringp mh-sent-from-folder)
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
530 (numberp mh-sent-from-msg))
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
531 (save-excursion
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
532 (set-buffer mh-sent-from-folder)
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
533 (set-buffer mh-show-buffer)
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
534 (and (boundp 'mime::preview/article-buffer)
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
535 (bufferp mime::preview/article-buffer)
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
536 (set-buffer mime::preview/article-buffer))
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
537 (std11-field-body name)
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
538 ))
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
539 )))
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
540 )))
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
541
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 110
diff changeset
542
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
543 ;;; @ end
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
544 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
545
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
546 (provide 'tmh-comp)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
547 (require 'tm-mh-e)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
548
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
549 ;;; tmh-comp.el ends here