1 ;;; gnusmail.el --- mail reply commands for GNUS newsreader
3 ;; Author: Masanobu UMEDA <umerin@flab.flab.fujitsu.junet>
4 ;; Last-Modified: 10 Jun 1992
7 ;; $Header: gnusmail.el,v 1.1 90/03/23 13:24:39 umerin Locked $
9 ;; Copyright (C) 1990 Free Software Foundation, Inc.
11 ;; This file is part of GNU Emacs.
13 ;; GNU Emacs is free software; you can redistribute it and/or modify
14 ;; it under the terms of the GNU General Public License as published by
15 ;; the Free Software Foundation; either version 2, or (at your option)
18 ;; GNU Emacs is distributed in the hope that it will be useful,
19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 ;; GNU General Public License for more details.
23 ;; You should have received a copy of the GNU General Public License
24 ;; along with GNU Emacs; see the file COPYING. If not, write to
25 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
29 ;; Provides mail reply and mail other window command using usual mail
30 ;; interface and mh-e interface.
32 ;; To use MAIL: set the variables gnus-mail-reply-method and
33 ;; gnus-mail-other-window-method to gnus-mail-reply-using-mail and
34 ;; gnus-mail-other-window-using-mail, respectively.
36 ;; To use MH-E: set the variables gnus-mail-reply-method and
37 ;; gnus-mail-other-window-method to gnus-mail-reply-using-mhe and
38 ;; gnus-mail-other-window-using-mhe, respectively.
44 (autoload 'news-mail-reply
"rnewspost")
45 (autoload 'news-mail-other-window
"rnewspost")
47 (autoload 'mh-send
"mh-e")
48 (autoload 'mh-send-other-window
"mh-e")
49 (autoload 'mh-find-path
"mh-e")
50 (autoload 'mh-yank-cur-msg
"mh-e")
52 ;;; Mail reply commands of GNUS Subject Mode
54 (defun gnus-Subject-mail-reply (yank)
55 "Reply mail to news author.
56 If prefix arg YANK is non-nil, original article is yanked automatically.
57 Customize the variable `gnus-mail-reply-method' to use another mailer."
59 (gnus-Subject-select-article)
60 (switch-to-buffer gnus-Article-buffer
)
62 (delete-other-windows)
63 (bury-buffer gnus-Article-buffer
)
64 (funcall gnus-mail-reply-method yank
))
66 (defun gnus-Subject-mail-reply-with-original ()
67 "Reply mail to news author with original article."
69 (gnus-Subject-mail-reply t
))
71 (defun gnus-Subject-mail-other-window ()
72 "Compose mail in other window.
73 Customize the variable `gnus-mail-other-window-method' to use another mailer."
75 (gnus-Subject-select-article)
76 (switch-to-buffer gnus-Article-buffer
)
78 (delete-other-windows)
79 (bury-buffer gnus-Article-buffer
)
80 (funcall gnus-mail-other-window-method
))
83 ;;; Send mail using sendmail mail mode.
85 (defun gnus-mail-reply-using-mail (&optional yank
)
86 "Compose reply mail using mail.
87 Optional argument YANK means yank original article."
89 (gnus-overload-functions)
92 (goto-char (point-max))
93 (mail-yank-original nil
)
97 (defun gnus-mail-other-window-using-mail ()
98 "Compose mail other window using mail."
99 (news-mail-other-window)
100 (gnus-overload-functions))
103 ;;; Send mail using mh-e.
105 ;; The following mh-e interface is all cooperative works of
106 ;; tanaka@flab.fujitsu.CO.JP (TANAKA Hiroshi), kawabe@sra.CO.JP
107 ;; (Yoshikatsu Kawabe), and shingu@casund.cpr.canon.co.jp (Toshiaki
110 (defun gnus-mail-reply-using-mhe (&optional yank
)
111 "Compose reply mail using mh-e.
112 Optional argument YANK means yank original article.
113 The command \\[mh-yank-cur-msg] yanks the original message into current buffer."
114 ;; First of all, prepare mhe mail buffer.
115 (let (from cc subject date to reply-to
(buffer (current-buffer)))
117 (gnus-Article-show-all-headers) ;I don't think this is really needed.
118 (setq from
(gnus-fetch-field "from")
119 subject
(let ((subject (gnus-fetch-field "subject")))
121 (not (string-match "^[Rr][Ee]:.+$" subject
)))
122 (concat "Re: " subject
) subject
))
123 reply-to
(gnus-fetch-field "reply-to")
124 cc
(gnus-fetch-field "cc")
125 date
(gnus-fetch-field "date"))
126 (setq mh-show-buffer buffer
)
127 (setq to
(or reply-to from
))
129 (mh-send to
(or cc
"") subject
)
134 (substring from
0 (string-match " *at \\| *@ \\| *(\\| *<" from
))
135 "'s message of " date
)))
136 (setq mh-sent-from-folder buffer
)
137 (setq mh-sent-from-msg
1)
139 ;; Then, yank original article if requested.
141 (let ((last (point)))
146 (defun gnus-mail-other-window-using-mhe ()
147 "Compose mail other window using MH-E Mail."
148 (let ((to (read-string "To: "))
149 (cc (read-string "Cc: "))
150 (subject (read-string "Subject: " (gnus-fetch-field "subject"))))
151 (gnus-Article-show-all-headers) ;I don't think this is really needed.
152 (setq mh-show-buffer
(current-buffer))
154 (mh-send-other-window to cc subject
)
155 (setq mh-sent-from-folder
(current-buffer))
156 (setq mh-sent-from-msg
1)))
160 ;;; gnusmail.el ends here