Re: [PATCH 1/2] Add Google Inc. to AUTHORS as a contributor.
[notmuch-archives.git] / 9e / 3e01d7f7924149fd9f12ae2c92d5ff7233611a
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 3C803431FC0\r
6         for <notmuch@notmuchmail.org>; Thu,  1 Jan 2015 09:45:31 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.7\r
10 X-Spam-Level: \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 q6MHxop+1E9G for <notmuch@notmuchmail.org>;\r
16         Thu,  1 Jan 2015 09:45:28 -0800 (PST)\r
17 Received: from mail-we0-f179.google.com (mail-we0-f179.google.com\r
18         [74.125.82.179]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
19         (No client certificate requested)\r
20         by olra.theworths.org (Postfix) with ESMTPS id D14DE431FAF\r
21         for <notmuch@notmuchmail.org>; Thu,  1 Jan 2015 09:45:27 -0800 (PST)\r
22 Received: by mail-we0-f179.google.com with SMTP id q59so3631669wes.10\r
23         for <notmuch@notmuchmail.org>; Thu, 01 Jan 2015 09:45:26 -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
27         :references;\r
28         bh=cPYWv1QBh0VWykq0+kLWKNTrOYO5doVIzyKOz65vGi8=;\r
29         b=k7IH+FPlnXc/P0Nt1aXIkdAxL+SxXQl1MoIBZCn0gThVN1Kd8DkW/Hucm7TaDxpW3f\r
30         FA9QNiOdbO+08iJWT7A7h9EnexBwwcVpI8ncHJ8DLu3ppqqiWi6MGIkNPFPYb3WtiW1G\r
31         kF5EMYeHo9ElzUV3zNu6p6tzfXk2vYtLRopzeU7MuyE7FFeNtRbahzeoJ4kDFSY9qhjb\r
32         d0JXuzQBr9ASc9C/v5Rx8vkiLopLg+6soi1VlW+O0gXInt1deA30NHM6OKAE/evUscZt\r
33         bkLIAABGbJCLhjzfnqUu4/JSXspS957GkYwNNSZWvxQIA0nc8jXBwSQUDGhnnEmxiSq8\r
34         YdXA==\r
35 X-Gm-Message-State:\r
36  ALoCoQkP5+8GrXOaJXy+hBvcimrqBXJ07dZNjZSvfRAQeXMhrTAJowhTwuGo0lLqs+CL/5ycJXgs\r
37 X-Received: by 10.180.198.211 with SMTP id\r
38  je19mr123902936wic.27.1420134325443;   Thu, 01 Jan 2015 09:45:25 -0800 (PST)\r
39 Received: from localhost (dsl-hkibrasgw2-58c371-91.dhcp.inet.fi.\r
40         [88.195.113.91])\r
41         by mx.google.com with ESMTPSA id vj1sm1517020wjc.49.2015.01.01.09.45.24\r
42         (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\r
43         Thu, 01 Jan 2015 09:45:24 -0800 (PST)\r
44 From: Jani Nikula <jani@nikula.org>\r
45 To: notmuch@notmuchmail.org\r
46 Subject: [PATCH v2] emacs: add stash support for git send-email command line\r
47 Date: Thu,  1 Jan 2015 19:45:32 +0200\r
48 Message-Id: <1420134332-25698-1-git-send-email-jani@nikula.org>\r
49 X-Mailer: git-send-email 2.1.4\r
50 In-Reply-To: <1414525138-838-1-git-send-email-jani@nikula.org>\r
51 References: <1414525138-838-1-git-send-email-jani@nikula.org>\r
52 X-BeenThere: notmuch@notmuchmail.org\r
53 X-Mailman-Version: 2.1.13\r
54 Precedence: list\r
55 List-Id: "Use and development of the notmuch mail system."\r
56         <notmuch.notmuchmail.org>\r
57 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
58         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
59 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
60 List-Post: <mailto:notmuch@notmuchmail.org>\r
61 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
62 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
63         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
64 X-List-Received-Date: Thu, 01 Jan 2015 17:45:31 -0000\r
65 \r
66 Stash From/To/Cc as --to/--to/--cc, respectively, and Message-Id as\r
67 --in-reply-to, suitable for pasting to git send-email command line.\r
68 ---\r
69  emacs/notmuch-show.el | 38 ++++++++++++++++++++++++++++++++++++++\r
70  1 file changed, 38 insertions(+)\r
71 \r
72 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
73 index b8cfbb8a3286..887d877672fc 100644\r
74 --- a/emacs/notmuch-show.el\r
75 +++ b/emacs/notmuch-show.el\r
76 @@ -1280,6 +1280,7 @@ reset based on the original query."\r
77      (define-key map "t" 'notmuch-show-stash-to)\r
78      (define-key map "l" 'notmuch-show-stash-mlarchive-link)\r
79      (define-key map "L" 'notmuch-show-stash-mlarchive-link-and-go)\r
80 +    (define-key map "G" 'notmuch-show-stash-git-send-email)\r
81      (define-key map "?" 'notmuch-subkeymap-help)\r
82      map)\r
83    "Submap for stash commands")\r
84 @@ -2131,6 +2132,43 @@ the user (see `notmuch-show-stash-mlarchive-link-alist')."\r
85    (notmuch-show-stash-mlarchive-link mla)\r
86    (browse-url (current-kill 0 t)))\r
87  \r
88 +(defun notmuch-show-stash-git-helper (addresses prefix)\r
89 +  "Escape, trim, quote, and add PREFIX to each address in list of ADDRESSES."\r
90 +  (mapconcat (lambda (x)\r
91 +              (concat prefix "\""\r
92 +                      ;; escape double-quotes\r
93 +                      (replace-regexp-in-string\r
94 +                       "\"" "\\\\\""\r
95 +                       ;; trim leading and trailing spaces\r
96 +                       (replace-regexp-in-string\r
97 +                        "\\(^ *\\| *$\\)" ""\r
98 +                        x)) "\""))\r
99 +            addresses " "))\r
100 +\r
101 +(put 'notmuch-show-stash-git-send-email 'notmuch-prefix-doc\r
102 +     "Copy From/To/Cc of current message to kill-ring in a form suitable for pasting to git send-email command line.")\r
103 +\r
104 +(defun notmuch-show-stash-git-send-email (&optional no-in-reply-to)\r
105 +  "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
106 +\r
107 +If invoked with a prefix argument (or NO-IN-REPLY-TO is non-nil,\r
108 +omit --in-reply-to=<Message-Id>."\r
109 +  (interactive "P")\r
110 +  (notmuch-common-do-stash\r
111 +   (mapconcat 'identity\r
112 +             (remove ""\r
113 +                     (list\r
114 +                      (notmuch-show-stash-git-helper\r
115 +                       (message-tokenize-header (notmuch-show-get-from)) "--to=")\r
116 +                      (notmuch-show-stash-git-helper\r
117 +                       (message-tokenize-header (notmuch-show-get-to)) "--to=")\r
118 +                      (notmuch-show-stash-git-helper\r
119 +                       (message-tokenize-header (notmuch-show-get-cc)) "--cc=")\r
120 +                      (unless no-in-reply-to\r
121 +                        (notmuch-show-stash-git-helper\r
122 +                         (list (notmuch-show-get-message-id t)) "--in-reply-to="))))\r
123 +             " ")))\r
124 +\r
125  ;; Interactive part functions and their helpers\r
126  \r
127  (defun notmuch-show-generate-part-buffer (message-id nth)\r
128 -- \r
129 2.1.4\r
130 \r