* [CODE] Editing and resending an existing mail.
@ 2002-01-31 13:39 Matthieu Moy
2002-01-31 14:12 ` ShengHuo ZHU
0 siblings, 1 reply; 3+ messages in thread
From: Matthieu Moy @ 2002-01-31 13:39 UTC (permalink / raw)
Hello.
Some time ago, I had written a mail, and wanted to send it to someone
else.
There is the function Resend Message, but it does not allow edition of
the article, and I also wanted to change something inside the
message. I knew it in mutt (M-e), but did not find it in Gnus.
So, I wrote a little function to do that. Here it is.
On fr.comp.applications.emacs, some other people were interested in
it, so, I wonder if this could be integrated in gnus itself. (isn't
mutt supposed to be included in Gnus ;-)
It is also availlable from
http://www-verimag.imag.fr/~moy/emacs/moy-gnus.el
--
Matthieu
;;; moy-gnus.el --- My gnus stuff.
;; Copyright (C) 2002 Free Software Foundation, Inc.
;; Author: Matthieu Moy <Matthieu.Moy@imag.fr>
;; Keywords: mail
;; This file is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.
;; This file is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to
;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;; Boston, MA 02111-1307, USA.
;;; Commentary:
;; Usage : in .gnus
;;
;; | (require 'moy-gnus)
;; | (gnus-define-keys (gnus-send-bounce-map "D" gnus-summary-send-map)
;; | "e" moy-gnus-summary-resend-article ; This could also be added in
;; | ; gnus-msg.el line 262.
;; | )
;;
;; Then S D e in summary buffer will re-open the current article in a
;; new mail edition buffer. The user will be able to edit the article
;; and header, and resend it as a new mail.
;;; Code:
(defun moy-gnus-summary-resend-article ()
"In gnus summary mode, resend an article that has already been sent.
A new buffer will be created to allow the user to modify body and
contents of the message, and then, everything will happen as when
composing a new message."
(interactive)
(let ((article (gnus-summary-article-number)))
(gnus-setup-message 'reply-yank
(gnus-summary-select-article t)
(set-buffer gnus-original-article-buffer)
(let ((cur (current-buffer))
(to (message-fetch-field "to")))
;; Get a normal message buffer.
(message-pop-to-buffer (message-buffer-name "Resend" to))
(insert-buffer-substring cur)
(mime-to-mml)
(message-narrow-to-head-1)
(message-remove-header "Message-ID")
(goto-char (point-max))
;(forward-char -1)
(insert "Message-ID: " (message-make-message-id) "\n")
;; Remove unwanted headers.
(goto-char (point-max))
(insert mail-header-separator)
(goto-char (point-min))
(re-search-forward "^To:\\|^Newsgroups:")
(forward-char 1)
(widen)
)
)))
(provide 'moy-gnus)
;;; moy-gnus.el ends here
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [CODE] Editing and resending an existing mail.
2002-01-31 13:39 [CODE] Editing and resending an existing mail Matthieu Moy
@ 2002-01-31 14:12 ` ShengHuo ZHU
2002-01-31 14:46 ` Matthieu Moy
0 siblings, 1 reply; 3+ messages in thread
From: ShengHuo ZHU @ 2002-01-31 14:12 UTC (permalink / raw)
Matthieu Moy <matthieumNOSPAM@yahoo.com.invalid> writes:
> Some time ago, I had written a mail, and wanted to send it to someone
> else.
>
> There is the function Resend Message, but it does not allow edition of
> the article, and I also wanted to change something inside the
> message. I knew it in mutt (M-e), but did not find it in Gnus.
I use gnus-summary-supersede-article to do a similar job. Maybe its
name is confusing for such a job or it cancels the existing article.
> So, I wrote a little function to do that. Here it is.
>
> On fr.comp.applications.emacs, some other people were interested in
> it, so, I wonder if this could be integrated in gnus itself. (isn't
> mutt supposed to be included in Gnus ;-)
You need sign a form before the code is formally included in Gnus.
I'll send you the request form.
[...]
> (message-narrow-to-head-1)
> (message-remove-header "Message-ID")
> (goto-char (point-max))
> ;(forward-char -1)
> (insert "Message-ID: " (message-make-message-id) "\n")
This line is not necessary, because Gnus will generate it when
sending the message.
> (re-search-forward "^To:\\|^Newsgroups:")
> (forward-char 1)
Maybe we can replace these two lines with
(re-search-forward "^To: *\\|^Newsgroups: *" nil 'move)
ShengHuo
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [CODE] Editing and resending an existing mail.
2002-01-31 14:12 ` ShengHuo ZHU
@ 2002-01-31 14:46 ` Matthieu Moy
0 siblings, 0 replies; 3+ messages in thread
From: Matthieu Moy @ 2002-01-31 14:46 UTC (permalink / raw)
ShengHuo ZHU <zsh@cs.rochester.edu> writes:
> I use gnus-summary-supersede-article to do a similar job. Maybe its
> name is confusing for such a job or it cancels the existing article.
It is supposed to modify an already posted news article (cancel the
old one, and put the new one instead, with the same message-ID), but
should have no sense for mail. The only real difference is that
supersede changes the header message-ID into Supersed or something
like that. It can work, but is probably not very RFC compliant ...
No objection to the other suggestions. I do it right now.
Some slight modification should be done to put the keyboard shortcut
in the global map, and same for the menu.
--
Matthieu
55a56
> ;; Gnus will generate a new one when sending.
57,59d57
< (goto-char (point-max))
< ;(forward-char -1)
< (insert "Message-ID: " (message-make-message-id) "\n")
64,65c62
< (re-search-forward "^To:\\|^Newsgroups:")
< (forward-char 1)
---
> (re-search-forward "^To: *\\|^Newsgroups: *" nil 'move)
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2002-01-31 14:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-01-31 13:39 [CODE] Editing and resending an existing mail Matthieu Moy
2002-01-31 14:12 ` ShengHuo ZHU
2002-01-31 14:46 ` Matthieu Moy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).