Gnus development mailing list
 help / color / mirror / Atom feed
* Re: saving copies of the messages sent in Gnus
       [not found]     ` <86aa82vwg4.fsf@gray.siamics.net>
@ 2011-11-25  4:26       ` Katsumi Yamaoka
  2012-01-03 21:37         ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 9+ messages in thread
From: Katsumi Yamaoka @ 2011-11-25  4:26 UTC (permalink / raw)
  Cc: ding

[-- Attachment #1: Type: text/plain, Size: 1292 bytes --]

Cc: ding <at> gnus.org
Topic: gnus-summary-resend-message doesn't do Gcc

Ivan Shmakov <oneingray@gmail.com> wrote:
>>>>>> Katsumi Yamaoka <yamaoka@jpl.org> 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.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 3464 bytes --]

2011-11-25  Katsumi Yamaoka  <yamaoka@jpl.org>

	* 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 <Matthieu.Moy@imag.fr>
 (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)))
 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: saving copies of the messages sent in Gnus
  2011-11-25  4:26       ` saving copies of the messages sent in Gnus Katsumi Yamaoka
@ 2012-01-03 21:37         ` Lars Magne Ingebrigtsen
  2012-01-05  7:28           ` Katsumi Yamaoka
  2012-01-07  2:04           ` Ted Zlatanov
  0 siblings, 2 replies; 9+ messages in thread
From: Lars Magne Ingebrigtsen @ 2012-01-03 21:37 UTC (permalink / raw)
  To: Katsumi Yamaoka; +Cc: ding

Katsumi Yamaoka <yamaoka@jpl.org> writes:

> 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.

It's a good idea.

Should we open an "mgnus" branch so that we don't lose patches like
this, perhaps?  Or perhaps it would make more sense to open an "ngnus"
branch for bug-fixes only, and continue with development on the
trunk...  I don't know...

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: saving copies of the messages sent in Gnus
  2012-01-03 21:37         ` Lars Magne Ingebrigtsen
@ 2012-01-05  7:28           ` Katsumi Yamaoka
  2012-01-05 10:43             ` Steinar Bang
  2012-02-02  1:27             ` Katsumi Yamaoka
  2012-01-07  2:04           ` Ted Zlatanov
  1 sibling, 2 replies; 9+ messages in thread
From: Katsumi Yamaoka @ 2012-01-05  7:28 UTC (permalink / raw)
  To: ding

Lars Magne Ingebrigtsen wrote:
> Katsumi Yamaoka <yamaoka@jpl.org> writes:

>> 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.

> It's a good idea.

Thanks.  Now the patch is kept as:

ftp://ftp.jpl.org/pub/tmp/Gnus-resend-Gcc.patch
(http://www.jpl.org/ftp/pub/tmp/Gnus-resend-Gcc.patch)

Moreover I have the other patches that cannot be merged to Emacs
until the next release ("Gnus-to-Emacs.patch" in the same place).
So,

> Should we open an "mgnus" branch so that we don't lose patches like
> this, perhaps?

I don't want a branch, if anything, keeping up with two or more
branches is hard (at least) to me.

> Or perhaps it would make more sense to open an "ngnus"
> branch for bug-fixes only, and continue with development on the
> trunk...  I don't know...

Bug-fixes should be done in the trunk of both Emacs and Gnus,
isn't it?  ;-)



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: saving copies of the messages sent in Gnus
  2012-01-05  7:28           ` Katsumi Yamaoka
@ 2012-01-05 10:43             ` Steinar Bang
  2012-01-09 19:40               ` Steinar Bang
  2012-02-02  1:27             ` Katsumi Yamaoka
  1 sibling, 1 reply; 9+ messages in thread
From: Steinar Bang @ 2012-01-05 10:43 UTC (permalink / raw)
  To: ding

>>>>> Katsumi Yamaoka <yamaoka@jpl.org>:

>> Should we open an "mgnus" branch so that we don't lose patches like
>> this, perhaps?

> I don't want a branch, if anything, keeping up with two or more
> branches is hard (at least) to me.

FWIW git branches aren't as hard to work with as those of the other
version control systems I've experience with.

Actually, git branches are an essential part of a git based workflow.
One makes short lived branches to save a series of commits (ie. a
patch), and merge them right and left, and delete them when finished.

Several versions of patch branches are possible: 
 - one branch per patch (which is a bit of clutter, but keep different
   patches in nice, isolated, side tracks.  The branches can be
   deleted, when the patches they contained are merged into the master
   branch)
 - an mgnus branch that can be used to collect patches

Though it may seem like creating a lot of clutter, to people unfamiliar
with git, I would actually recommend the first approach: store each
patch as a feature branch made from master, and push the branch to
git.gnus.org. 

Afterwards it is much easier to pick up the changes from the feature
branch, than to collect a lot of patches floating around.  And the
feature branches can be deleted after they have been merged into master.




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: saving copies of the messages sent in Gnus
  2012-01-03 21:37         ` Lars Magne Ingebrigtsen
  2012-01-05  7:28           ` Katsumi Yamaoka
@ 2012-01-07  2:04           ` Ted Zlatanov
  2012-01-07  6:21             ` Lars Magne Ingebrigtsen
  1 sibling, 1 reply; 9+ messages in thread
From: Ted Zlatanov @ 2012-01-07  2:04 UTC (permalink / raw)
  To: ding

On Tue, 03 Jan 2012 22:37:16 +0100 Lars Magne Ingebrigtsen <larsi@gnus.org> wrote: 

LMI> Katsumi Yamaoka <yamaoka@jpl.org> writes:
>> 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.

LMI> It's a good idea.

LMI> Should we open an "mgnus" branch so that we don't lose patches like
LMI> this, perhaps?  Or perhaps it would make more sense to open an "ngnus"
LMI> branch for bug-fixes only, and continue with development on the
LMI> trunk...  I don't know...

Make a personal "larsi" branch and keep merging "master" into it, since
you're taking responsibility for merging those patches back into
"master" eventually.  If you get hit by a bus I promise I'll merge
"larsi" back ;)

Ted




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: saving copies of the messages sent in Gnus
  2012-01-07  2:04           ` Ted Zlatanov
@ 2012-01-07  6:21             ` Lars Magne Ingebrigtsen
  2012-01-07 13:03               ` Ted Zlatanov
  0 siblings, 1 reply; 9+ messages in thread
From: Lars Magne Ingebrigtsen @ 2012-01-07  6:21 UTC (permalink / raw)
  To: ding

Ted Zlatanov <tzz@lifelogs.com> writes:

> Make a personal "larsi" branch and keep merging "master" into it, since
> you're taking responsibility for merging those patches back into
> "master" eventually.

Yabut I would want other people to hack on the new branch, too, right?

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: saving copies of the messages sent in Gnus
  2012-01-07  6:21             ` Lars Magne Ingebrigtsen
@ 2012-01-07 13:03               ` Ted Zlatanov
  0 siblings, 0 replies; 9+ messages in thread
From: Ted Zlatanov @ 2012-01-07 13:03 UTC (permalink / raw)
  To: ding

On Sat, 07 Jan 2012 07:21:44 +0100 Lars Magne Ingebrigtsen <larsi@gnus.org> wrote: 

LMI> Ted Zlatanov <tzz@lifelogs.com> writes:
>> Make a personal "larsi" branch and keep merging "master" into it, since
>> you're taking responsibility for merging those patches back into
>> "master" eventually.

LMI> Yabut I would want other people to hack on the new branch, too, right?

As long as you publish it to the repo it's fine.  You can call it
anything, really, but your name in the branch name marks it so people
know it's not a release or a tag.

Ted




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: saving copies of the messages sent in Gnus
  2012-01-05 10:43             ` Steinar Bang
@ 2012-01-09 19:40               ` Steinar Bang
  0 siblings, 0 replies; 9+ messages in thread
From: Steinar Bang @ 2012-01-09 19:40 UTC (permalink / raw)
  To: ding

>>>>> Steinar Bang <sb@dod.no>:

[snip!]
>  - one branch per patch (which is a bit of clutter, but keep different
>    patches in nice, isolated, side tracks.  The branches can be
>    deleted, when the patches they contained are merged into the master
>    branch)
[snip!]
> Though it may seem like creating a lot of clutter, to people unfamiliar
> with git, I would actually recommend the first approach: store each
> patch as a feature branch made from master, and push the branch to
> git.gnus.org. 

> Afterwards it is much easier to pick up the changes from the feature
> branch, than to collect a lot of patches floating around.  And the
> feature branches can be deleted after they have been merged into
> master.

It's also possible for people without gnus git repo write access, to:
 - make changes as local branches in the local repo
 - push their local repo to some publicly readable repo (eg. on github)

Then Lars, or whoever is integrating the patches, can:
 - add the publicly available repository as a remote
 - fetch from that repository
 - merge branches from that repository into git master

I have to admit that git is really quite clever...




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: saving copies of the messages sent in Gnus
  2012-01-05  7:28           ` Katsumi Yamaoka
  2012-01-05 10:43             ` Steinar Bang
@ 2012-02-02  1:27             ` Katsumi Yamaoka
  1 sibling, 0 replies; 9+ messages in thread
From: Katsumi Yamaoka @ 2012-02-02  1:27 UTC (permalink / raw)
  To: ding

Katsumi Yamaoka wrote:
> Lars Magne Ingebrigtsen wrote:
>> Katsumi Yamaoka <yamaoka@jpl.org> writes:
>>> 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.

>> It's a good idea.

I changed `gnus-gcc-inhibit-gcc-self-when-resending' into:

,----
| `gnus-gcc-self-resent-messages'
|
| Like `gcc-self' group parameter, only for unmodified resent messages.
| Applied to messages sent by `gnus-summary-resend-message'.  Non-nil
| value of this variable takes precedence over any existing Gcc header.
|
| If this is `none', no Gcc copy will be made.  If this is t, messages
| resent will be Gcc'd to the current group.  If this is a string, it
| specifies a group to which resent messages will be Gcc'd.  If this is
| nil, Gcc will be done according to existing Gcc header(s), if any.
| If this is `no-gcc-self', resent messages will be Gcc'd to groups that
| existing Gcc header specifies, except for the current group.
`----

The default value is `no-gcc-self'.  Added to 真 Gnus.



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2012-02-02  1:27 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <87sjlw9c9d.fsf@violet.siamics.net>
     [not found] ` <87r51fvytj.fsf@marauder.physik.uni-ulm.de>
     [not found]   ` <b4m7h36lx6n.fsf@jpl.org>
     [not found]     ` <86aa82vwg4.fsf@gray.siamics.net>
2011-11-25  4:26       ` saving copies of the messages sent in Gnus Katsumi Yamaoka
2012-01-03 21:37         ` Lars Magne Ingebrigtsen
2012-01-05  7:28           ` Katsumi Yamaoka
2012-01-05 10:43             ` Steinar Bang
2012-01-09 19:40               ` Steinar Bang
2012-02-02  1:27             ` Katsumi Yamaoka
2012-01-07  2:04           ` Ted Zlatanov
2012-01-07  6:21             ` Lars Magne Ingebrigtsen
2012-01-07 13:03               ` Ted Zlatanov

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).