1 Return-Path: <jani@nikula.org>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id 8AA49431FAF
\r
6 for <notmuch@notmuchmail.org>; Fri, 2 Jan 2015 09:48:16 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5
\r
12 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled
\r
13 Received: from olra.theworths.org ([127.0.0.1])
\r
14 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id fCJ9uIpFaq-1 for <notmuch@notmuchmail.org>;
\r
16 Fri, 2 Jan 2015 09:48:13 -0800 (PST)
\r
17 Received: from mail-wg0-f45.google.com (mail-wg0-f45.google.com
\r
18 [74.125.82.45]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client
\r
19 certificate requested) by olra.theworths.org (Postfix) with ESMTPS id
\r
20 27226431FAE for <notmuch@notmuchmail.org>; Fri, 2 Jan 2015 09:48:13 -0800
\r
22 Received: by mail-wg0-f45.google.com with SMTP id b13so24398328wgh.32
\r
23 for <notmuch@notmuchmail.org>; Fri, 02 Jan 2015 09:48:11 -0800 (PST)
\r
24 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
\r
25 d=1e100.net; s=20130820;
\r
26 h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to
\r
28 bh=TY05P/XP9f2TJiSRX9ehloQflN/j9ccXZOQa/V1mGIk=;
\r
29 b=GH4E1U0O0ySHS7I6m45jhOMK6vwv3lgHhG+YhICKiOxHGHI30Z6YRsExeuTuT91SsO
\r
30 EtuM2DS6kco5PRObIJM4+lb+3H7MtPBWgVl7dJyO/MS/i9iKbPTw1f66MSB5mBybOvqI
\r
31 p93uFEicOJP8ijNUJgxEU6pSlLr9XdIurKA8Q0mxke1fFWyFoprB15kUso2PkSMBogX0
\r
32 YhAkB7WUBGCSSta9U0ycBpc+9baJTXS1IO4GIKq7qvrnR7/uGQUsHUYgB+c7P+HYEwF4
\r
33 7ObmvHmhOn2gjcePbM0yqel+H3ao2rF5D59AWWk1C6n+TEVJ4JcGoUk32H2g7lhmEq2G
\r
36 ALoCoQnU6d+EI0Q15pg4jVAe2kdHn59DwVyR9E8FYm/1iDl0NGZNlcCVDAzBp9Q1r8BKVD6ZvoSk
\r
37 X-Received: by 10.194.108.98 with SMTP id hj2mr153307809wjb.102.1420220891679;
\r
38 Fri, 02 Jan 2015 09:48:11 -0800 (PST)
\r
39 Received: from localhost (mobile-internet-bceeb5-193.dhcp.inet.fi.
\r
41 by mx.google.com with ESMTPSA id s9sm54849110wiz.12.2015.01.02.09.48.10
\r
42 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
\r
43 Fri, 02 Jan 2015 09:48:10 -0800 (PST)
\r
44 From: Jani Nikula <jani@nikula.org>
\r
45 To: David Edmondson <dme@dme.org>,
\r
46 notmuch@notmuchmail.org
\r
47 Subject: [PATCH v3] emacs: add stash support for git send-email command line
\r
48 Date: Fri, 2 Jan 2015 19:48:17 +0200
\r
49 Message-Id: <1420220897-6245-1-git-send-email-jani@nikula.org>
\r
50 X-Mailer: git-send-email 2.1.4
\r
51 In-Reply-To: <cuna921smnf.fsf@gargravarr.hh.sledj.net>
\r
52 References: <cuna921smnf.fsf@gargravarr.hh.sledj.net>
\r
53 X-BeenThere: notmuch@notmuchmail.org
\r
54 X-Mailman-Version: 2.1.13
\r
56 List-Id: "Use and development of the notmuch mail system."
\r
57 <notmuch.notmuchmail.org>
\r
58 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
59 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
60 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
61 List-Post: <mailto:notmuch@notmuchmail.org>
\r
62 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
63 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
64 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
65 X-List-Received-Date: Fri, 02 Jan 2015 17:48:16 -0000
\r
67 Stash From/To/Cc as --to/--to/--cc, respectively, and Message-Id as
\r
68 --in-reply-to, suitable for pasting to git send-email command line.
\r
70 emacs/notmuch-show.el | 38 ++++++++++++++++++++++++++++++++++++++
\r
71 1 file changed, 38 insertions(+)
\r
73 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
\r
74 index b8cfbb8a3286..9f6fe077df0c 100644
\r
75 --- a/emacs/notmuch-show.el
\r
76 +++ b/emacs/notmuch-show.el
\r
77 @@ -1280,6 +1280,7 @@ reset based on the original query."
\r
78 (define-key map "t" 'notmuch-show-stash-to)
\r
79 (define-key map "l" 'notmuch-show-stash-mlarchive-link)
\r
80 (define-key map "L" 'notmuch-show-stash-mlarchive-link-and-go)
\r
81 + (define-key map "G" 'notmuch-show-stash-git-send-email)
\r
82 (define-key map "?" 'notmuch-subkeymap-help)
\r
84 "Submap for stash commands")
\r
85 @@ -2131,6 +2132,43 @@ the user (see `notmuch-show-stash-mlarchive-link-alist')."
\r
86 (notmuch-show-stash-mlarchive-link mla)
\r
87 (browse-url (current-kill 0 t)))
\r
89 +(defun notmuch-show-stash-git-helper (addresses prefix)
\r
90 + "Escape, trim, quote, and add PREFIX to each address in list of ADDRESSES, and return the result as a single string."
\r
91 + (mapconcat (lambda (x)
\r
92 + (concat prefix "\""
\r
93 + ;; escape double-quotes
\r
94 + (replace-regexp-in-string
\r
96 + ;; trim leading and trailing spaces
\r
97 + (replace-regexp-in-string
\r
98 + "\\(^ *\\| *$\\)" ""
\r
102 +(put 'notmuch-show-stash-git-send-email 'notmuch-prefix-doc
\r
103 + "Copy From/To/Cc of current message to kill-ring in a form suitable for pasting to git send-email command line.")
\r
105 +(defun notmuch-show-stash-git-send-email (&optional no-in-reply-to)
\r
106 + "Copy From/To/Cc/Message-Id of current message to kill-ring in a form suitable for pasting to git send-email command line.
\r
108 +If invoked with a prefix argument (or NO-IN-REPLY-TO is non-nil),
\r
109 +omit --in-reply-to=<Message-Id>."
\r
110 + (interactive "P")
\r
111 + (notmuch-common-do-stash
\r
112 + (mapconcat 'identity
\r
115 + (notmuch-show-stash-git-helper
\r
116 + (message-tokenize-header (notmuch-show-get-from)) "--to=")
\r
117 + (notmuch-show-stash-git-helper
\r
118 + (message-tokenize-header (notmuch-show-get-to)) "--to=")
\r
119 + (notmuch-show-stash-git-helper
\r
120 + (message-tokenize-header (notmuch-show-get-cc)) "--cc=")
\r
121 + (unless no-in-reply-to
\r
122 + (notmuch-show-stash-git-helper
\r
123 + (list (notmuch-show-get-message-id t)) "--in-reply-to="))))
\r
126 ;; Interactive part functions and their helpers
\r
128 (defun notmuch-show-generate-part-buffer (message-id nth)
\r