From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/80602 Path: news.gmane.org!not-for-mail From: Katsumi Yamaoka Newsgroups: gmane.emacs.gnus.general Subject: Re: saving copies of the messages sent in Gnus Date: Fri, 25 Nov 2011 13:26:44 +0900 Organization: Emacsen advocacy group Message-ID: References: <87sjlw9c9d.fsf@violet.siamics.net> <87r51fvytj.fsf@marauder.physik.uni-ulm.de> <86aa82vwg4.fsf@gray.siamics.net> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: dough.gmane.org 1322195277 14047 80.91.229.12 (25 Nov 2011 04:27:57 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 25 Nov 2011 04:27:57 +0000 (UTC) Cc: ding@gnus.org Original-X-From: ding-owner+M28885@lists.math.uh.edu Fri Nov 25 05:27:53 2011 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from util0.math.uh.edu ([129.7.128.18]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RTnOC-0000bB-E4 for ding-account@gmane.org; Fri, 25 Nov 2011 05:27:52 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by util0.math.uh.edu with smtp (Exim 4.63) (envelope-from ) id 1RTnNd-0001zE-Fa; Thu, 24 Nov 2011 22:27:17 -0600 Original-Received: from mx1.math.uh.edu ([129.7.128.32]) by util0.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1RTnNb-0001z2-VF for ding@lists.math.uh.edu; Thu, 24 Nov 2011 22:27:15 -0600 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx1.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.76) (envelope-from ) id 1RTnNW-000296-KO for ding@lists.math.uh.edu; Thu, 24 Nov 2011 22:27:15 -0600 Original-Received: from orlando.hostforweb.net ([216.246.45.90]) by quimby.gnus.org with esmtp (Exim 4.72) (envelope-from ) id 1RTnNT-0003M8-HY for ding@gnus.org; Fri, 25 Nov 2011 05:27:07 +0100 Original-Received: from localhost ([127.0.0.1]:50545) by orlando.hostforweb.net with smtp (Exim 4.69) (envelope-from ) id 1RTnNQ-0006Bs-AS for ding@gnus.org; Thu, 24 Nov 2011 22:27:04 -0600 Original-Newsgroups: comp.emacs,gnu.emacs.help X-Face: #kKnN,xUnmKia.'[pp`;Omh}odZK)?7wQSl"4o04=EixTF+V[""w~iNbM9ZL+.b*_CxUmFk B#Fu[*?MZZH@IkN:!"\w%I_zt>[$nm7nQosZ<3eu;B:$Q_:p!',P.c0-_Cy[dz4oIpw0ESA^D*1Lw= L&i*6&( User-Agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.91 (i686-pc-cygwin) Cancel-Lock: sha1:QI9cvCtZcNrHDBk3FaOA0kzrvOA= X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - orlando.hostforweb.net X-AntiAbuse: Original Domain - gnus.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - jpl.org X-Source: X-Source-Args: X-Source-Dir: X-Spam-Score: -0.9 (/) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:80602 Archived-At: --=-=-= Cc: ding gnus.org Topic: gnus-summary-resend-message doesn't do Gcc Ivan Shmakov wrote: >>>>>> Katsumi Yamaoka writes: >> ...whereas a message to resend is never modified and is already >> in some group. Even if it is Gcc'd, Resent- headers don't appear >> in the article buffer normally. So, Gcc'ing it does only eat >> disk, as especially to gcc-self, I think. > Resent-From: is mentioned in the default gnus-visible-headers, > not to mention that the latter is trivial to expand to cover any > of the other headers just as well. I forgot having excluded Resent headers from my `gnus-visible-headers', sorry. > However, my point is that I wish to be able to check my postings > /as they were sent/. Certain software, such as some mailing > lists packages, and the like, are known to (occasionally) mangle > message's header, body, or both. There, having a local copy of > the message sent could be quite a debugging aid. Gcc to a `sent' group might be useful, I thought afterward. So, I tried making `gnus-summary-resend-message' do Gcc. The new user option `gnus-gcc-inhibit-gcc-self-when-resending' controls whether to archive resent articles in the identical group or not. The default value is t, i.e. inhibit. A patch is below. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment 2011-11-25 Katsumi Yamaoka * gnus-msg.el (gnus-gcc-inhibit-gcc-self-when-resending): New option. (gnus-summary-resend-messag): Modify message-header-setup-hook and message-sent-hook to make it work for Gcc. * message.el (message-resend): Run message-sent-hook to do Gcc. --- gnus-msg.el~ 2011-09-11 22:00:39 +0000 +++ gnus-msg.el 2011-11-25 04:22:24 +0000 @@ -163,6 +163,14 @@ (const all :tag "Any") (string :tag "Regexp"))) +(defcustom gnus-gcc-inhibit-gcc-self-when-resending t + "If non-nil, don't do Gcc to the identical group when resending articles. +This variable is effective when resending articles with no modification +using `gnus-summary-resend-message'." + :version "24.2" + :group 'gnus-message + :type 'boolean) + (gnus-define-group-parameter posting-charset-alist :type list @@ -1277,12 +1285,30 @@ (with-current-buffer gnus-original-article-buffer (nnmail-fetch-field "to")))) current-prefix-arg)) - (dolist (article (gnus-summary-work-articles n)) - (gnus-summary-select-article nil nil nil article) - (with-current-buffer gnus-original-article-buffer - (let ((gnus-gcc-externalize-attachments nil)) - (message-resend address))) - (gnus-summary-mark-article-as-forwarded article))) + (let ((message-header-setup-hook (copy-sequence message-header-setup-hook)) + (message-sent-hook (copy-sequence message-sent-hook))) + (add-hook 'message-header-setup-hook + (lambda nil + (gnus-inews-insert-gcc) + (when gnus-gcc-inhibit-gcc-self-when-resending + (let ((gcc (mail-fetch-field "gcc" nil t))) + (when gcc + (message-remove-header "gcc") + (when (setq gcc (delete + gnus-newsgroup-name + (message-unquote-tokens + (message-tokenize-header gcc " ,")))) + (insert "Gcc: " + (mapconcat 'identity gcc ", ") "\n"))))))) + (add-hook 'message-sent-hook (if gnus-agent + 'gnus-agent-possibly-do-gcc + 'gnus-inews-do-gcc)) + (dolist (article (gnus-summary-work-articles n)) + (gnus-summary-select-article nil nil nil article) + (with-current-buffer gnus-original-article-buffer + (let ((gnus-gcc-externalize-attachments nil)) + (message-resend address))) + (gnus-summary-mark-article-as-forwarded article)))) ;; From: Matthieu Moy (defun gnus-summary-resend-message-edit () --- message.el~ 2011-11-20 22:02:20 +0000 +++ message.el 2011-11-25 04:22:24 +0000 @@ -7562,7 +7562,7 @@ (message "Resending message to %s..." address) (save-excursion (let ((cur (current-buffer)) - beg) + gcc beg) ;; We first set up a normal mail buffer. (unless (message-mail-user-agent) (set-buffer (get-buffer-create " *message resend*")) @@ -7575,6 +7575,8 @@ ;; Insert our usual headers. (message-generate-headers '(From Date To Message-ID)) (message-narrow-to-headers) + (when (setq gcc (mail-fetch-field "gcc" nil t)) + (message-remove-header "gcc")) ;; Remove X-Draft-From header etc. (message-remove-header message-ignored-mail-headers t) ;; Rename them all to "Resent-*". @@ -7616,6 +7618,10 @@ message-generate-hashcash rfc2047-encode-encoded-words) (message-send-mail)) + (when gcc + (message-goto-eoh) + (insert "Gcc: " gcc "\n")) + (run-hooks 'message-sent-hook) (kill-buffer (current-buffer))) (message "Resending message to %s...done" address))) --=-=-=--