--- /dev/null
+Return-Path: <markwalters1009@gmail.com>\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 72ABD431E84\r
+ for <notmuch@notmuchmail.org>; Sat, 11 May 2013 13:16:02 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0.201\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0.201 tagged_above=-999 required=5\r
+ tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+ FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001,\r
+ RCVD_IN_DNSWL_LOW=-0.7] 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 ScblhjiEpzqJ for <notmuch@notmuchmail.org>;\r
+ Sat, 11 May 2013 13:15:57 -0700 (PDT)\r
+Received: from mail-wi0-f175.google.com (mail-wi0-f175.google.com\r
+ [209.85.212.175]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id 5321D431FAE\r
+ for <notmuch@notmuchmail.org>; Sat, 11 May 2013 13:15:56 -0700 (PDT)\r
+Received: by mail-wi0-f175.google.com with SMTP id h11so1678133wiv.8\r
+ for <notmuch@notmuchmail.org>; Sat, 11 May 2013 13:15:55 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+ h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to\r
+ :references; bh=u/V5lB31ajhoXBFXNTbgEvC7klDoew8Qbg+XBEKhrc0=;\r
+ b=hTb648BTkXl7HyR2M/575XJ49Th42UAqb8147o38pEdibz2efiBaerADgldJ8RkYrU\r
+ uEmKlmtBQ/V8imqLw5jEg/qD/YwAnwh1CYvpsmkuODT/reqxPpovmCOYCo9ZpzARf3mc\r
+ 9fk+lNd+FrfUESPkdCeNVhU1bPYw4qsfswoutuGXD7aMNoEVs1a7Ap6n7SPz7llnso8e\r
+ SdTO2g5DnYKqrSxzFxwQfhpp+v6UNwfuBZ8A8S9zaFOCg2+2uk1PC4MzBFlFP2ObU2h+\r
+ bw0GRjxleZIBI9kJyVbWYrAHRZNbm5A3OBGuvqEbLqC8j78LSwrgJatkSaHNU4nHsZ2G\r
+ PpZw==\r
+X-Received: by 10.180.82.74 with SMTP id g10mr10445711wiy.10.1368303355265;\r
+ Sat, 11 May 2013 13:15:55 -0700 (PDT)\r
+Received: from localhost (93-97-24-31.zone5.bethere.co.uk. [93.97.24.31])\r
+ by mx.google.com with ESMTPSA id fu14sm3458079wic.8.2013.05.11.13.15.54\r
+ for <multiple recipients>\r
+ (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
+ Sat, 11 May 2013 13:15:54 -0700 (PDT)\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 3/3] emacs: mua: allow the user to widen the reply\r
+Date: Sat, 11 May 2013 21:15:44 +0100\r
+Message-Id: <1368303344-13713-4-git-send-email-markwalters1009@gmail.com>\r
+X-Mailer: git-send-email 1.7.9.1\r
+In-Reply-To: <1368303344-13713-1-git-send-email-markwalters1009@gmail.com>\r
+References: <1368303344-13713-1-git-send-email-markwalters1009@gmail.com>\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: Sat, 11 May 2013 20:16:02 -0000\r
+\r
+Emacs message mode already has a widen reply option C-c C-f w (which\r
+obviously doesn't work when used via notmuch). This uses the new\r
+reply-all-recipients output to add a function to make it work in this case.\r
+---\r
+ emacs/notmuch-mua.el | 22 +++++++++++++++++++++-\r
+ 1 files changed, 21 insertions(+), 1 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el\r
+index 24eebff..1f28287 100644\r
+--- a/emacs/notmuch-mua.el\r
++++ b/emacs/notmuch-mua.el\r
+@@ -74,6 +74,12 @@ list."\r
+ :type '(repeat string)\r
+ :group 'notmuch-send)\r
+ \r
++;; This is used to store the reply all headers to allow the reply to\r
++;; be `widened' in the mail compose window.\r
++(defvar notmuch-mua-reply-all-recipients nil)\r
++(make-variable-buffer-local 'notmuch-mua-reply-all-recipients)\r
++(put 'notmuch-mua-reply-all-recipients 'permanent-local t)\r
++\r
+ ;;\r
+ \r
+ (defun notmuch-mua-get-switch-function ()\r
+@@ -145,6 +151,14 @@ list."\r
+ (funcall original-func header references)\r
+ (unless (bolp) (insert "\n")))\r
+ \r
++(defun notmuch-mua-widen-reply ()\r
++ (interactive)\r
++ (let ((reply-all-headers notmuch-mua-reply-all-recipients))\r
++ (message-replace-header "To" (plist-get reply-all-headers :To))\r
++ (message-replace-header "Cc" (plist-get reply-all-headers :Cc))\r
++ (message-replace-header "Bcc" (plist-get reply-all-headers :Bcc))\r
++ (message-sort-headers)))\r
++\r
+ (defun notmuch-mua-reply (query-string &optional sender reply-all)\r
+ (let ((args '("reply" "--format=json" "--format-version=1"))\r
+ reply\r
+@@ -165,7 +179,8 @@ list."\r
+ \r
+ ;; Extract the headers of both the reply and the original message.\r
+ (let* ((original-headers (plist-get original :headers))\r
+- (reply-headers (plist-get reply :reply-headers)))\r
++ (reply-headers (plist-get reply :reply-headers))\r
++ (reply-all-recipients (plist-get reply :reply-all-recipients)))\r
+ \r
+ ;; If sender is non-nil, set the From: header to its value.\r
+ (when sender\r
+@@ -191,6 +206,11 @@ list."\r
+ (notmuch-headers-plist-to-alist reply-headers)\r
+ nil (notmuch-mua-get-switch-function))))\r
+ \r
++ ;; Store the JSON for use by the mail compose window for header\r
++ ;; toggling etc.\r
++ (setq notmuch-mua-reply-all-recipients reply-all-recipients)\r
++ (local-set-key "\C-c\C-fw" 'notmuch-mua-widen-reply)\r
++\r
+ ;; Insert the message body - but put it in front of the signature\r
+ ;; if one is present\r
+ (goto-char (point-max))\r
+-- \r
+1.7.9.1\r
+\r