Re: [PATCH] emacs: add stash support for git send-email command line
authorDavid Edmondson <dme@dme.org>
Thu, 30 Oct 2014 08:23:15 +0000 (08:23 +0000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 18:05:53 +0000 (10:05 -0800)
58/89ac2841b5b0242b3a71b1f7347bd7a9f862db [new file with mode: 0644]

diff --git a/58/89ac2841b5b0242b3a71b1f7347bd7a9f862db b/58/89ac2841b5b0242b3a71b1f7347bd7a9f862db
new file mode 100644 (file)
index 0000000..7a0e5e6
--- /dev/null
@@ -0,0 +1,115 @@
+Return-Path: <dme@dme.org>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id E97FB431FC7\r
+       for <notmuch@notmuchmail.org>; Thu, 30 Oct 2014 01:23:22 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.699\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.699 tagged_above=-999 required=5\r
+       tests=[RCVD_IN_DNSWL_LOW=-0.7, UNPARSEABLE_RELAY=0.001]\r
+       autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id ADLRXvldc3b3 for <notmuch@notmuchmail.org>;\r
+       Thu, 30 Oct 2014 01:23:18 -0700 (PDT)\r
+Received: from mail-wi0-f173.google.com (mail-wi0-f173.google.com\r
+       [209.85.212.173]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 07BF4431FB6\r
+       for <notmuch@notmuchmail.org>; Thu, 30 Oct 2014 01:23:17 -0700 (PDT)\r
+Received: by mail-wi0-f173.google.com with SMTP id n3so3761429wiv.12\r
+       for <notmuch@notmuchmail.org>; Thu, 30 Oct 2014 01:23:16 -0700 (PDT)\r
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+       d=1e100.net; s=20130820;\r
+       h=x-gm-message-state:to:subject:in-reply-to:references:user-agent\r
+       :from:date:message-id:mime-version:content-type;\r
+       bh=iNmDl6cLX9FIfv1SFN7rx5HNlv3kNiS+Ssyy1kJz6GI=;\r
+       b=kG5aPWy2RmfZhWRnoXN9LUKbSuDzuMHAtTpi8BAfNx7w5+RcumoHVeVdvfedXQyC7U\r
+       WSsMLk2g02bptqKPbghsK9cegN0XMFMHCaIWMEGvcaKWG9a9lRPJwOPvjD7DHiY51I3b\r
+       iQLXYYhmr5UNjYMuKjWfR8VtY8FwmicqYS1FuUKrdmiM+l4RsGBP6FbJ/nOZFFDpmrTV\r
+       FTjjLc4v1iVPxkB0m6MR/QE7DsqIBIibO0wQvotu5UyTQEf4rFiHTywsfMBBdysyns8x\r
+       XIjktulab4tfUsoiKrpFDGqczMVcPYeyxpMop5og3iZJxN4tcC+4c2Np1Dmi367aZEU+\r
+       5q4Q==\r
+X-Gm-Message-State:\r
+ ALoCoQk5uEUd+FGA4VcXU169OOM/QPdBktoprIRLrBNWAl8YWt1gDhPGb+sFHhYhG0RRO50R8GSR\r
+X-Received: by 10.180.83.37 with SMTP id n5mr41945260wiy.7.1414657396648;\r
+       Thu, 30 Oct 2014 01:23:16 -0700 (PDT)\r
+Received: from disaster-area.hh.sledj.net\r
+       ([2a01:348:1a2:1:ea39:35ff:fe2c:a227])\r
+       by mx.google.com with ESMTPSA id pc8sm7818513wjb.36.2014.10.30.01.23.15\r
+       for <multiple recipients>\r
+       (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\r
+       Thu, 30 Oct 2014 01:23:15 -0700 (PDT)\r
+Received: from localhost (30000@localhost [local]);\r
+       by localhost (OpenSMTPD) with ESMTPA id f494b3f8;\r
+       Thu, 30 Oct 2014 08:23:14 +0000 (UTC)\r
+To: Jani Nikula <jani@nikula.org>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH] emacs: add stash support for git send-email command line\r
+In-Reply-To: <87y4ryzju6.fsf@nikula.org>\r
+References: <1414525138-838-1-git-send-email-jani@nikula.org>\r
+       <m2h9yn6zf1.fsf@dme.org> <87y4ryzju6.fsf@nikula.org>\r
+User-Agent: Notmuch/0.18.1 (http://notmuchmail.org) Emacs/24.3.1\r
+       (x86_64-apple-darwin14.0.0)\r
+From: David Edmondson <dme@dme.org>\r
+Date: Thu, 30 Oct 2014 08:23:15 +0000\r
+Message-ID: <m238a66k5o.fsf@dme.org>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Thu, 30 Oct 2014 08:23:23 -0000\r
+\r
+On Wed, Oct 29 2014, Jani Nikula wrote:\r
+>>> +(defun notmuch-show-stash-git-send-email ()\r
+>>> +  "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
+>>> +  (interactive)\r
+>>> +  (notmuch-common-do-stash\r
+>>> +   (concat\r
+>>> +    (notmuch-show-stash-git-helper (message-tokenize-header (notmuch-show-get-from)) "--to=")\r
+>>> +    (notmuch-show-stash-git-helper (message-tokenize-header (notmuch-show-get-to)) "--to=")\r
+>>> +    (notmuch-show-stash-git-helper (message-tokenize-header (notmuch-show-get-cc)) "--cc=")\r
+>>> +    (concat "--in-reply-to=\"" (notmuch-show-get-message-id t) "\""))))\r
+>>\r
+>> ...this would have to use something like:\r
+>>\r
+>>   (mapconcat 'identity (list\r
+>>                     (notmuch-show-stash-git-helper (message-tokenize-header (notmuch-show-get-from)) "--to=")\r
+>>                     (notmuch-show-stash-git-helper (message-tokenize-header (notmuch-show-get-to)) "--to=")\r
+>>                     (notmuch-show-stash-git-helper (message-tokenize-header (notmuch-show-get-cc)) "--cc=")\r
+>>                     (concat "--in-reply-to=\"" (notmuch-show-get-message-id t) "\""))\r
+>>          "")\r
+>>\r
+>> to separate the chunks (untested).\r
+>\r
+> The last "" has to be " " to separate the elements,\r
+\r
+Of course.\r
+\r
+> but this brings another small wrinkle: if one of the headers is\r
+> missing, typically Cc:, it will be nil in the list, and mapconcat adds\r
+> spaces both sides of that, i.e. double space. Any ideas how to fix\r
+> that?\r
+\r
+I suppose a collecting loop would do it.\r
+\r
+>> Do the leading and trailing spaces really matter?\r
+>\r
+> Does aesthetically displeasing count? Because message-tokenize-header\r
+> splits using "," but headers typically have ", " between addresses, the\r
+> end result will practically always have --to=" user@example.com" without\r
+> the trimming.\r
+\r
+The trimming is fine, really.\r