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 D37C6431FBC
\r
6 for <notmuch@notmuchmail.org>; Tue, 28 Oct 2014 12:39:07 -0700 (PDT)
\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 lUIdhM0CPRo3 for <notmuch@notmuchmail.org>;
\r
16 Tue, 28 Oct 2014 12:39:03 -0700 (PDT)
\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 47397431FB6 for <notmuch@notmuchmail.org>; Tue, 28 Oct 2014 12:39:03 -0700
\r
22 Received: by mail-wg0-f45.google.com with SMTP id x12so292645wgg.18
\r
23 for <notmuch@notmuchmail.org>; Tue, 28 Oct 2014 12:39:02 -0700 (PDT)
\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;
\r
27 bh=VAIwQG7iPoPgFUWigd134XvEgHVegOun6qucsAmpNn4=;
\r
28 b=LXq3YeRUBDkp1JARY7nNs+8eqUdALe9xfZZYT/E81oSEpIBXI1jFvtRz2KblPevb0K
\r
29 lpXZdVE5v6tSCL3C8pnGkVPXkP/+sygDNcVA+6SAjYefm3Jlhrh3Khvo6/MC72PG9t+C
\r
30 X8glGd7O1KgB4ln6GwgC5LQgktENQTIcnSxKltFg6Qjhr/3gfW4fg7j32ufucbvIVbft
\r
31 27GIXdRb7RIM5/VlY+jLgYGUFR2/eBIklqWX5Wm9KLSsP3fNFo5S34a3+Caumf96Otqt
\r
32 L0dIWlyvRtHO6EZ3kQwHBrkGgSyaoN5C5I6g5+WlR6nbrZ+0q1OS0+ea6OrOmKmg6Wt7
\r
35 ALoCoQlghfPwBTIaEsfFxW59ybS8tvACIzMCST4PDTW1FxskJX/WB+5A3+Fy1zXzGZIbhA0VfUMD
\r
36 X-Received: by 10.180.11.200 with SMTP id s8mr30282882wib.20.1414525142036;
\r
37 Tue, 28 Oct 2014 12:39:02 -0700 (PDT)
\r
38 Received: from localhost (dsl-hkibrasgw2-58c36d-48.dhcp.inet.fi.
\r
40 by mx.google.com with ESMTPSA id w10sm2887777wje.10.2014.10.28.12.39.00
\r
41 for <multiple recipients>
\r
42 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
\r
43 Tue, 28 Oct 2014 12:39:01 -0700 (PDT)
\r
44 From: Jani Nikula <jani@nikula.org>
\r
45 To: notmuch@notmuchmail.org
\r
46 Subject: [PATCH] emacs: add stash support for git send-email command line
\r
47 Date: Tue, 28 Oct 2014 21:38:58 +0200
\r
48 Message-Id: <1414525138-838-1-git-send-email-jani@nikula.org>
\r
49 X-Mailer: git-send-email 2.1.1
\r
50 X-BeenThere: notmuch@notmuchmail.org
\r
51 X-Mailman-Version: 2.1.13
\r
53 List-Id: "Use and development of the notmuch mail system."
\r
54 <notmuch.notmuchmail.org>
\r
55 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
56 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
57 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
58 List-Post: <mailto:notmuch@notmuchmail.org>
\r
59 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
60 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
61 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
62 X-List-Received-Date: Tue, 28 Oct 2014 19:39:08 -0000
\r
64 Stash From/To/Cc as --to/--to/--cc, respectively, and Message-Id as
\r
65 --in-reply-to, suitable for pasting to git send-email command line.
\r
67 emacs/notmuch-show.el | 25 +++++++++++++++++++++++++
\r
68 1 file changed, 25 insertions(+)
\r
70 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
\r
71 index a9974826e824..328c93ba0584 100644
\r
72 --- a/emacs/notmuch-show.el
\r
73 +++ b/emacs/notmuch-show.el
\r
74 @@ -1274,6 +1274,7 @@ reset based on the original query."
\r
75 (define-key map "t" 'notmuch-show-stash-to)
\r
76 (define-key map "l" 'notmuch-show-stash-mlarchive-link)
\r
77 (define-key map "L" 'notmuch-show-stash-mlarchive-link-and-go)
\r
78 + (define-key map "G" 'notmuch-show-stash-git-send-email)
\r
79 (define-key map "?" 'notmuch-subkeymap-help)
\r
81 "Submap for stash commands")
\r
82 @@ -2125,6 +2126,30 @@ the user (see `notmuch-show-stash-mlarchive-link-alist')."
\r
83 (notmuch-show-stash-mlarchive-link mla)
\r
84 (browse-url (current-kill 0 t)))
\r
86 +(defun notmuch-show-stash-git-helper (addresses prefix)
\r
87 + "Escape, trim, and add PREFIX to each address in list of ADDRESSES."
\r
89 + (mapconcat (lambda (x)
\r
90 + (concat prefix "\""
\r
91 + ;; escape double-quotes
\r
92 + (replace-regexp-in-string
\r
94 + ;; trim leading and trailing spaces
\r
95 + (replace-regexp-in-string
\r
96 + "\\(^ *\\| *$\\)" ""
\r
100 +(defun notmuch-show-stash-git-send-email ()
\r
101 + "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
103 + (notmuch-common-do-stash
\r
105 + (notmuch-show-stash-git-helper (message-tokenize-header (notmuch-show-get-from)) "--to=")
\r
106 + (notmuch-show-stash-git-helper (message-tokenize-header (notmuch-show-get-to)) "--to=")
\r
107 + (notmuch-show-stash-git-helper (message-tokenize-header (notmuch-show-get-cc)) "--cc=")
\r
108 + (concat "--in-reply-to=\"" (notmuch-show-get-message-id t) "\""))))
\r
110 ;; Interactive part functions and their helpers
\r
112 (defun notmuch-show-generate-part-buffer (message-id nth)
\r