Mercurial > emacs
annotate lisp/=gnusmail.el @ 21042:b6530c2add6a
(set-default-coding-systems): Set
default-file-name-coding-system. Doc-string modified.
(prefer-coding-system): Doc-string modified.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Tue, 03 Mar 1998 01:36:35 +0000 |
parents | 5f69627d9466 |
children |
rev | line source |
---|---|
660
08eb386dd0f3
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
584
diff
changeset
|
1 ;;; gnusmail.el --- mail reply commands for GNUS newsreader |
08eb386dd0f3
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
584
diff
changeset
|
2 |
2843 | 3 ;; Copyright (C) 1990, 1993 Free Software Foundation, Inc. |
846
20674ae6bf52
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
811
diff
changeset
|
4 |
8100 | 5 ;; Author: Masanobu UMEDA <umerin@mse.kyutech.ac.jp> |
811
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
807
diff
changeset
|
6 ;; Keywords: news |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
711
diff
changeset
|
7 |
205 | 8 ;; This file is part of GNU Emacs. |
9 | |
710
d18c8feb66bd
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
660
diff
changeset
|
10 ;; GNU Emacs is free software; you can redistribute it and/or modify |
d18c8feb66bd
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
660
diff
changeset
|
11 ;; it under the terms of the GNU General Public License as published by |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
711
diff
changeset
|
12 ;; the Free Software Foundation; either version 2, or (at your option) |
710
d18c8feb66bd
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
660
diff
changeset
|
13 ;; any later version. |
205 | 14 |
710
d18c8feb66bd
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
660
diff
changeset
|
15 ;; GNU Emacs is distributed in the hope that it will be useful, |
d18c8feb66bd
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
660
diff
changeset
|
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
d18c8feb66bd
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
660
diff
changeset
|
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
d18c8feb66bd
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
660
diff
changeset
|
18 ;; GNU General Public License for more details. |
d18c8feb66bd
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
660
diff
changeset
|
19 |
d18c8feb66bd
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
660
diff
changeset
|
20 ;; You should have received a copy of the GNU General Public License |
d18c8feb66bd
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
660
diff
changeset
|
21 ;; along with GNU Emacs; see the file COPYING. If not, write to |
d18c8feb66bd
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
660
diff
changeset
|
22 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. |
205 | 23 |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
711
diff
changeset
|
24 ;;; Commentary: |
205 | 25 |
26 ;; Provides mail reply and mail other window command using usual mail | |
27 ;; interface and mh-e interface. | |
28 ;; | |
29 ;; To use MAIL: set the variables gnus-mail-reply-method and | |
30 ;; gnus-mail-other-window-method to gnus-mail-reply-using-mail and | |
31 ;; gnus-mail-other-window-using-mail, respectively. | |
32 ;; | |
33 ;; To use MH-E: set the variables gnus-mail-reply-method and | |
34 ;; gnus-mail-other-window-method to gnus-mail-reply-using-mhe and | |
35 ;; gnus-mail-other-window-using-mhe, respectively. | |
36 | |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
711
diff
changeset
|
37 ;;; Code: |
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
711
diff
changeset
|
38 |
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
711
diff
changeset
|
39 (require 'gnus) |
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
711
diff
changeset
|
40 |
205 | 41 (autoload 'news-mail-reply "rnewspost") |
42 (autoload 'news-mail-other-window "rnewspost") | |
43 | |
44 (autoload 'mh-send "mh-e") | |
45 (autoload 'mh-send-other-window "mh-e") | |
46 (autoload 'mh-find-path "mh-e") | |
47 (autoload 'mh-yank-cur-msg "mh-e") | |
48 | |
2843 | 49 ;;; Mail reply commands of GNUS Summary Mode |
205 | 50 |
2843 | 51 (defun gnus-summary-reply (yank) |
205 | 52 "Reply mail to news author. |
2843 | 53 If prefix argument YANK is non-nil, original article is yanked automatically. |
54 Customize the variable gnus-mail-reply-method to use another mailer." | |
205 | 55 (interactive "P") |
2843 | 56 ;; Bug fix by jbw@bigbird.bu.edu (Joe Wells) |
57 ;; Stripping headers should be specified with mail-yank-ignored-headers. | |
58 (gnus-summary-select-article t t) | |
59 (switch-to-buffer gnus-article-buffer) | |
205 | 60 (widen) |
61 (delete-other-windows) | |
2843 | 62 (bury-buffer gnus-article-buffer) |
205 | 63 (funcall gnus-mail-reply-method yank)) |
64 | |
2843 | 65 (defun gnus-summary-reply-with-original () |
66 "Reply mail to news author with original article. | |
67 Customize the variable gnus-mail-reply-method to use another mailer." | |
205 | 68 (interactive) |
2843 | 69 (gnus-summary-reply t)) |
205 | 70 |
2843 | 71 (defun gnus-summary-mail-forward () |
72 "Forward the current message to another user. | |
73 Customize the variable gnus-mail-forward-method to use another mailer." | |
205 | 74 (interactive) |
2843 | 75 (gnus-summary-select-article) |
76 (switch-to-buffer gnus-article-buffer) | |
205 | 77 (widen) |
78 (delete-other-windows) | |
2843 | 79 (bury-buffer gnus-article-buffer) |
80 (funcall gnus-mail-forward-method)) | |
81 | |
82 (defun gnus-summary-mail-other-window () | |
83 "Compose mail in other window. | |
84 Customize the variable gnus-mail-other-window-method to use another mailer." | |
85 (interactive) | |
86 (gnus-summary-select-article) | |
87 (switch-to-buffer gnus-article-buffer) | |
88 (widen) | |
89 (delete-other-windows) | |
90 (bury-buffer gnus-article-buffer) | |
205 | 91 (funcall gnus-mail-other-window-method)) |
92 | |
93 | |
94 ;;; Send mail using sendmail mail mode. | |
95 | |
96 (defun gnus-mail-reply-using-mail (&optional yank) | |
97 "Compose reply mail using mail. | |
98 Optional argument YANK means yank original article." | |
99 (news-mail-reply) | |
100 (gnus-overload-functions) | |
101 (if yank | |
10185
5f69627d9466
(gnus-mail-reply-using-mail): Don't save point;
Richard M. Stallman <rms@gnu.org>
parents:
8150
diff
changeset
|
102 (mail-yank-original nil))) |
205 | 103 |
2843 | 104 (defun gnus-mail-forward-using-mail () |
105 "Forward the current message to another user using mail." | |
106 ;; This is almost a carbon copy of rmail-forward in rmail.el. | |
107 (let ((forward-buffer (current-buffer)) | |
108 (subject | |
109 (concat "[" gnus-newsgroup-name "] " | |
110 ;;(mail-strip-quoted-names (gnus-fetch-field "From")) ": " | |
111 (or (gnus-fetch-field "Subject") "")))) | |
112 ;; If only one window, use it for the mail buffer. | |
113 ;; Otherwise, use another window for the mail buffer | |
114 ;; so that the Rmail buffer remains visible | |
115 ;; and sending the mail will get back to it. | |
116 (if (if (one-window-p t) | |
117 (mail nil nil subject) | |
118 (mail-other-window nil nil subject)) | |
119 (save-excursion | |
120 (goto-char (point-max)) | |
121 (insert "------- Start of forwarded message -------\n") | |
122 (insert-buffer forward-buffer) | |
123 (goto-char (point-max)) | |
124 (insert "------- End of forwarded message -------\n") | |
125 ;; You have a chance to arrange the message. | |
126 (run-hooks 'gnus-mail-forward-hook) | |
127 )))) | |
128 | |
205 | 129 (defun gnus-mail-other-window-using-mail () |
130 "Compose mail other window using mail." | |
131 (news-mail-other-window) | |
132 (gnus-overload-functions)) | |
133 | |
134 | |
135 ;;; Send mail using mh-e. | |
136 | |
137 ;; The following mh-e interface is all cooperative works of | |
138 ;; tanaka@flab.fujitsu.CO.JP (TANAKA Hiroshi), kawabe@sra.CO.JP | |
139 ;; (Yoshikatsu Kawabe), and shingu@casund.cpr.canon.co.jp (Toshiaki | |
140 ;; SHINGU). | |
141 | |
142 (defun gnus-mail-reply-using-mhe (&optional yank) | |
143 "Compose reply mail using mh-e. | |
144 Optional argument YANK means yank original article. | |
2843 | 145 The command \\[mh-yank-cur-msg] yank the original message into current buffer." |
205 | 146 ;; First of all, prepare mhe mail buffer. |
147 (let (from cc subject date to reply-to (buffer (current-buffer))) | |
148 (save-restriction | |
2843 | 149 (gnus-article-show-all-headers) ;I don't think this is really needed. |
205 | 150 (setq from (gnus-fetch-field "from") |
8150
1b4a4f7a6dcb
(gnus-mail-reply-using-mhe): Handle case of no subject.
Richard M. Stallman <rms@gnu.org>
parents:
8100
diff
changeset
|
151 subject (let ((subject (or (gnus-fetch-field "subject") |
1b4a4f7a6dcb
(gnus-mail-reply-using-mhe): Handle case of no subject.
Richard M. Stallman <rms@gnu.org>
parents:
8100
diff
changeset
|
152 "(None)"))) |
205 | 153 (if (and subject |
154 (not (string-match "^[Rr][Ee]:.+$" subject))) | |
155 (concat "Re: " subject) subject)) | |
156 reply-to (gnus-fetch-field "reply-to") | |
157 cc (gnus-fetch-field "cc") | |
158 date (gnus-fetch-field "date")) | |
159 (setq mh-show-buffer buffer) | |
160 (setq to (or reply-to from)) | |
161 (mh-find-path) | |
162 (mh-send to (or cc "") subject) | |
163 (save-excursion | |
164 (mh-insert-fields | |
165 "In-reply-to:" | |
166 (concat | |
167 (substring from 0 (string-match " *at \\| *@ \\| *(\\| *<" from)) | |
168 "'s message of " date))) | |
169 (setq mh-sent-from-folder buffer) | |
170 (setq mh-sent-from-msg 1) | |
171 )) | |
172 ;; Then, yank original article if requested. | |
173 (if yank | |
174 (let ((last (point))) | |
175 (mh-yank-cur-msg) | |
176 (goto-char last) | |
177 ))) | |
178 | |
2843 | 179 ;; gnus-mail-forward-using-mhe is contributed by Jun-ichiro Itoh |
180 ;; <itojun@ingram.mt.cs.keio.ac.jp> | |
181 | |
182 (defun gnus-mail-forward-using-mhe () | |
183 "Forward the current message to another user using mh-e." | |
184 ;; First of all, prepare mhe mail buffer. | |
185 (let ((to (read-string "To: ")) | |
186 (cc (read-string "Cc: ")) | |
187 (buffer (current-buffer)) | |
188 subject) | |
189 ;;(gnus-article-show-all-headers) | |
190 (setq subject | |
191 (concat "[" gnus-newsgroup-name "] " | |
192 ;;(mail-strip-quoted-names (gnus-fetch-field "From")) ": " | |
193 (or (gnus-fetch-field "subject") ""))) | |
194 (setq mh-show-buffer buffer) | |
195 (mh-find-path) | |
196 (mh-send to (or cc "") subject) | |
197 (save-excursion | |
198 (goto-char (point-max)) | |
199 (insert "\n------- Forwarded Message\n\n") | |
200 (insert-buffer buffer) | |
201 (goto-char (point-max)) | |
202 (insert "\n------- End of Forwarded Message\n") | |
203 (setq mh-sent-from-folder buffer) | |
204 (setq mh-sent-from-msg 1)))) | |
205 | |
205 | 206 (defun gnus-mail-other-window-using-mhe () |
2843 | 207 "Compose mail other window using mh-e." |
205 | 208 (let ((to (read-string "To: ")) |
209 (cc (read-string "Cc: ")) | |
210 (subject (read-string "Subject: " (gnus-fetch-field "subject")))) | |
2843 | 211 (gnus-article-show-all-headers) ;I don't think this is really needed. |
205 | 212 (setq mh-show-buffer (current-buffer)) |
213 (mh-find-path) | |
214 (mh-send-other-window to cc subject) | |
215 (setq mh-sent-from-folder (current-buffer)) | |
216 (setq mh-sent-from-msg 1))) | |
584 | 217 |
218 (provide 'gnusmail) | |
660
08eb386dd0f3
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
584
diff
changeset
|
219 |
08eb386dd0f3
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
584
diff
changeset
|
220 ;;; gnusmail.el ends here |