Gnus development mailing list
 help / color / mirror / Atom feed
* Sending patch with Gnus
@ 2010-12-15 16:05 Francis Moreau
  2010-12-15 19:21 ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 33+ messages in thread
From: Francis Moreau @ 2010-12-15 16:05 UTC (permalink / raw)
  To: ding

Hello,

Since Gnus is using Git as SCM, I'm wondering if some of you have a
magical function that can be used to send patch easily.

For example, git-format-patch(1) generates a patch with all header
fields set up such as "Subject, From..." and I'd like to create a new
mail automatically from the generated patch using the header fields in
the patch.

Currently I'm starting a new mail and in the message body I'm inserting
the output from git-format-patch(1) and then I do some clean up
_manually_.

Using git-send-email(1) with its ton of options is too complex for me
when I need to send only 1 patch.

I'm too bad with elisp to write my own function so I'm asking just in
case.

Thanks
-- 
Francis



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

* Re: Sending patch with Gnus
  2010-12-15 16:05 Sending patch with Gnus Francis Moreau
@ 2010-12-15 19:21 ` Lars Magne Ingebrigtsen
  2010-12-15 21:11   ` Thierry Volpiatto
  2010-12-15 21:27   ` Tassilo Horn
  0 siblings, 2 replies; 33+ messages in thread
From: Lars Magne Ingebrigtsen @ 2010-12-15 19:21 UTC (permalink / raw)
  To: emacs-devel; +Cc: ding

Francis Moreau <francis.moro@gmail.com> writes:

> Since Gnus is using Git as SCM, I'm wondering if some of you have a
> magical function that can be used to send patch easily.
>
> For example, git-format-patch(1) generates a patch with all header
> fields set up such as "Subject, From..." and I'd like to create a new
> mail automatically from the generated patch using the header fields in
> the patch.
>
> Currently I'm starting a new mail and in the message body I'm inserting
> the output from git-format-patch(1) and then I do some clean up
> _manually_.
>
> Using git-send-email(1) with its ton of options is too complex for me
> when I need to send only 1 patch.

This sounds like a good idea, but I think that it might belong more to
vc-mode than to Gnus, so I've Cc'd it to emacs-devel.

Does the VC system have a general "make-an-email-from-this-patch"
mechanism? 

-- 
(domestic pets only, the antidote for overdose, milk.)
  larsi@gnus.org * Lars Magne Ingebrigtsen




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

* Re: Sending patch with Gnus
  2010-12-15 19:21 ` Lars Magne Ingebrigtsen
@ 2010-12-15 21:11   ` Thierry Volpiatto
  2010-12-15 21:50     ` Francis Moreau
  2010-12-16  6:09     ` Leo
  2010-12-15 21:27   ` Tassilo Horn
  1 sibling, 2 replies; 33+ messages in thread
From: Thierry Volpiatto @ 2010-12-15 21:11 UTC (permalink / raw)
  To: emacs-devel; +Cc: ding

Lars Magne Ingebrigtsen <larsi@gnus.org> writes:

> Francis Moreau <francis.moro@gmail.com> writes:
>
>> Since Gnus is using Git as SCM, I'm wondering if some of you have a
>> magical function that can be used to send patch easily.
>>
>> For example, git-format-patch(1) generates a patch with all header
>> fields set up such as "Subject, From..." and I'd like to create a new
>> mail automatically from the generated patch using the header fields in
>> the patch.
>>
>> Currently I'm starting a new mail and in the message body I'm inserting
>> the output from git-format-patch(1) and then I do some clean up
>> _manually_.
>>
>> Using git-send-email(1) with its ton of options is too complex for me
>> when I need to send only 1 patch.
>
> This sounds like a good idea, but I think that it might belong more to
> vc-mode than to Gnus, so I've Cc'd it to emacs-devel.
>
> Does the VC system have a general "make-an-email-from-this-patch"
> mechanism? 
DVC have this.
M-x dvc-export-via-mail

-- 
A+ Thierry
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997 




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

* Re: Sending patch with Gnus
  2010-12-15 19:21 ` Lars Magne Ingebrigtsen
  2010-12-15 21:11   ` Thierry Volpiatto
@ 2010-12-15 21:27   ` Tassilo Horn
  2010-12-15 21:41     ` Francis Moreau
  1 sibling, 1 reply; 33+ messages in thread
From: Tassilo Horn @ 2010-12-15 21:27 UTC (permalink / raw)
  To: ding; +Cc: Lars Magne Ingebrigtsen, emacs-devel

On Wednesday 15 December 2010 20:21:31 Lars Magne Ingebrigtsen wrote:

> > Currently I'm starting a new mail and in the message body I'm
> > inserting the output from git-format-patch(1) and then I do some
> > clean up _manually_.
> >
> > Using git-send-email(1) with its ton of options is too complex for
> > me when I need to send only 1 patch.
> 
> This sounds like a good idea, but I think that it might belong more to
> vc-mode than to Gnus, so I've Cc'd it to emacs-devel.

I do the same as Francis, e.g., insert and edit.  And at least with git,
you should write your accompanying prose text below the signature.
That's a bit awkward, but it allows to pipe the complete email to "git
am" (is it am?) without having to extract the patch manually first.

Bye,
Tassilo



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

* Re: Sending patch with Gnus
  2010-12-15 21:27   ` Tassilo Horn
@ 2010-12-15 21:41     ` Francis Moreau
  2010-12-15 22:06       ` Tassilo Horn
  0 siblings, 1 reply; 33+ messages in thread
From: Francis Moreau @ 2010-12-15 21:41 UTC (permalink / raw)
  To: Tassilo Horn; +Cc: ding, Lars Magne Ingebrigtsen, emacs-devel

Tassilo Horn <tassilo@member.fsf.org> writes:

> On Wednesday 15 December 2010 20:21:31 Lars Magne Ingebrigtsen wrote:
>
>> > Currently I'm starting a new mail and in the message body I'm
>> > inserting the output from git-format-patch(1) and then I do some
>> > clean up _manually_.
>> >
>> > Using git-send-email(1) with its ton of options is too complex for
>> > me when I need to send only 1 patch.
>> 
>> This sounds like a good idea, but I think that it might belong more to
>> vc-mode than to Gnus, so I've Cc'd it to emacs-devel.
>
> I do the same as Francis, e.g., insert and edit.  And at least with git,
> you should write your accompanying prose text below the signature.
> That's a bit awkward, but it allows to pipe the complete email to "git
> am" (is it am?) without having to extract the patch manually first.

I'm not sure to understand this.

What do you mean by "accompanying prose text" ?

-- 
Francis



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

* Re: Sending patch with Gnus
  2010-12-15 21:11   ` Thierry Volpiatto
@ 2010-12-15 21:50     ` Francis Moreau
  2010-12-15 21:54       ` Lars Magne Ingebrigtsen
  2010-12-16  6:09     ` Leo
  1 sibling, 1 reply; 33+ messages in thread
From: Francis Moreau @ 2010-12-15 21:50 UTC (permalink / raw)
  To: Thierry Volpiatto; +Cc: emacs-devel, ding

Thierry Volpiatto <thierry.volpiatto@gmail.com> writes:

> Lars Magne Ingebrigtsen <larsi@gnus.org> writes:
>
>> Francis Moreau <francis.moro@gmail.com> writes:
>>
>>> Since Gnus is using Git as SCM, I'm wondering if some of you have a
>>> magical function that can be used to send patch easily.
>>>
>>> For example, git-format-patch(1) generates a patch with all header
>>> fields set up such as "Subject, From..." and I'd like to create a new
>>> mail automatically from the generated patch using the header fields in
>>> the patch.
>>>
>>> Currently I'm starting a new mail and in the message body I'm inserting
>>> the output from git-format-patch(1) and then I do some clean up
>>> _manually_.
>>>
>>> Using git-send-email(1) with its ton of options is too complex for me
>>> when I need to send only 1 patch.
>>
>> This sounds like a good idea, but I think that it might belong more to
>> vc-mode than to Gnus, so I've Cc'd it to emacs-devel.
>>
>> Does the VC system have a general "make-an-email-from-this-patch"
>> mechanism? 
> DVC have this.
> M-x dvc-export-via-mail

Well, I don't use VC (or DVC) mode because I just prefer using the SCM
directly since it allows to do much more things. And IIRC, VC mode do
some automatic things which can slow down a lot emacs when dealing with
large repos.

-- 
Francis



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

* Re: Sending patch with Gnus
  2010-12-15 21:50     ` Francis Moreau
@ 2010-12-15 21:54       ` Lars Magne Ingebrigtsen
  2010-12-15 22:13         ` Francis Moreau
  0 siblings, 1 reply; 33+ messages in thread
From: Lars Magne Ingebrigtsen @ 2010-12-15 21:54 UTC (permalink / raw)
  To: ding; +Cc: emacs-devel

Francis Moreau <francis.moro@gmail.com> writes:

> Well, I don't use VC (or DVC) mode because I just prefer using the SCM
> directly since it allows to do much more things. And IIRC, VC mode do
> some automatic things which can slow down a lot emacs when dealing with
> large repos.

I use three different SCMs daily, and I'd go (even more) insane if
vc-mode didn't wallpaper over all most of the differences between them.

And I haven't really seen any major `M-x vc-dir' slowdowns (except when
the underlying SCM is slow).

-- 
(domestic pets only, the antidote for overdose, milk.)
  larsi@gnus.org * Lars Magne Ingebrigtsen




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

* Re: Sending patch with Gnus
  2010-12-15 21:41     ` Francis Moreau
@ 2010-12-15 22:06       ` Tassilo Horn
  2010-12-15 22:27         ` Francis Moreau
  0 siblings, 1 reply; 33+ messages in thread
From: Tassilo Horn @ 2010-12-15 22:06 UTC (permalink / raw)
  To: Francis Moreau; +Cc: Lars Magne Ingebrigtsen, ding, emacs-devel

Francis Moreau <francis.moro@gmail.com> writes:

Hi Francis,

>> I do the same as Francis, e.g., insert and edit.  And at least with
>> git, you should write your accompanying prose text below the
>> signature.  That's a bit awkward, but it allows to pipe the complete
>> email to "git am" (is it am?) without having to extract the patch
>> manually first.
>
> I'm not sure to understand this.
>
> What do you mean by "accompanying prose text" ?

The text in which you explain for what it's good for, where you ask the
list to review it, in contrast to the 1-line summary git puts in the
subject and the following full commit message, which starts the mail.

Bye,
Tassilo



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

* Re: Sending patch with Gnus
  2010-12-15 21:54       ` Lars Magne Ingebrigtsen
@ 2010-12-15 22:13         ` Francis Moreau
  0 siblings, 0 replies; 33+ messages in thread
From: Francis Moreau @ 2010-12-15 22:13 UTC (permalink / raw)
  To: ding

Lars Magne Ingebrigtsen <larsi@gnus.org> writes:

> Francis Moreau <francis.moro@gmail.com> writes:
>
>> Well, I don't use VC (or DVC) mode because I just prefer using the SCM
>> directly since it allows to do much more things. And IIRC, VC mode do
>> some automatic things which can slow down a lot emacs when dealing with
>> large repos.
>
> I use three different SCMs daily, and I'd go (even more) insane if
> vc-mode didn't wallpaper over all most of the differences between them.

Well I'm using 2 different SCMs, and I agree that it's a pain to learn
the different syntaxes. However, the simplicity given by vc-mode has a
cost IMO: it can hide a lot of powerfull commands or even worse make a
user don't understand what he's really doing...

> And I haven't really seen any major `M-x vc-dir' slowdowns (except when
> the underlying SCM is slow).

That happens when working with large repositories. I recall that
starting emacs in a huge git repository was painfull. And some
information, like name of the current branch or status of the repo, were
shown somewhere on the mode line.

-- 
Francis



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

* Re: Sending patch with Gnus
  2010-12-15 22:06       ` Tassilo Horn
@ 2010-12-15 22:27         ` Francis Moreau
  0 siblings, 0 replies; 33+ messages in thread
From: Francis Moreau @ 2010-12-15 22:27 UTC (permalink / raw)
  To: Tassilo Horn; +Cc: Lars Magne Ingebrigtsen, ding, emacs-devel

Hello Tassilo,

Tassilo Horn <tassilo@member.fsf.org> writes:

> Francis Moreau <francis.moro@gmail.com> writes:
>
> Hi Francis,
>
>>> I do the same as Francis, e.g., insert and edit.  And at least with
>>> git, you should write your accompanying prose text below the
>>> signature.  That's a bit awkward, but it allows to pipe the complete
>>> email to "git am" (is it am?) without having to extract the patch
>>> manually first.
>>
>> I'm not sure to understand this.
>>
>> What do you mean by "accompanying prose text" ?
>
> The text in which you explain for what it's good for, where you ask the
> list to review it, in contrast to the 1-line summary git puts in the
> subject and the following full commit message, which starts the mail.

Ah I see, then I think you should place such text like this:


  [PATCH] A cool patch to speed up Gnus ;)
  
  A full commit message
  
  ---
  
  The text placed here is usually a message that is addressed to the list
  but won't be part of the commit.
  
   texi/ChangeLog |    4 ++++
   texi/gnus.texi |    2 +-
   2 files changed, 5 insertions(+), 1 deletions(-)
  
  diff --git a/texi/ChangeLog b/texi/ChangeLog
  index 8c0fec4..bf494ee 100644
  --- a/texi/ChangeLog
  +++ b/texi/ChangeLog

  [...]
  
  -- 
  1.7.3.2

-- 
Francis



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

* Re: Sending patch with Gnus
  2010-12-15 21:11   ` Thierry Volpiatto
  2010-12-15 21:50     ` Francis Moreau
@ 2010-12-16  6:09     ` Leo
  2010-12-16 10:01       ` Francis Moreau
  2010-12-16 15:53       ` Lars Magne Ingebrigtsen
  1 sibling, 2 replies; 33+ messages in thread
From: Leo @ 2010-12-16  6:09 UTC (permalink / raw)
  To: Thierry Volpiatto; +Cc: ding, emacs-devel

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

On 2010-12-15 21:11 +0000, Thierry Volpiatto wrote:
> Lars Magne Ingebrigtsen <larsi@gnus.org> writes:
>
>> Francis Moreau <francis.moro@gmail.com> writes:
>>
>>> Since Gnus is using Git as SCM, I'm wondering if some of you have a
>>> magical function that can be used to send patch easily.
>>>
>>> For example, git-format-patch(1) generates a patch with all header
>>> fields set up such as "Subject, From..." and I'd like to create a new
>>> mail automatically from the generated patch using the header fields in
>>> the patch.
>>>
>>> Currently I'm starting a new mail and in the message body I'm inserting
>>> the output from git-format-patch(1) and then I do some clean up
>>> _manually_.
>>>
>>> Using git-send-email(1) with its ton of options is too complex for me
>>> when I need to send only 1 patch.
>>
>> This sounds like a good idea, but I think that it might belong more to
>> vc-mode than to Gnus, so I've Cc'd it to emacs-devel.
>>
>> Does the VC system have a general "make-an-email-from-this-patch"
>> mechanism? 
> DVC have this.
> M-x dvc-export-via-mail

I tweaked gnus-dired to support git-send-email (patches attached). So if
you have gnus-dired loaded you can in dired buffer:

C-c C-m C-i    import patches as DRAFTS
C-c C-m C-s    send patches directly

This is handy when you need to send a large patch set. For one to two
patches I just copy and paste.

Note if you want your patches to have nice threading, check out the
option --thread for git-format-patch.

Cheers,
Leo

-- 
Oracle is the new evil


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-New-functions-to-send-emails-in-mbox-files-from-dire.patch --]
[-- Type: text/x-diff, Size: 3854 bytes --]

From c6222dcbb210dae3998fed3400d4c7de08c1bb82 Mon Sep 17 00:00:00 2001
From: Leo <sdl.web@gmail.com>
Date: Tue, 20 Jul 2010 23:35:13 +0100
Subject: [PATCH 1/3] New functions to send emails in mbox files from dired

New functions gnus-dired-map-over-mbox,
gnus-dired-import-mbox-as-draft and gnus-dired-send-mbox.

Load message.el in gnus-dired-map-over-mbox for
message-unix-mail-delimiter.
---
 lisp/gnus/gnus-dired.el |   63 ++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 62 insertions(+), 1 deletions(-)

diff --git a/lisp/gnus/gnus-dired.el b/lisp/gnus/gnus-dired.el
index 595a9fe..9d8713c 100644
--- a/lisp/gnus/gnus-dired.el
+++ b/lisp/gnus/gnus-dired.el
@@ -40,6 +40,7 @@
 ;;; Code:
 
 (require 'dired)
+(eval-when-compile (require 'cl))
 (autoload 'mml-attach-file "mml")
 (autoload 'mm-default-file-encoding "mm-decode");; Shift this to `mailcap.el'?
 (autoload 'mailcap-extension-to-mime "mailcap")
@@ -64,8 +65,10 @@
   (setq gnus-dired-mode-map (make-sparse-keymap))
 
   (define-key gnus-dired-mode-map "\C-c\C-m\C-a" 'gnus-dired-attach)
+  (define-key gnus-dired-mode-map "\C-c\C-m\C-i" 'gnus-dired-import-mbox-as-draft)
   (define-key gnus-dired-mode-map "\C-c\C-m\C-l" 'gnus-dired-find-file-mailcap)
-  (define-key gnus-dired-mode-map "\C-c\C-m\C-p" 'gnus-dired-print))
+  (define-key gnus-dired-mode-map "\C-c\C-m\C-p" 'gnus-dired-print)
+  (define-key gnus-dired-mode-map "\C-c\C-m\C-s" 'gnus-dired-send-mbox))
 
 ;; FIXME: Make it customizable, change the default to `mail-user-agent' when
 ;; this file is renamed (e.g. to `dired-mime.el').
@@ -185,6 +188,64 @@ filenames."
 	(setq files-to-attach (cdr files-to-attach)))
       (message "Attached file(s) %s" files-str))))
 
+(defvar message-unix-mail-delimiter)	; quiet compiler
+(autoload 'gnus-alive-p "gnus-util")
+
+(declare-function nndraft-request-associate-buffer "nndraft")
+(declare-function gnus-agent-queue-setup "gnus-agent")
+(declare-function message-fetch-field "message")
+(declare-function message-add-header "message")
+(declare-function message-send "message")
+(declare-function message-narrow-to-headers-or-head "message")
+
+(defun gnus-dired-map-over-mbox (function mbox-files)
+  "Call FUNCTION for each email in MBOX-FILES."
+  (require 'message)
+  (let (beg end email)
+    (dolist (m mbox-files)
+      (with-temp-buffer
+	(insert-file-contents m)
+	(while (re-search-forward message-unix-mail-delimiter nil t)
+	  (replace-match "")
+	  (setq beg (point))
+	  (if (re-search-forward message-unix-mail-delimiter nil t)
+	      (setq end (goto-char (match-beginning 0)))
+	    (setq end (point-max)))
+	  (setq email (buffer-substring beg end))
+	  (delete-region beg end)
+	  (with-temp-buffer
+	    (insert email)
+	    (goto-char (point-min))
+	    (re-search-forward "^$")
+	    (insert mail-header-separator)
+	    (funcall function)))))))
+
+(defun gnus-dired-import-mbox-as-draft (&rest mbox-files)
+  "Import emails in MBOX-FILES into the draft group."
+  (interactive (dired-get-marked-files))
+  (assert (gnus-alive-p) nil "Gnus is not running")
+  (gnus-agent-queue-setup "drafts")
+  (gnus-dired-map-over-mbox
+   (lambda ()
+     (nndraft-request-associate-buffer "drafts")
+     (save-buffer 0))
+   mbox-files))
+
+(defun gnus-dired-send-mbox (&rest mbox-files)
+  "Send all emails in MBOX-FILES."
+  (interactive (dired-get-marked-files))
+  (let (to-address)
+    (gnus-dired-map-over-mbox
+     (lambda ()
+       (message-mode)
+       (message-narrow-to-headers-or-head)
+       (unless (message-fetch-field "to")
+	 (unless to-address
+	   (setq to-address (read-string "To address: ")))
+	 (message-add-header (format "To: %s" to-address)))
+       (message-send))
+     mbox-files)))
+
 (autoload 'mailcap-parse-mailcaps "mailcap" "" t)
 
 (defun gnus-dired-find-file-mailcap (&optional file-name arg)
-- 
1.7.3


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0002-Keep-dates-for-imported-drafts.patch --]
[-- Type: text/x-diff, Size: 2709 bytes --]

From 0392e38ad1e38461c9d275054af742c0fcc647de Mon Sep 17 00:00:00 2001
From: Leo <sdl.web@gmail.com>
Date: Tue, 20 Jul 2010 08:03:21 +0100
Subject: [PATCH 2/3] Keep dates for imported drafts

Add a meta header field X-Draft-Keep-Date for drafts imported from
mbox using gnus-dired.el. The header field Date can contain important
information for example 'git format-patch' uses it for commit date. We
don't want draft editing to overwrite it.
---
 lisp/gnus/gnus-dired.el |   18 +++++++++++++-----
 lisp/gnus/gnus-draft.el |    3 ++-
 lisp/gnus/message.el    |    2 +-
 3 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/lisp/gnus/gnus-dired.el b/lisp/gnus/gnus-dired.el
index 9d8713c..cf2d177 100644
--- a/lisp/gnus/gnus-dired.el
+++ b/lisp/gnus/gnus-dired.el
@@ -225,11 +225,19 @@ filenames."
   (interactive (dired-get-marked-files))
   (assert (gnus-alive-p) nil "Gnus is not running")
   (gnus-agent-queue-setup "drafts")
-  (gnus-dired-map-over-mbox
-   (lambda ()
-     (nndraft-request-associate-buffer "drafts")
-     (save-buffer 0))
-   mbox-files))
+  (let (to-address)
+    (gnus-dired-map-over-mbox
+     (lambda ()
+       (message-mode)
+       (message-narrow-to-headers-or-head)
+       (message-add-header "X-Draft-Keep-Date: Yes")
+       (nndraft-request-associate-buffer "drafts")
+       (unless (message-fetch-field "to")
+	 (unless to-address
+	   (setq to-address (read-string "To address: ")))
+	 (message-add-header (format "To: %s" to-address)))
+       (save-buffer 0))
+     mbox-files)))
 
 (defun gnus-dired-send-mbox (&rest mbox-files)
   "Send all emails in MBOX-FILES."
diff --git a/lisp/gnus/gnus-draft.el b/lisp/gnus/gnus-draft.el
index 1e6b7ee..d9aa2f2 100644
--- a/lisp/gnus/gnus-draft.el
+++ b/lisp/gnus/gnus-draft.el
@@ -102,7 +102,8 @@
     (save-excursion
       (save-restriction
 	(message-narrow-to-headers)
-	(message-remove-header "date")))
+	(unless (message-fetch-field "x-draft-keep-date")
+	  (message-remove-header "date"))))
     (let ((message-draft-headers
 	   (delq 'Date (copy-sequence message-draft-headers))))
       (save-buffer))
diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el
index 214ac0b..686f21b 100644
--- a/lisp/gnus/message.el
+++ b/lisp/gnus/message.el
@@ -269,7 +269,7 @@ included.  Organization and User-Agent are optional."
 		 regexp))
 
 (defcustom message-ignored-mail-headers
-  "^[GF]cc:\\|^Resent-Fcc:\\|^Xref:\\|^X-Draft-From:\\|^X-Gnus-Agent-Meta-Information:"
+  "^[GF]cc:\\|^Resent-Fcc:\\|^Xref:\\|^X-Draft-From:\\|^X-Draft-Keep-Date:\\|^X-Gnus-Agent-Meta-Information:"
   "*Regexp of headers to be removed unconditionally before mailing."
   :group 'message-mail
   :group 'message-headers
-- 
1.7.3


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: 0003-Read-emall-addresses-with-completion.patch --]
[-- Type: text/x-diff, Size: 3084 bytes --]

From 5cc4a9bdf491d9ef1ee4666467481bd106767b31 Mon Sep 17 00:00:00 2001
From: Leo <sdl.web@gmail.com>
Date: Fri, 30 Jul 2010 14:31:49 +0100
Subject: [PATCH 3/3] Read emall addresses with completion

New function gnus-dired-read-email that uses bbdb-complete-name if
available for email completion.

Support adding Cc addresses.
---
 lisp/gnus/gnus-dired.el |   32 ++++++++++++++++++++++++++++----
 1 files changed, 28 insertions(+), 4 deletions(-)

diff --git a/lisp/gnus/gnus-dired.el b/lisp/gnus/gnus-dired.el
index cf2d177..9abb2e7 100644
--- a/lisp/gnus/gnus-dired.el
+++ b/lisp/gnus/gnus-dired.el
@@ -198,6 +198,14 @@ filenames."
 (declare-function message-send "message")
 (declare-function message-narrow-to-headers-or-head "message")
 
+(defvar gnus-dired-read-email-map (make-sparse-keymap)
+  "Minibuffer keymap for `gnus-dired-read-email'.")
+(set-keymap-parent gnus-dired-read-email-map minibuffer-local-map)
+(when (fboundp 'bbdb-complete-name)
+  (define-key gnus-dired-read-email-map [tab] 'bbdb-complete-name))
+(defsubst gnus-dired-read-email (prompt)
+  (read-from-minibuffer prompt nil gnus-dired-read-email-map))
+
 (defun gnus-dired-map-over-mbox (function mbox-files)
   "Call FUNCTION for each email in MBOX-FILES."
   (require 'message)
@@ -225,7 +233,7 @@ filenames."
   (interactive (dired-get-marked-files))
   (assert (gnus-alive-p) nil "Gnus is not running")
   (gnus-agent-queue-setup "drafts")
-  (let (to-address)
+  (let (to-address cc-address)
     (gnus-dired-map-over-mbox
      (lambda ()
        (message-mode)
@@ -234,23 +242,39 @@ filenames."
        (nndraft-request-associate-buffer "drafts")
        (unless (message-fetch-field "to")
 	 (unless to-address
-	   (setq to-address (read-string "To address: ")))
+	   (setq to-address (gnus-dired-read-email "To: ")))
 	 (message-add-header (format "To: %s" to-address)))
+       (unless (or (message-fetch-field "cc") (eq cc-address 'no))
+	 (unless cc-address
+	   (setq cc-address
+		 (if (yes-or-no-p "Add Cc addresses? ")
+		     (gnus-dired-read-email "Cc: ")
+		   'no)))
+	 (unless (eq cc-address 'no)
+	   (message-add-header (format "Cc: %s" cc-address))))
        (save-buffer 0))
      mbox-files)))
 
 (defun gnus-dired-send-mbox (&rest mbox-files)
   "Send all emails in MBOX-FILES."
   (interactive (dired-get-marked-files))
-  (let (to-address)
+  (let (to-address cc-address)
     (gnus-dired-map-over-mbox
      (lambda ()
        (message-mode)
        (message-narrow-to-headers-or-head)
        (unless (message-fetch-field "to")
 	 (unless to-address
-	   (setq to-address (read-string "To address: ")))
+	   (setq to-address (gnus-dired-read-email "To address: ")))
 	 (message-add-header (format "To: %s" to-address)))
+       (unless (or (message-fetch-field "cc") (eq cc-address 'no))
+	 (unless cc-address
+	   (setq cc-address
+		 (if (yes-or-no-p "Add Cc addresses? ")
+		     (gnus-dired-read-email "Cc: ")
+		   'no)))
+	 (unless (eq cc-address 'no)
+	   (message-add-header (format "Cc: %s" cc-address))))
        (message-send))
      mbox-files)))
 
-- 
1.7.3


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

* Re: Sending patch with Gnus
  2010-12-16  6:09     ` Leo
@ 2010-12-16 10:01       ` Francis Moreau
  2010-12-16 13:07         ` Leo
  2010-12-17  0:53         ` Rupert Swarbrick
  2010-12-16 15:53       ` Lars Magne Ingebrigtsen
  1 sibling, 2 replies; 33+ messages in thread
From: Francis Moreau @ 2010-12-16 10:01 UTC (permalink / raw)
  To: Leo; +Cc: emacs-devel, ding, Thierry Volpiatto

Leo <sdl.web@gmail.com> writes:

[...]

>
> I tweaked gnus-dired to support git-send-email (patches attached).

Thanks for doing that.

Unfortunately your patches don't seem to be based on Gnus repository but
rather to emacs one that I don't have. So I can't test them.

> So if you have gnus-dired loaded you can in dired buffer:
>
> C-c C-m C-i    import patches as DRAFTS
> C-c C-m C-s    send patches directly
>
> This is handy when you need to send a large patch set. For one to two
> patches I just copy and paste.

Funny because I feel the opposite, I use git-send-email(1) when dealing
with a large patch set since the overhead to set it up is ok in this
case. But for one patch, I do it by hands as you do, but I would prefer
to not have editing the email manually.

But I think, your approach can still be usefull since it imports patches
as _drafts_. I don't think it's a good idea to modify the patch itself,
but modifying or adding some header fields like To, Cc, Bcc... should be
ok. And I like to check what the patch looks like before sending it.

One other idea is to generate one or several drafts from a buffer which
contains one or several mbox files. Let's call the magic command: M-x
create-draft-from-buffer (yeah the name sucks).

With such command, one could do in an emacs session:

  M-! git format-patch --stdout HEAD~4
  C-x o
  M-x create-draft-from-buffer

So you're putting in the *Shell Command Output* buffer the mbox files,
and then switching to that buffer and generating the drafts. The main
advantages I see is that you use a shell command to generate the buffer
containing the patches.

BTW, if you needn't to modify the patches and only want to see them
before sending them then you can currently do this:

  M-! git format-patch --stdout HEAD~4 >/tmp/patch-set.mbox
  C-x b *Group*
  G f /tmp/patch-set.mbox

This will create a nndoc group which contains all your patches as
articles.

Then you can mark all of them and resend them with 'S D r'. But you
can't add Cc or Gcc header fields with this method.

-- 
Francis



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

* Re: Sending patch with Gnus
  2010-12-16 10:01       ` Francis Moreau
@ 2010-12-16 13:07         ` Leo
  2010-12-16 13:12           ` Leo
  2010-12-16 20:20           ` Francis Moreau
  2010-12-17  0:53         ` Rupert Swarbrick
  1 sibling, 2 replies; 33+ messages in thread
From: Leo @ 2010-12-16 13:07 UTC (permalink / raw)
  To: Francis Moreau; +Cc: emacs-devel, ding, Thierry Volpiatto

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

On 2010-12-16 10:01 +0000, Francis Moreau wrote:
> Leo <sdl.web@gmail.com> writes:
>
> [...]
>
>>
>> I tweaked gnus-dired to support git-send-email (patches attached).
>
> Thanks for doing that.
>
> Unfortunately your patches don't seem to be based on Gnus repository but
> rather to emacs one that I don't have. So I can't test them.

OK, I put it in a separate file as attached.

>> So if you have gnus-dired loaded you can in dired buffer:
>>
>> C-c C-m C-i    import patches as DRAFTS
>> C-c C-m C-s    send patches directly
>>
>> This is handy when you need to send a large patch set. For one to two
>> patches I just copy and paste.
>
> Funny because I feel the opposite, I use git-send-email(1) when dealing
> with a large patch set since the overhead to set it up is ok in this
> case. But for one patch, I do it by hands as you do, but I would prefer
> to not have editing the email manually.
>
> But I think, your approach can still be usefull since it imports patches
> as _drafts_. I don't think it's a good idea to modify the patch itself,
> but modifying or adding some header fields like To, Cc, Bcc... should be
> ok. And I like to check what the patch looks like before sending it.
>
> One other idea is to generate one or several drafts from a buffer which
> contains one or several mbox files. Let's call the magic command: M-x
> create-draft-from-buffer (yeah the name sucks).
>
> With such command, one could do in an emacs session:
>
>   M-! git format-patch --stdout HEAD~4
>   C-x o
>   M-x create-draft-from-buffer
>
> So you're putting in the *Shell Command Output* buffer the mbox files,
> and then switching to that buffer and generating the drafts. The main
> advantages I see is that you use a shell command to generate the buffer
> containing the patches.
>
> BTW, if you needn't to modify the patches and only want to see them
> before sending them then you can currently do this:
>
>   M-! git format-patch --stdout HEAD~4 >/tmp/patch-set.mbox
>   C-x b *Group*
>   G f /tmp/patch-set.mbox
>
> This will create a nndoc group which contains all your patches as
> articles.
>
> Then you can mark all of them and resend them with 'S D r'. But you
> can't add Cc or Gcc header fields with this method.

Now we have four commands (not bound to any keys for the moment)

  gitmail-import-mbox-as-draft
  gitmail-send-mbox
  gitmail-send-mbox-buffer
  gitmail-import-mbox-buffer

Editing drafts in Gnus resets the date so you need this small patch (or
is there a butter way to handle this?):

diff --git a/lisp/gnus/gnus-draft.el b/lisp/gnus/gnus-draft.el
index 1e6b7ee..d9aa2f2 100644
--- a/lisp/gnus/gnus-draft.el
+++ b/lisp/gnus/gnus-draft.el
@@ -102,7 +102,8 @@
     (save-excursion
       (save-restriction
 	(message-narrow-to-headers)
-	(message-remove-header "date")))
+	(unless (message-fetch-field "x-draft-keep-date")
+	  (message-remove-header "date"))))
     (let ((message-draft-headers
 	   (delq 'Date (copy-sequence message-draft-headers))))
       (save-buffer))
	Modified lisp/gnus/message.el
diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el
index 214ac0b..686f21b 100644
--- a/lisp/gnus/message.el
+++ b/lisp/gnus/message.el
@@ -269,7 +269,7 @@ included.  Organization and User-Agent are optional."
 		 regexp))
 
 (defcustom message-ignored-mail-headers
-  "^[GF]cc:\\|^Resent-Fcc:\\|^Xref:\\|^X-Draft-From:\\|^X-Gnus-Agent-Meta-Information:"
+  "^[GF]cc:\\|^Resent-Fcc:\\|^Xref:\\|^X-Draft-From:\\|^X-Draft-Keep-Date:\\|^X-Gnus-Agent-Meta-Information:"
   "*Regexp of headers to be removed unconditionally before mailing."
   :group 'message-mail
   :group 'message-headers

-- 
Oracle is the new evil

[-- Attachment #2: gitmail.el --]
[-- Type: application/emacs-lisp, Size: 5793 bytes --]

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

* Re: Sending patch with Gnus
  2010-12-16 13:07         ` Leo
@ 2010-12-16 13:12           ` Leo
  2010-12-16 20:20           ` Francis Moreau
  1 sibling, 0 replies; 33+ messages in thread
From: Leo @ 2010-12-16 13:12 UTC (permalink / raw)
  To: emacs-devel; +Cc: ding

On 2010-12-16 13:07 +0000, Leo wrote:
>   (interactive (if (derived-mode-p 'dired)

Sorry for the typo.

diff --git a/gitmail.el b/gitmail.el
index 71aadee..60551df 100644
--- a/gitmail.el
+++ b/gitmail.el
@@ -120,7 +120,7 @@
 ;;;###autoload
 (defun gitmail-import-mbox-as-draft (&rest mbox-files)
   "Import emails in MBOX-FILES into the draft group."
-  (interactive (if (derived-mode-p 'dired)
+  (interactive (if (derived-mode-p 'dired-mode)
                    (dired-get-marked-files)
                  (file-expand-wildcards (read-file-name "Find mbox file: ") t)))
   (assert (gnus-alive-p) nil "Gnus is not running")
@@ -131,7 +131,7 @@
 ;;;###autoload
 (defun gitmail-send-mbox (&rest mbox-files)
   "Send all emails in MBOX-FILES."
-  (interactive (if (derived-mode-p 'dired)
+  (interactive (if (derived-mode-p 'dired-mode)
                    (dired-get-marked-files)
                  (file-expand-wildcards (read-file-name "Find mbox file: ") t)))
   (let (to-address cc-address)

-- 
Oracle is the new evil




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

* Re: Sending patch with Gnus
  2010-12-16  6:09     ` Leo
  2010-12-16 10:01       ` Francis Moreau
@ 2010-12-16 15:53       ` Lars Magne Ingebrigtsen
  2010-12-16 17:16         ` Leo
  1 sibling, 1 reply; 33+ messages in thread
From: Lars Magne Ingebrigtsen @ 2010-12-16 15:53 UTC (permalink / raw)
  To: ding; +Cc: emacs-devel

Leo <sdl.web@gmail.com> writes:

> I tweaked gnus-dired to support git-send-email (patches attached). So if
> you have gnus-dired loaded you can in dired buffer:
>
> C-c C-m C-i    import patches as DRAFTS
> C-c C-m C-s    send patches directly

Is this for git only, or a general VC mechanism?

-- 
(domestic pets only, the antidote for overdose, milk.)
  larsi@gnus.org * Lars Magne Ingebrigtsen




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

* Re: Sending patch with Gnus
  2010-12-16 15:53       ` Lars Magne Ingebrigtsen
@ 2010-12-16 17:16         ` Leo
  2010-12-16 17:19           ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 33+ messages in thread
From: Leo @ 2010-12-16 17:16 UTC (permalink / raw)
  To: ding; +Cc: emacs-devel

On 2010-12-16 15:53 +0000, Lars Magne Ingebrigtsen wrote:
> Leo <sdl.web@gmail.com> writes:
>
>> I tweaked gnus-dired to support git-send-email (patches attached). So if
>> you have gnus-dired loaded you can in dired buffer:
>>
>> C-c C-m C-i    import patches as DRAFTS
>> C-c C-m C-s    send patches directly
>
> Is this for git only, or a general VC mechanism?

It imports/sends any mbox files. So not related to any specific VC.

Cheers,
Leo




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

* Re: Sending patch with Gnus
  2010-12-16 17:16         ` Leo
@ 2010-12-16 17:19           ` Lars Magne Ingebrigtsen
  2010-12-17  6:29             ` Štěpán Němec
  2010-12-17 10:01             ` Leo
  0 siblings, 2 replies; 33+ messages in thread
From: Lars Magne Ingebrigtsen @ 2010-12-16 17:19 UTC (permalink / raw)
  To: ding; +Cc: emacs-devel

Leo <sdl.web@gmail.com> writes:

>>> I tweaked gnus-dired to support git-send-email (patches attached). So if
>>> you have gnus-dired loaded you can in dired buffer:
>>>
>>> C-c C-m C-i    import patches as DRAFTS
>>> C-c C-m C-s    send patches directly
>>
>> Is this for git only, or a general VC mechanism?
>
> It imports/sends any mbox files. So not related to any specific VC.

Then the description of these commands is a bit misleading.  :-)

But the use case is that you have an entire mbox of messages, and you
want to send them all?

-- 
(domestic pets only, the antidote for overdose, milk.)
  larsi@gnus.org * Lars Magne Ingebrigtsen




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

* Re: Sending patch with Gnus
  2010-12-16 13:07         ` Leo
  2010-12-16 13:12           ` Leo
@ 2010-12-16 20:20           ` Francis Moreau
  1 sibling, 0 replies; 33+ messages in thread
From: Francis Moreau @ 2010-12-16 20:20 UTC (permalink / raw)
  To: Leo; +Cc: Thierry Volpiatto, ding, emacs-devel

Leo <sdl.web@gmail.com> writes:

> On 2010-12-16 10:01 +0000, Francis Moreau wrote:
>> Leo <sdl.web@gmail.com> writes:
>>
>> [...]
>
>>
>>>
>>> I tweaked gnus-dired to support git-send-email (patches attached).
>>
>> Thanks for doing that.
>>
>> Unfortunately your patches don't seem to be based on Gnus repository but
>> rather to emacs one that I don't have. So I can't test them.
>
> OK, I put it in a separate file as attached.
>
>>> So if you have gnus-dired loaded you can in dired buffer:
>>>
>>> C-c C-m C-i    import patches as DRAFTS
>>> C-c C-m C-s    send patches directly
>>>
>>> This is handy when you need to send a large patch set. For one to two
>>> patches I just copy and paste.
>>
>> Funny because I feel the opposite, I use git-send-email(1) when dealing
>> with a large patch set since the overhead to set it up is ok in this
>> case. But for one patch, I do it by hands as you do, but I would prefer
>> to not have editing the email manually.
>>
>> But I think, your approach can still be usefull since it imports patches
>> as _drafts_. I don't think it's a good idea to modify the patch itself,
>> but modifying or adding some header fields like To, Cc, Bcc... should be
>> ok. And I like to check what the patch looks like before sending it.
>>
>> One other idea is to generate one or several drafts from a buffer which
>> contains one or several mbox files. Let's call the magic command: M-x
>> create-draft-from-buffer (yeah the name sucks).
>>
>> With such command, one could do in an emacs session:
>>
>>   M-! git format-patch --stdout HEAD~4
>>   C-x o
>>   M-x create-draft-from-buffer
>>
>> So you're putting in the *Shell Command Output* buffer the mbox files,
>> and then switching to that buffer and generating the drafts. The main
>> advantages I see is that you use a shell command to generate the buffer
>> containing the patches.
>>
>> BTW, if you needn't to modify the patches and only want to see them
>> before sending them then you can currently do this:
>>
>>   M-! git format-patch --stdout HEAD~4 >/tmp/patch-set.mbox
>>   C-x b *Group*
>>   G f /tmp/patch-set.mbox
>>
>> This will create a nndoc group which contains all your patches as
>> articles.
>>
>> Then you can mark all of them and resend them with 'S D r'. But you
>> can't add Cc or Gcc header fields with this method.
>
> Now we have four commands (not bound to any keys for the moment)
>
>   gitmail-import-mbox-as-draft
>   gitmail-send-mbox
>   gitmail-send-mbox-buffer
>   gitmail-import-mbox-buffer

why making them Git specific like the command names suggest ?

I would actually do: 's/gitmail/gnus/'

>
> Editing drafts in Gnus resets the date so you need this small patch (or
> is there a butter way to handle this?):

I know almost nothing in elisp sorry, so I can't comment your patches.

However I would be interested to know what Gnus developpers think about
these new commands. I don't think that Gnus is currently able to import
a mbox file/buffer and make it a draft(s). Also your gnus-dired stuffs
seem interesting.

-- 
Francis



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

* Re: Sending patch with Gnus
  2010-12-16 10:01       ` Francis Moreau
  2010-12-16 13:07         ` Leo
@ 2010-12-17  0:53         ` Rupert Swarbrick
  2010-12-17  1:03           ` "Purging" nndoc group, was: " Rupert Swarbrick
                             ` (2 more replies)
  1 sibling, 3 replies; 33+ messages in thread
From: Rupert Swarbrick @ 2010-12-17  0:53 UTC (permalink / raw)
  To: ding

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

Francis Moreau <francis.moro@gmail.com> writes:
>
> BTW, if you needn't to modify the patches and only want to see them
> before sending them then you can currently do this:
>
>   M-! git format-patch --stdout HEAD~4 >/tmp/patch-set.mbox
>   C-x b *Group*
>   G f /tmp/patch-set.mbox
>
> This will create a nndoc group which contains all your patches as
> articles.
>
> Then you can mark all of them and resend them with 'S D r'. But you
> can't add Cc or Gcc header fields with this method.

... so I just tried this on another project's mailing list. Problem: the
result isn't threaded.

My 'ideal method' at the moment (inspired by the above) works something
like this

(1) Hack and wrestle with git until you have a history you're willing
    for someone else to laugh at.

(2) git format-patch --cover-letter --stdout master \
                     --to='foo@bar.com' --thread >tmp.mbox

    This creates the mbox as above, but also adds a dummy first email
    (patch 0/n) and says where to send it to (so you don't have to type
    it repeatedly in a bit).

(3) Now open up the mbox file in emacs and edit the first email so it
    has a nice covering letter explaining why you're spamming the
    mailing list.

(4) Now do 'G f tmp.mbox' from the *Group* buffer. If everything looks
    hunky-dory (and threaded!), do the 'S D r' thang.

(5) Climb into your bunker before the flames land.


Notes:

Sadly nndoc doesn't let us just edit the mbox inside gnus, although I
suppose I'm not sure how that would work.

More sadly still (and possibly this is me being stupid?), if you realise
something looks rubbish, the obvious approach of C-k killing the group,
editing the mbox file and then doing G f again doesn't work, because
Gnus cleverly caches the emails it seems (when I changed the number of
emails I was getting the wrong ones!). Is there a way to tell gnus to
completely forget about the group?


Rupert

[-- Attachment #2: Type: application/pgp-signature, Size: 315 bytes --]

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

* "Purging" nndoc group, was: Re: Sending patch with Gnus
  2010-12-17  0:53         ` Rupert Swarbrick
@ 2010-12-17  1:03           ` Rupert Swarbrick
  2010-12-17  7:52           ` Francis Moreau
  2010-12-17 16:30           ` Lars Magne Ingebrigtsen
  2 siblings, 0 replies; 33+ messages in thread
From: Rupert Swarbrick @ 2010-12-17  1:03 UTC (permalink / raw)
  To: ding

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

Rupert Swarbrick <rswarbrick@gmail.com> writes:
> <snip>

> More sadly still (and possibly this is me being stupid?), if you realise
> something looks rubbish, the obvious approach of C-k killing the group,
> editing the mbox file and then doing G f again doesn't work, because
> Gnus cleverly caches the emails it seems (when I changed the number of
> emails I was getting the wrong ones!). Is there a way to tell gnus to
> completely forget about the group?

Without restarting gnus, that is.

Rupert

[-- Attachment #2: Type: application/pgp-signature, Size: 315 bytes --]

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

* Re: Sending patch with Gnus
  2010-12-16 17:19           ` Lars Magne Ingebrigtsen
@ 2010-12-17  6:29             ` Štěpán Němec
  2010-12-17  7:33               ` Francis Moreau
  2010-12-18 20:34               ` Reiner Steib
  2010-12-17 10:01             ` Leo
  1 sibling, 2 replies; 33+ messages in thread
From: Štěpán Němec @ 2010-12-17  6:29 UTC (permalink / raw)
  To: ding, emacs-devel

Lars Magne Ingebrigtsen <larsi@gnus.org> writes:

> Leo <sdl.web@gmail.com> writes:
>
>>>> I tweaked gnus-dired to support git-send-email (patches attached). So if
>>>> you have gnus-dired loaded you can in dired buffer:
>>>>
>>>> C-c C-m C-i    import patches as DRAFTS
>>>> C-c C-m C-s    send patches directly
>>>
>>> Is this for git only, or a general VC mechanism?
>>
>> It imports/sends any mbox files. So not related to any specific VC.
>
> Then the description of these commands is a bit misleading.  :-)
>
> But the use case is that you have an entire mbox of messages, and you
> want to send them all?

Does Gnus have anything akin to Mutt's -H option?

  -H draft
   Specify a draft file which contains header and body to use to send a message.

I.e., you do `mutt -H <mboxfile>' and Mutt opens the file, you can edit
it the same as when composing a new message and then send it. Useful
e.g. when sending single patches produced by `git format-patch'.

  Štěpán



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

* Re: Sending patch with Gnus
  2010-12-17  6:29             ` Štěpán Němec
@ 2010-12-17  7:33               ` Francis Moreau
  2010-12-18 20:34               ` Reiner Steib
  1 sibling, 0 replies; 33+ messages in thread
From: Francis Moreau @ 2010-12-17  7:33 UTC (permalink / raw)
  To: Štěpán Němec; +Cc: ding, emacs-devel

Štěpán Němec <stepnem@gmail.com> writes:

> Lars Magne Ingebrigtsen <larsi@gnus.org> writes:
>
>> Leo <sdl.web@gmail.com> writes:
>>
>>>>> I tweaked gnus-dired to support git-send-email (patches attached). So if
>>>>> you have gnus-dired loaded you can in dired buffer:
>>>>>
>>>>> C-c C-m C-i    import patches as DRAFTS
>>>>> C-c C-m C-s    send patches directly
>>>>
>>>> Is this for git only, or a general VC mechanism?
>>>
>>> It imports/sends any mbox files. So not related to any specific VC.
>>
>> Then the description of these commands is a bit misleading.  :-)
>>
>> But the use case is that you have an entire mbox of messages, and you
>> want to send them all?
>
> Does Gnus have anything akin to Mutt's -H option?
>
>   -H draft
>    Specify a draft file which contains header and body to use to send a message.
>

I don't think so and that's mostly the whole point of the discussion.

>
> I.e., you do `mutt -H <mboxfile>' and Mutt opens the file, you can
>edit
> it the same as when composing a new message and then send it. Useful
> e.g. when sending single patches produced by `git format-patch'.

I tried it and that's indeed what I'd like to have with Gnus.

Except that Gnus could do better I guess, since I believe it could
handle a mbox file embedding several patches... Perhaps it would be
interesting to create a /draft/ group like it's possible to create a
nndoc group.

Also it would be nice if we could create a draft (group) from a buffer
(not only from a file), that would avoid to use a temporary mbox file
which I find a bit awkward. For example with mutt:

      $ git format-patch --stdout HEAD~1 | mutt -H

Thanks
-- 
Francis



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

* Re: Sending patch with Gnus
  2010-12-17  0:53         ` Rupert Swarbrick
  2010-12-17  1:03           ` "Purging" nndoc group, was: " Rupert Swarbrick
@ 2010-12-17  7:52           ` Francis Moreau
  2010-12-17  8:02             ` Rupert Swarbrick
  2010-12-17 16:30           ` Lars Magne Ingebrigtsen
  2 siblings, 1 reply; 33+ messages in thread
From: Francis Moreau @ 2010-12-17  7:52 UTC (permalink / raw)
  To: Rupert Swarbrick; +Cc: ding

Rupert Swarbrick <rswarbrick@gmail.com> writes:

> Francis Moreau <francis.moro@gmail.com> writes:
>>
>> BTW, if you needn't to modify the patches and only want to see them
>> before sending them then you can currently do this:
>
>>
>>   M-! git format-patch --stdout HEAD~4 >/tmp/patch-set.mbox
>>   C-x b *Group*
>>   G f /tmp/patch-set.mbox
>>
>> This will create a nndoc group which contains all your patches as
>> articles.
>>
>> Then you can mark all of them and resend them with 'S D r'. But you
>> can't add Cc or Gcc header fields with this method.
>
> ... so I just tried this on another project's mailing list. Problem: the
> result isn't threaded.

Sure I didn't ask for to git.

>
> My 'ideal method' at the moment (inspired by the above) works something
> like this
>

[...]

>
> Notes:
>
> Sadly nndoc doesn't let us just edit the mbox inside gnus, although I
> suppose I'm not sure how that would work.
>

Again that's basically the whole point of the discussion.

>
> More sadly still (and possibly this is me being stupid?), if you
> realise something looks rubbish, the obvious approach of C-k killing
> the group, editing the mbox file and then doing G f again doesn't
> work, because Gnus cleverly caches the emails it seems (when I changed
> the number of emails I was getting the wrong ones!).

I don't think that's correct. If something need to be corrected, you
shouldn't modify the mbox file but instead fix your patchset inside your
repo and then regenerate the mbox file.

-- 
Francis



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

* Re: Sending patch with Gnus
  2010-12-17  7:52           ` Francis Moreau
@ 2010-12-17  8:02             ` Rupert Swarbrick
  2010-12-17  8:14               ` Francis Moreau
  0 siblings, 1 reply; 33+ messages in thread
From: Rupert Swarbrick @ 2010-12-17  8:02 UTC (permalink / raw)
  To: ding

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

Francis Moreau <francis.moro@gmail.com> writes:
>> More sadly still (and possibly this is me being stupid?), if you
>> realise something looks rubbish, the obvious approach of C-k killing
>> the group, editing the mbox file and then doing G f again doesn't
>> work, because Gnus cleverly caches the emails it seems (when I changed
>> the number of emails I was getting the wrong ones!).
>
> I don't think that's correct. If something need to be corrected, you
> shouldn't modify the mbox file but instead fix your patchset inside your
> repo and then regenerate the mbox file.

Sorry, I wasn't clear. I meant that the text in the cover letter bit
(patch 0/n) might have mistakes that one needs to fix which, unless I've
misunderstood something, you have to do after calling "git
format-patch".

Rupert

[-- Attachment #2: Type: application/pgp-signature, Size: 315 bytes --]

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

* Re: Sending patch with Gnus
  2010-12-17  8:02             ` Rupert Swarbrick
@ 2010-12-17  8:14               ` Francis Moreau
  0 siblings, 0 replies; 33+ messages in thread
From: Francis Moreau @ 2010-12-17  8:14 UTC (permalink / raw)
  To: Rupert Swarbrick; +Cc: ding

Rupert Swarbrick <rswarbrick@gmail.com> writes:

> Francis Moreau <francis.moro@gmail.com> writes:
>>> More sadly still (and possibly this is me being stupid?), if you
>>> realise something looks rubbish, the obvious approach of C-k killing
>>> the group, editing the mbox file and then doing G f again doesn't
>>> work, because Gnus cleverly caches the emails it seems (when I changed
>>> the number of emails I was getting the wrong ones!).
>>
>> I don't think that's correct. If something need to be corrected, you
>> shouldn't modify the mbox file but instead fix your patchset inside your
>> repo and then regenerate the mbox file.
>
> Sorry, I wasn't clear. I meant that the text in the cover letter bit
> (patch 0/n) might have mistakes that one needs to fix which, unless I've
> misunderstood something, you have to do after calling "git
> format-patch".

Ok, so I misunderstood and we agree.

-- 
Francis



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

* Re: Sending patch with Gnus
  2010-12-16 17:19           ` Lars Magne Ingebrigtsen
  2010-12-17  6:29             ` Štěpán Němec
@ 2010-12-17 10:01             ` Leo
  1 sibling, 0 replies; 33+ messages in thread
From: Leo @ 2010-12-17 10:01 UTC (permalink / raw)
  To: ding

On 2010-12-16 17:19 +0000, Lars Magne Ingebrigtsen wrote:
> Then the description of these commands is a bit misleading.  :-)
>
> But the use case is that you have an entire mbox of messages, and you
> want to send them all?

Yeah, I know the name is really bad. But since all good names are taken,
I made it worse by calling it gitmail.el though in fact it only assumes
mbox.

I think it is worthwhile to make it easy to import mbox to a group
similar to DRAFTS or to send them directly. I am surprised that some
people were doing it¹ by hand (i.e. copy paste) when sending patches in
mbox files.

Leo

Footnotes: 
¹  http://thread.gmane.org/gmane.comp.version-control.git.magit/270
-- 
Oracle is the new evil



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

* Re: Sending patch with Gnus
  2010-12-17  0:53         ` Rupert Swarbrick
  2010-12-17  1:03           ` "Purging" nndoc group, was: " Rupert Swarbrick
  2010-12-17  7:52           ` Francis Moreau
@ 2010-12-17 16:30           ` Lars Magne Ingebrigtsen
  2010-12-17 19:54             ` Francis Moreau
  2 siblings, 1 reply; 33+ messages in thread
From: Lars Magne Ingebrigtsen @ 2010-12-17 16:30 UTC (permalink / raw)
  To: ding

Rupert Swarbrick <rswarbrick@gmail.com> writes:

> (3) Now open up the mbox file in emacs and edit the first email so it
>     has a nice covering letter explaining why you're spamming the
>     mailing list.
>
> (4) Now do 'G f tmp.mbox' from the *Group* buffer. If everything looks
>     hunky-dory (and threaded!), do the 'S D r' thang.

Oh, OK, now I think I understand what all y'all are saying.  So you have
a mbox file (possibly created by git) containing many messages.  You
want to look at all the messages, and possibly edit them, and then send
off all the messages separately?

That sounds quite useful, yes.  But couldn't this be implemented as an
ephemeral nnfolder group?  That would allow you to edit any or all of
the articles (for instance, you'd want a command to add a References
header to all messages following the "cover letter", and you may want to
fiddle around with the patch series itself (perhaps `B DEL' one patch in
the series).

And then you'd just need a command to send all the messages in the
summary buffer, and you'd be done.  :-)

So this wouldn't really be a gnus-dired thing, but basically just a
summary minor mode with additional commands for editing/mangling the
nnfolder. 

-- 
(domestic pets only, the antidote for overdose, milk.)
  larsi@gnus.org * Lars Magne Ingebrigtsen




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

* Re: Sending patch with Gnus
  2010-12-17 16:30           ` Lars Magne Ingebrigtsen
@ 2010-12-17 19:54             ` Francis Moreau
  2010-12-17 19:57               ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 33+ messages in thread
From: Francis Moreau @ 2010-12-17 19:54 UTC (permalink / raw)
  To: ding

Lars Magne Ingebrigtsen <larsi@gnus.org> writes:

> Rupert Swarbrick <rswarbrick@gmail.com> writes:
>
>> (3) Now open up the mbox file in emacs and edit the first email so it
>>     has a nice covering letter explaining why you're spamming the
>>     mailing list.
>>
>> (4) Now do 'G f tmp.mbox' from the *Group* buffer. If everything looks
>>     hunky-dory (and threaded!), do the 'S D r' thang.
>
> Oh, OK, now I think I understand what all y'all are saying.  So you have
> a mbox file (possibly created by git) containing many messages.

or possibly a mbox buffer...

> You want to look at all the messages, and possibly edit them, and then
> send off all the messages separately?

That's it.

> That sounds quite useful, yes.

Cool, but a volunteer is needed to make it really usefull ;)

> But couldn't this be implemented as an ephemeral nnfolder group?

I don't know.

As I said in another post, I was thinking about nndraft group mainly
because you can edit a message, and send all messages in the group,
etc...

> That would allow you to edit any or all of the articles (for instance,
> you'd want a command to add a References header to all messages
> following the "cover letter", and you may want to fiddle around with
> the patch series itself (perhaps `B DEL' one patch in the series).

`D e' in nndraft group.

> And then you'd just need a command to send all the messages in the
> summary buffer, and you'd be done.  :-)

`D S' in nndraft group.

Thanks
-- 
Francis



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

* Re: Sending patch with Gnus
  2010-12-17 19:54             ` Francis Moreau
@ 2010-12-17 19:57               ` Lars Magne Ingebrigtsen
  2010-12-17 20:04                 ` Francis Moreau
  0 siblings, 1 reply; 33+ messages in thread
From: Lars Magne Ingebrigtsen @ 2010-12-17 19:57 UTC (permalink / raw)
  To: ding

Francis Moreau <francis.moro@gmail.com> writes:

> As I said in another post, I was thinking about nndraft group mainly
> because you can edit a message, and send all messages in the group,
> etc...

nndraft is based on nnml, so it's a one-message-per-file backend.  Which
doesn't fit the scenario much.

-- 
(domestic pets only, the antidote for overdose, milk.)
  larsi@gnus.org * Lars Magne Ingebrigtsen




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

* Re: Sending patch with Gnus
  2010-12-17 19:57               ` Lars Magne Ingebrigtsen
@ 2010-12-17 20:04                 ` Francis Moreau
  2010-12-17 20:14                   ` Štěpán Němec
  0 siblings, 1 reply; 33+ messages in thread
From: Francis Moreau @ 2010-12-17 20:04 UTC (permalink / raw)
  To: ding

Lars Magne Ingebrigtsen <larsi@gnus.org> writes:

> Francis Moreau <francis.moro@gmail.com> writes:
>
>> As I said in another post, I was thinking about nndraft group mainly
>> because you can edit a message, and send all messages in the group,
>> etc...
>
> nndraft is based on nnml, so it's a one-message-per-file backend.  Which
> doesn't fit the scenario much.

Ok, I was more thinking about the nndraft semantic.

-- 
Francis



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

* Re: Sending patch with Gnus
  2010-12-17 20:04                 ` Francis Moreau
@ 2010-12-17 20:14                   ` Štěpán Němec
  0 siblings, 0 replies; 33+ messages in thread
From: Štěpán Němec @ 2010-12-17 20:14 UTC (permalink / raw)
  To: ding

Francis Moreau <francis.moro@gmail.com> writes:

> Lars Magne Ingebrigtsen <larsi@gnus.org> writes:
>
>> Francis Moreau <francis.moro@gmail.com> writes:
>>
>>> As I said in another post, I was thinking about nndraft group mainly
>>> because you can edit a message, and send all messages in the group,
>>> etc...
>>
>> nndraft is based on nnml, so it's a one-message-per-file backend.  Which
>> doesn't fit the scenario much.
>
> Ok, I was more thinking about the nndraft semantic.

FWIW, one-message-per-file is precisely what `git format-patch' normally
produces when exporting a patch (series).

  Štěpán



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

* Re: Sending patch with Gnus
  2010-12-17  6:29             ` Štěpán Němec
  2010-12-17  7:33               ` Francis Moreau
@ 2010-12-18 20:34               ` Reiner Steib
  2010-12-19  6:50                 ` Štěpán Němec
  1 sibling, 1 reply; 33+ messages in thread
From: Reiner Steib @ 2010-12-18 20:34 UTC (permalink / raw)
  To: Štěpán Němec; +Cc: ding, emacs-devel

On Fri, Dec 17 2010, Štěpán Němec wrote:

> Does Gnus have anything akin to Mutt's -H option?
>
>   -H draft
>    Specify a draft file which contains header and body to use to send a message.
>
> I.e., you do `mutt -H <mboxfile>' and Mutt opens the file, you can edit
> it the same as when composing a new message and then send it.

I guess that
  C-x C-f /path/to/draft/file RET
  M-x message-mode RET
should do this, basically.

You'd need to replace the first empty line with
`mail-header-separator'.  For sending a multi-message buffer, there is
`message-send-form-letter'.

Bye, Reiner.
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo---  |  PGP key available  |  http://rsteib.home.pages.de/



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

* Re: Sending patch with Gnus
  2010-12-18 20:34               ` Reiner Steib
@ 2010-12-19  6:50                 ` Štěpán Němec
  0 siblings, 0 replies; 33+ messages in thread
From: Štěpán Němec @ 2010-12-19  6:50 UTC (permalink / raw)
  To: ding; +Cc: emacs-devel

Reiner Steib <reinersteib+gmane@imap.cc> writes:

> On Fri, Dec 17 2010, Štěpán Němec wrote:
>
>> Does Gnus have anything akin to Mutt's -H option?
>>
>>   -H draft
>>    Specify a draft file which contains header and body to use to send a message.
>>
>> I.e., you do `mutt -H <mboxfile>' and Mutt opens the file, you can edit
>> it the same as when composing a new message and then send it.
>
> I guess that
>   C-x C-f /path/to/draft/file RET
>   M-x message-mode RET
> should do this, basically.
>
> You'd need to replace the first empty line with
> `mail-header-separator'.  For sending a multi-message buffer, there is
> `message-send-form-letter'.

Yeah, that's probably as close as it gets, thanks. Still, given Gnus'
overwhelming feature set, it would make sense IMO to have something
ready-made (i.e. not requiring you to munge the message by hand, like
inserting the separators etc.).

  Štěpán



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

end of thread, other threads:[~2010-12-19  6:50 UTC | newest]

Thread overview: 33+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-15 16:05 Sending patch with Gnus Francis Moreau
2010-12-15 19:21 ` Lars Magne Ingebrigtsen
2010-12-15 21:11   ` Thierry Volpiatto
2010-12-15 21:50     ` Francis Moreau
2010-12-15 21:54       ` Lars Magne Ingebrigtsen
2010-12-15 22:13         ` Francis Moreau
2010-12-16  6:09     ` Leo
2010-12-16 10:01       ` Francis Moreau
2010-12-16 13:07         ` Leo
2010-12-16 13:12           ` Leo
2010-12-16 20:20           ` Francis Moreau
2010-12-17  0:53         ` Rupert Swarbrick
2010-12-17  1:03           ` "Purging" nndoc group, was: " Rupert Swarbrick
2010-12-17  7:52           ` Francis Moreau
2010-12-17  8:02             ` Rupert Swarbrick
2010-12-17  8:14               ` Francis Moreau
2010-12-17 16:30           ` Lars Magne Ingebrigtsen
2010-12-17 19:54             ` Francis Moreau
2010-12-17 19:57               ` Lars Magne Ingebrigtsen
2010-12-17 20:04                 ` Francis Moreau
2010-12-17 20:14                   ` Štěpán Němec
2010-12-16 15:53       ` Lars Magne Ingebrigtsen
2010-12-16 17:16         ` Leo
2010-12-16 17:19           ` Lars Magne Ingebrigtsen
2010-12-17  6:29             ` Štěpán Němec
2010-12-17  7:33               ` Francis Moreau
2010-12-18 20:34               ` Reiner Steib
2010-12-19  6:50                 ` Štěpán Němec
2010-12-17 10:01             ` Leo
2010-12-15 21:27   ` Tassilo Horn
2010-12-15 21:41     ` Francis Moreau
2010-12-15 22:06       ` Tassilo Horn
2010-12-15 22:27         ` Francis Moreau

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