[PATCH] emacs: add stash support for git send-email command line

David Edmondson dme at dme.org
Thu Oct 30 01:23:15 PDT 2014


On Wed, Oct 29 2014, Jani Nikula wrote:
>>> +(defun notmuch-show-stash-git-send-email ()
>>> +  "Copy From/To/Cc/Message-Id of current message to kill-ring in a form suitable for pasting to git send-email command line."
>>> +  (interactive)
>>> +  (notmuch-common-do-stash
>>> +   (concat
>>> +    (notmuch-show-stash-git-helper (message-tokenize-header (notmuch-show-get-from)) "--to=")
>>> +    (notmuch-show-stash-git-helper (message-tokenize-header (notmuch-show-get-to)) "--to=")
>>> +    (notmuch-show-stash-git-helper (message-tokenize-header (notmuch-show-get-cc)) "--cc=")
>>> +    (concat "--in-reply-to=\"" (notmuch-show-get-message-id t) "\""))))
>>
>> ...this would have to use something like:
>>
>>   (mapconcat 'identity (list
>> 			(notmuch-show-stash-git-helper (message-tokenize-header (notmuch-show-get-from)) "--to=")
>> 			(notmuch-show-stash-git-helper (message-tokenize-header (notmuch-show-get-to)) "--to=")
>> 			(notmuch-show-stash-git-helper (message-tokenize-header (notmuch-show-get-cc)) "--cc=")
>> 			(concat "--in-reply-to=\"" (notmuch-show-get-message-id t) "\""))
>> 	     "")
>>
>> to separate the chunks (untested).
>
> The last "" has to be " " to separate the elements,

Of course.

> but this brings another small wrinkle: if one of the headers is
> missing, typically Cc:, it will be nil in the list, and mapconcat adds
> spaces both sides of that, i.e. double space. Any ideas how to fix
> that?

I suppose a collecting loop would do it.

>> Do the leading and trailing spaces really matter?
>
> Does aesthetically displeasing count? Because message-tokenize-header
> splits using "," but headers typically have ", " between addresses, the
> end result will practically always have --to=" user at example.com" without
> the trimming.

The trimming is fine, really.


More information about the notmuch mailing list